MathJax

Sunday, January 31, 2016

A Few Scary Things about Bernie Sanders

In the wake of the Iowa Primaries tomorrow and the race to find a Republican and Democratic candidate, I need to share a few feelings.

I am a little scared.

There are a few frightening things about Bernie Sanders, and I need to face these.

We, as a nation, are so used to the government and political system now in place.  The wealthy and elite use their money to put things in ads and on the news, and shape our way of thinking.  At the risk of sounding a little nutty, I do not trust the liberal media anymore.  The New York Times disgusts me.  It creates shepherds and puppets on the left just as Fox News does on the right. Today is no exception as it endorsed Hillary Clinton.

We'll eventually elect a president.  The story usually proceeds as follows: half of us will bitch for 4-8 years while 75-90% of us bitch the whole time about a do-nothing Congress.

This is what we're used to.  This is what we're comfortable with.

The thought of changing this system is scary.  The liberal media doesn't want to change.  And to combat this, it has inserted many questions into the minds of the shepherds on the left.  Questions that, upon given a little thought, have answers.

It is scary that our voices may soon be just as loud as the voices of the millionaires and billionaires.  It is scary that we may have to do some thinking on our own, come up with our own opinions on the issues, and own up to our own deficiencies, instead of pointing the finger at those that have put the ideas in our head in the first place.

As Robert Reich elegantly put it (from the point of view of a democrat):
Hillary Clinton is clearly the most qualified candidate to become president of the political system we now have. Bernie Sanders is clearly the most qualified candidate to create the political system we should have. 
If we look at the endorsement primary this becomes too true. Using 1 point, 5 points, and 10 points for endorsements from representatives, senators, and governors, respectively, Hillary Clinton has 463 endorsement points to Bernie's 2.

This, in itself, makes many of the shepherds and puppets on the left believe Bernie is unelectable.  Let's do the math.  It means 148 representatives, 39 senators, and 12 governors have endorsed Hillary. The last I checked, they only get to cast one vote.  That is 199 votes from the political elite.  If you want the political elite to do your thinking for you, that is up to you.  It is scary, and takes courage to have a voice against the political elite sometimes.


TOGETHER from HUMAN on Vimeo.

Many regurgitate the question about how he's going to pay for all this, again, inserted into their minds by their trusted liberal media.

This is an oversimplification, but it will help understand the gist of how we are going to pay for 'all this stuff.'  Have you ever moved?  Switching presidencies is kind of like this.  When you move, you have to shut off all the utilities at the place from which you are moving and turn on the utilities at the place to which you are moving.  Asking how we're going to pay for all of this, is like moving from one place to the next and, for some reason, getting confused as to how you're going to pay for all these 'utilities'.

Some may be cheaper, some may be more expensive.  But we've been "paying for stuff" this whole time.

Can you handle the truth?  It is scary isn't it?

from Project Bernie '16 @ProjectBernie16
It will take courage to vote for Bernie Sanders in 2016. This will not be for the weak of heart.

However, if you're too chicken shit, I'll try and understand.  

Friday, January 22, 2016

Can I Cross? Let Me Flip a Coin.

Let's face it, I'm an addict of these riddles.

This week's riddle from Ollie at FiveThirtyEight is a longer one:
You’re on the north shore of a river, and want to cross to the south, via a series of 13 bridges and six islands, which you can see in the diagram below. But, as you approach the water, night falls, a bad storm rolls in, and you’re forced to wait until morning to try to cross. Overnight, the storm could render some of the bridges unusable — it has a 50 percent chance of knocking out each of the bridges. (The chance is independent for each bridge.)
 Question 1: What’s the probability you will be able to cross the river in the morning? (You have no boat, can’t swim, can’t fix the bridges, etc. No tricks.)
Now imagine a different, wider river, with many more islands — in fact, arbitrarily many. Specifically, imagine that the islands are arrayed in an N-rows-by-N+1-columns grid — similar to before, where N happened to equal two — and connected by bridges to each adjacent island in the same way. Each island adjacent to the shore is also connected by a bridge to the shore. It would look something like this:
 Question 2: What’s the probability you’ll be able to cross this river in the morning, after the same storm — with the same independent 50 percent chance of knocking out each bridge — rolls through?
There is also some Extra Credit, but I'm skipping that.

So, first we'll deal with Question 1.  I wondered for a while what was special about the N x N+1 pattern, but it became clear rather quickly.

We would like to solve for p, the probability that we will make it across the river.  There is also q = 1-p which is the probability that we do not make it across the river.

To solve this let's first imagine that all of these bridges are low enough that motor boats cannot go underneath them.  Motorboat Billy has been really pissed about this whole island and bridge system for a very long while now because every time he wants to go from the East River to the West River, he has to go through the long painstaking process of dragging his boat ashore and pulling it all the way beyond this pesky bridge system.

Needless to say, he is excited about this storm.  He will finally have some probability that the storm will take away enough bridges that he will get to pass!


Notice that the potential places he can pass are lined up exactly like the bridges.  This would not be the case if it were not N x N+1.

We are looking at the same exact problem!  What does this mean?  The probability that Motorboat Billy will be able to pass from the East River to the West River is q, the probability that we will not be able to pass from the North to the South shore, and the probability that he will not be able to pass is p, the probability that we will get to pass.

Since both problems are equivalent, p=q, and q=p, and the only way that this can happen is if p=q=0.5.

Hence, the probability is 50%.  You can add as many islands and bridges as you want. As long as it remains in the N x N+1 pattern, the probability will remain 50%.

How do you like them apples?

Wednesday, January 20, 2016

A Neurotic Free Throw Shooter

This riddle hit the internet as I was leaving on my 6th Annual Michigan Beer Tour.  Being the minimalist that I am, I wasn't about to bring my laptop and type up anything on the road. However, that didn't stop me from thinking about it.

Here is the riddle for this week quoted for convenience:
A basketball player is in the gym practicing free throws. He makes his first shot, then misses his second. This player tends to get inside his own head a little bit, so this isn’t good news. Specifically, the probability he hits any subsequent shot is equal to the overall percentage of shots that he’s made thus far. (His neuroses are very exacting.) His coach, who knows his psychological tendency and saw the first two shots, leaves the gym and doesn’t see the next 96 shots. The coach returns, and sees the player make shot No. 99. What is the probability, from the coach’s point of view, that he makes shot No. 100?
I was proud to say I was able to come up with the correct answer right away. Because of this, however, I naturally thought I was missing something and would have to rigorously analyze it.

My initial thinking was as follows.  The coach has seen three shots, two of which he has made, so from the coach's perspective, the player has a conditional probability of 2/3 of making his next shot. This is correct.

But doesn't knowing that it is the 100th shot coming up give you extra information?  It turns out that it doesn't.

Let X3 be a random variable that will be 0 if shot 3 is missed and 1 if shot 3 is made.  Define X4-X100 analogously.  

Let p3 be the probability of making the 3rd shot, and q3 = 1-p3 the probability of missing the 3rd shot.  Define p4-p100 analogously.  We know from the problem statement that p3=q3=1/2.

If we are given that X3=1 (that he makes the 3rd shot), then the expected value of p4 is 2/3.  In fact, it is a sure thing.

Suppose the coach didn't see the 3rd shot, but saw that the player made the 4th shot (X4=1).  Given that, what is the expected value of p5?

What could have happened?  There is a 1/2 probability that he made the third shot, leading to a 2/3 probability that he made the fourth shot. Multiplying these together gives us that the probability that he made the 3rd AND 4th shots is 1/3.

There is also a 1/2 probability that he missed the 3rd shot leading to a 1/3 probability that he made the 4th shot.  Multiplying these together gives us that the probability that he missed the 3rd and made the 4th is 1/6.

So, the conditional probabilities of each of these events if (1/3)/(1/3+1/6)=2/3 and (1/6)/(1/3+1/6)=1/3 respectively.

All the coach knows right now is that one of those two events happened since he only knows that the 4th shot is made.  If the first of these had occurred, then there is a probability of 3/4 that he will make shot 5 (since 3 of 4 shots have been made thus far).  If the second of these had occurred, then there is a probability of 1/2 that he will make the shot 5 (since 2 of 4 shots have been made thus far).

So, the conditional expectation of the probability he will make his 5th shot given he made his 4th is found by taking a weighted average of these probabilities: (2/3)(3/4)+(1/3)(1/2) = 2/3.

Missing what happened on the third shot and witnessing the 4th shot made had no effect of the probability of making the 5th shot from the coach's perspective. This is the bizarre nature of conditional probabilities.

Let's explore one more just for kicks.  Suppose the coach missed shots 3 and 4 and came back in to witness that he made shot 5.   There are four possible scenarios: (X3=1,X4=1,X5=1), (X3=1,X4=0,X5=1), (X3=0,X4=1,X5=1), or (X3=0,X4=0,X5=1).  These four scenarios have probabilities (1/2)(2/3)(3/4)=1/4, (1/2)(1/3)(1/2)=1/12, (1/2)(1/3)(1/2)=1/12, and (1/2)(2/3)(1/4)=1/12  respectively.  Their sum is 1/2.

Since we are under the condition that one of them has occurred we can find the conditional probabilities by dividing them all by 1/2.  This gives 1/2, 1/6, 1/6, and 1/6 respectively.

In the four scenarios, the probability that he will make the 6th shot is 4/5, 3/5, 3/5, and 2/5 respectively.  Taking the weighted average gives the conditional expectation of the probability he will make the 6th shot given that he made the 5th: (1/2)(4/5)+(1/6)(3/5)+(1/6)(3/5)+(1/6)(2/5)=2/3.

Missing what happened on the third and fourth shot and witnessing the 5th shot made had no effect on the probability of making the 6th shot from the coach's perspective.

Still not convinced?  Then you're stubborn.

Sunday, January 10, 2016

The Sadistic Car Salesman, Part 2

I can shave off 1.67 since I was wrong the first time.  Let's be a little more rigorous in defining the optimal strategy.  The optimal strategy is the one that will end with the least amount over the fair price on average.

There are 5!=120 different possible arrangements of the cards, each of which is assumed equally likely.

Note that if we are in the situation of having been shown the smallest and largest card before the last card is shown, we have complete information and can make an informed decision on when to stop.

Let's start with analyzing the case that we have been shown 4 cards that have consecutive values, and hence, still do not have complete information.  What should we do in this case?

4.1. If we are currently on the smallest card, then we are looking at either N or N+100.  This means we would pay 50 over on average if we stop.  If we continue, then the next card will be either N+400 or N respectively, meaning we would pay an average of 200 over if we continue. Stopping is in our best interest.

4.2 If we are currently on the second smallest card, then we are looking at either N+100 or N+200.  This means we would pay 150 over on average if we stop.  Since 200 over is the average if we continue, we should stop in this situation.

4.3. If we are currently looking at the second largest card, then we are looking at either N+200 or N+300, paying an average 250 over if we stop. Continuing in this case is in our best interests.

4.4. Looking at either N+300 or N+400 means we pay an average of 350 over. Again, continuing is in our best interests.

Let's now explore some 3 card scenarios.  Let's start with the situation in having seen 3 cards that have consecutive values. That is, you are either looking at N, N+100, N+200, or N+100, N+200, N+300, or N+200, N+300, N+400.  If we decide to continue in this situation, let's see what would happen.

3.1 Given the N, N+100, N+200 situation, we would either see the sequence N+300, N+400 or N+400, N+300 next.  In either case, we continue to the end given 4.4 above or complete information respectively.

3.2 Given the N+100, N+200, N+300 situation, we would either see the sequence N, N+400 or N+400, N next.  In either case we stop at N given 4.1 and 4.4 above.

3.3 Given the N+200, N+300, N+400 case, we would either see the sequence N, N+100, or N+100, N.  We would stop at the fourth card given complete information or case 4.1. 

Given these 6 permutations, we are paying an average of (400+300+0+0+0+100)/6=133.33 over if we elect to continue.  So, let's look at each case.

3.1.1. We are currently looking at the smallest of the three cards, which means we are either looking at N, N+100, or N+200.  If we stop, we pay an average of 100 over fair price.  Compared to the 133.33, this is the better deal.  It is beneficial to stop.

3.2.1. The current card is middle card: either N+100, N+200, or N+300.  Stopping means we pay an average of 200 over.  When compared to 133.33, we elect to continue in this situation.

3.3.1. If our current card is the largest card of either N+200, N+300, or N+400, we pay an average of 300 over, and so continuing is a no-brainer.

Now let's explore 3.4, the situation in which we are looking at 3 cards in the form N, N+100, N+300, or N+100, N+200, N+400, and 3.5, the situation in which we are looking at 3 cards in the form N, N+200, N+300, or N+100, N+300, N+400.

Suppose we continue in case 3.4.  

3.4.1. Given the N, N+100, N+300 case, we either see N+200, N+400 or N+400, N+200.  We go to the end in either case given 4.3 or complete information.

3.4.2. Given the N+100, N+200, N+400 case, we either see N, N+300 or N+300, N.  In either case, we stop at 0 over given complete information or 4.3.  

This produces an average of (400+200+0+0)/4=150 over if we elect to continue in this situation.  So, let's look at each case.

3.4.3. We are currently looking at the smallest of the three cards, meaning we're looking at either N or N+100.  This is an average of 50 over.  It is beneficial to stop when compared to 150.

3.4.4. We are on the middle card of either N+100 or N+200 paying an average of 150 if we stop.  This is the only case in which we could stay or continue and have the same average.  Since the variance is lower for staying, let's assume we stay in this case.

3.4.5. If the current card is the largest of either N+300 or N+400, then the average of 350 is much more than the average of 150 if we continue. Continuing here is a no-brainer.

What if we continue in case 3.5?

3.5.1. Given the N, N+200, N+300 case, we either see N+100, N+400 or N+400, N+100.  In either case, we stop at N+100 given 4.2 or complete information.

3.5.2. Given the N+100, N+300, N+400 case, we either see the sequence N, N+200, or N+200, N. We'll stop at the fourth card using complete information or 4.2 respectively.

This produces an average of (100+100+0+200)/4=100 over if we elect to continue. Let's quickly examine each case.

3.5.3. If we are looking at the smallest of the three cards we have seen this averages 50 over. We stay.

3.5.4. The middle cards of N+200 or N+300 has us paying 250 over on average. Continue!

3.5.5. We're on the largest of these three?!? Continue!!

Now comes the largest part of analyzing the two card scenarios.  However, with the analysis above, it isn't too daunting.

If the first two cards are N+400 and N, then we stop with the complete information and pay 0 over.  There are 6 permutations of 5 cards where these are the first two cards.  T=0, P=6. 

If the first two are N+300 and N or N+400 and N+100, we should stop.  (I've analyzed this on a previous blog, but the idea is that stopping has you pay an average of 50 over while continuing has you pay an average of 100 over).  This has you paying 0 over for 6 permutations and 100 over for 6 permutations.

Our current total and number of permutations is T=600 and P=18. 

If the first two are N+400, N+200, or N+300, N+100, or N+200, N, we pay an average of 100 over if we stop.  If we continue?

2.1.1. Continuing with N+400, N+200, if we see N next we'll stop. We pay 0 with the two permutations associated with that.  If we see N+100 next we'll stop by 3.4.3 and pay 100 over with the two permutations associated with it.  If we see N+300 next, we continue by 3.2.1.  We'll pay 100 if we see the N+100, N permutation and 0 if we see the N, N+100 permutation.  T=900, P=24

2.1.2. Continuing with N+300, N+100, if we see N next we'll stop by 3.4.3 and pay 0 with those two permutations. Seeing N+200 next will have us continue by 3.2.1 and see either N+400, N or N, N+400, both of which end at paying 0 over by 4.4 or 4.1 respectively. Seeing N+400 next has us continue by 3.5.5 to see either N+200, N or N, N+200, both of which has us stop at the 4th card by 4.2 or complete information. T=1100, P=30

2.1.3. Continuing with N+200, N, if we see N+100 next we'll continue by 3.2.1 and see either N+300, N+400, or N+400, N+300, both of which we will see to the end by using 4.4 or complete information. If N+300 is next, we continue by 3.5.5 and see either N+100, N+400, or N+400, N+100 both of which we stop at N+100 by 4.2 or complete information.  If N+400 is next, we have complete information and will stop a N+100 with those two permutations.  T=2200, P=36

If we were to have stayed given those three cases then we would have paid an average of 100 over for the 18 permutations associated with it bringing our total up to 2400 instead. Continuing is better.

Analyzing the case of seeing N+200, N+400, or N+100, N+300, or N, N+200 is completely analogous, except for the fact that it is easier to see you should continue in this case.  Adding another 1600 to the total and another 18 permutations gives us T=3800, P=54.

Let's now look at the cases when the first two are N+400, N+300, or N+300, N+200, or N+200, N+100, or N+100, N.  We pay an average of 200 over if we stop.  Continuing is best.

2.2.1. If we continue with N+400, N+300, we will stop on N+200, N+100, or N given 3.1.1, 3.5.3, or complete information.  T=4400, P=60.

2.2.2. Continuing with N+300, N+200, we will stop on N+100 or N if they are next by 3.1.1 or 3.5.3. If N+400 is next we continue by 3.3.1 to see either N+100, N or N, N+100 stopping on the fourth card.  T=4700, P=66. 

2.2.3. Continuing with N+200, N+100, we will stop on N by 3.1.1. If we see N+400 or N+300 next, we continue and stop at N in either case.  T=4700, P=72. 

2.2.4. If we see N+100, N we'll explore all 6 cases.  The permutations (N+100, N, N+200, N+300, N+400), (N+100, N, N+200, N+400, N+300), (N+100, N, N+300, N+200, N+400), (N+100, N, N+300, N+400, N+200), and (N+100, N, N+400, N+300, N+200) will all have us going until the last card. The permutation (N+100, N, N+400, N+200, N+300) will have us stop at the 4th card because of complete information.  T=6400, P=78. 

Going from 3800 to 6400 was a 2600 bump with 24 more permutations.  This is important only in that analyzing the cases N+300, N+400 or N+200, N+300, or N+100, N+200, or N, N+100 is the exact same.  T=9000, P=102. 

We're almost there. Now, to look at the two cases N, N+300 and N+100, N+400.  We should definitely continue in these cases.

2.3.1. For N, N+300, if we see N+100 next we stop because of the assumption in 3.4.4. If N+200 is next, we continue by 3.5.4 and conclude on N+100 for either permutation.  If N+400 is next, we will stop at N+100 because of complete information.  T=9600, P=108. 

2.3.2. For N+100, N+400, if we see N next we stop with complete information.  If N+200 is next, we will stop because of my assumption in 3.4.4. If N+300 is next we continue by 3.5.4 and will stop on the very next card of N+200 (by 4.2) or N by complete information.  T=10200, P=114. 

And finally, the last 6 permutations associated with N, N+400.  These all will lead to N+100 no matter what because we have complete information. The final tally: T=10800, P=120. 

This averages to 10800/1200 = 90.

Given the amount of time these riddles are taking me to solve, along with the fact that I get them wrong, I probably will stop writing them up.

Friday, January 8, 2016

The Sadistic Car Salesman

This has some people stumped. I'm a little hesitant to put this out there because it may not be optimal yet, but I'm somewhat confident.  Here is the riddle quoted from FiveThirtyEight: 
You go to buy a specific car, whose fair price we’ll call N. You have absolutely no idea what N is and the dealer, sadistic capitalist that he is, won’t tell you. The dealer enjoys a good chase, though, so without directly revealing the value of N, he takes five index cards and writes down a number on each of them: NN+100, N+200, N+300 and N+400. Important: the guy’s sadistic but not a math major. The numbers on the cards are numbers, not algebra equations.
He presents the cards to you, one at a time, in random order. (For example, if the price on the second card is $100 more than the first, you can’t be sure if those are the two smallest prices, the two largest, or somewhere in between.) Each time he shows you a card, you must either pay the price on that card, or ask to see the next card. You cannot go back to previous cards. If you make it to the fifth and final card, then that is what you must pay. If you play the dealer’s game optimally, how much should you expect to pay on average above the fair price N?
If we use a naive strategy in taking the first card presented to us, then we will be overpaying $200 on average.  We would like to bring that down a bit.

We know that 4/5 of the time, there will be a smaller card in the remaining 4 cards not yet shown.  So, it seems worth our time exploring a strategy beyond just stopping at the first card.

Let's explore the 20 possible cases of being shown 2 cards in order in a condensed version.  Let N0 be the card with the smallest value, N1 the card with N+100, and so on, up to N4.

Let's look at the difference between the first two cards.

When the order is (N4,N0), we've lucked out and have been shown the largest and smallest card in order with a difference of 400.  We stop here and pay the fair price!

With the order (N4,N1) or (N3,N0), we have a difference of 300.  It doesn't take long to figure out that in this scenario, you should stop. This gives us an average of $50 over if the difference is 300.

With the order (N4,N2), (N3,N1), or (N2,N0), we have a difference of 200. Given a difference of 200, you will have an average of $100 over fair price if you stop.  If we use the strategy of having more cards shown to us until the first time we see something smaller we will end up only paying $94.44 over the fair price on average.  Let me try to explain.

Given the (N4,N2) scenario, we have a 50/50 chance of spending 0 or 100 over using this strategy.  Given the (N3,N1) scenario, we have a 100% chance of spending 0 over.  The (N2,N0) case is a bit tricky, since we are given all information if N4 comes up before N1.  This will happen half the time for a payment of only 100 over.  One-sixth of the time you will pay 300 over, while 1/3 of the time you will pay 400 over.  This averages out to $233.33.

Since these three cases are equally likely (1/3 a piece), we have an average of (50+0+233.33)/3=94.44.

We can have a difference of 100 with the orders (N4,N3), (N3,N2), (N2,N1), or (N1,N0).  Again, employing the strategy of taking the next lowest valued card is to our advantage.  It will have us pay $108.33 over the fair price on average.  This takes a similar analysis to the one above.

When we take the reverse order of those above, we can find an average of $108.33 and $94.44 over the fair price by using the same strategies for -100 and -200 as we do for 100 and 200 respectively.

For a difference of -300 with (N1,N4) or (N0,N3), we should take the card that is either next higher or next lower than our first card as the optimal strategy.  This leaves us with an average of $100 over.

If we happen to get (N0,N4) with a difference of -400, then we can be absolutely sure that we will pay only $100 over.

In summary, we pay fair price (0 over) with probability 1/20, we pay an average of $50 over with probability 2/20, an average of $94.44 over with probability 6/20, an average of $108.33 over with probability 8/20, and an average of $100 over with probabilities 2/20 and 1/20 (or a total of 3/20).

This gives us a total average of $91.67 over the asking price, or 275/3 to be exact.