Tuesday, November 24, 2009
dollar auction
Sunday, July 26, 2009
St. Petersberg Paradox
Here's how I stated it: We'll play a game involving coin flips, and I'll play you depending on how the coins flip. You have to decide how much you are willing to pay to play the game.
A warmup game: I flip a coin, and if it comes up heads I give you $1, tails I give you $2. How much to play?
Both 13-year olds immediately said "up to $1.50".
The real game: I flip a coin. If it comes up heads I give you $1. If it comes up tails, I flip again. If it comes up heads this time, I give you $2. If it comes up tails, I flip again. If it comes up heads this time I give you $4. In general if I flip k tails in a row I pay you 2k dollars.
My 13-year-old boy thought for a minute and growled at me, complaining that the game was worth an infinite amount of money, and that no such game could really exist. He said he should be willing to pay any amount. My 13-year-old girl (at a different time) thought about at and found it much less upsetting, concluded that it had infinite value and offered $5 to play the game. (We didn't actually play it.)
We ran a few simulations, and found that it's really hard to get that $5 back even if you play many times.
Analysis: The game has no expected value (it's worth an infinite amount of money), but since I only have a finite amount of money in my pocket it's not really worth that much to play against me as the casino. Even if I had a lot of money, it takes a long time to recover a large payments because it requires events that are unlikely to ever be seen. For example, if you paid $100 to play this game, you wouldn't expect to come out ahead until we had played about 2100 games, because it requires a sequence of 100 tails in a row to cover all the accumulated losses.
Sunday, July 19, 2009
Wednesday, June 24, 2009
1-x-x^2
The inverse of 1-x2 can be calcuated two ways.
First way: We know 1/(1-y)=(1+y+y2+y3+...) so substitute y=2x, and it comes out.
Second way: Do it directly.
- The constant coefficent must be 1.
- The x coefficient must 2.
- The x2 coefficient must 4.
- The x3 coefficient must 8.
We did a couple more examples of computing an inverse. Then we went to an interesting one.
What is the multiplicative inverse of 1-x-x2.
It turns out to be 1+x+2x2+3x3+5x4+8x5+13x6...
The coefficients are the fibonacci series!
Tuesday, June 23, 2009
1/(1-x)
5-minute math for a 3-year old
Saturday, May 23, 2009
Hilbert's Grand Hotel
My 12-year-old daughter argued that the hotel is too expensive to build. I postulated that room i+1 costs only half as much as room i, and that the guests shrink as they are moved to higher numbered rooms. She conceded that such a hotel could exist.
My 15-year-old daughter argued that the moving of guests fails. For example, what happens to the guest in room number infinity? I said "there is no room numbered infinity". She responded, "then what number is it?", and the whole family felt that she won.
Tuesday, May 19, 2009
String of Pearls
Sunday, May 17, 2009
Freecell Solitaire: What Are Open Slots Worth?
- 4 reserve slots which can hold one card, and
- 8 tableau slots which can hold a stack of cards.
How big a stack can you move, given some open reserve and tableau slots?
- If you have no open reserves, you can move a stack of size 1. (One card only.)
- If you have one open reserve, you can move a stack of 2. (Given a red 3 on a black 4: you can move the red 3 to the open reserve, then move the black 4 to its destination, then move the red 3 onto the black 4.)
- What if you have 2 open reserves? (A stack of 3 can be moved.)
- What if you have r open reserves? (A stack of r+1 can move.)
- What if you have 1 open tableau and 0 open reserves?
- What if you have t open tableaux and r open reserves?
- S(0,r) = r+1, and
- S(t,r) = 2S(t-1,r), for t>0.
Here's a solution to the recurrence for S:
- S(t,r) = 2t(r+1)
- g(x) = 0, if g(x)=0, and
- g(x) = 1, otherwise.
- f(x) = 0, if f(x)=1, and
- f(x) = 1, otherwise.
Tuesday, April 14, 2009
Flip-8
I'll give you a dollar if it comes up 0,1,2,6,7, or 8. You give me a dollar if it comes up 3,4, or 5. You have twice as many outcomes as me, so you should make out like a bandit!
Q: Why would I play flip-8?
What are the odds of heads coming up 0 times. This is n-choose-m again. 8 choose 0 is 1. There are 256 ways to flip 8 coins, and 1 way to get a zero.
To get 1, it's 8 choose 1 = 8.
To get 2, it's 8 choose 2 = 28.
To get 6 it's 28. To get 7 it's 8. To get 8 it's 1.
It all adds up to 1+8+28+28+8+1 = 74. So the expected payoff for you is 74/256, or 0.2890625.
Since 8 choose 3 is 56, and 8 choose 4 is 70, my chances of winning are (56+70+56)/256 = 182/256 = 0.7109375.
Seems like I could make a lot of money of this game if I could convince someone to play...
n choose m
If I have 4 kids, how many different teams of 2 kids? [6]
If I have 5 kids, how many different 2-kid teams? [10]
If I have 6 kids, how many different 2-kid teams? [15]
[At this point they recognized the sum of the numbers from 1 to n-1, which they know the formula for: n kids can form n(n-1)/2 teams of 2.
What about 2 kids? [1]
What about 6 kids forming teams of 3?
[The kids weren't sure how to enumerate the teams of 3.] What about 3 kids forming a team of 1? [3]
What about 3 kids forming a team of 3? [1]
What about 3 kids forming a team of 2? [3. It's like forming a team of 1 kid who is not on the team.]
What about 3 kids forming a team of 0? [1. The immediate response is 0, but the right answer is 1. There is one team with no one on it.]
If you have n kids forming teams of size m then
- the first kid could be any of n,
- the second kid could be any of (n-1),
- the third kid could be any of (n-2),
- ...
- the mth kid could be any of (n-m+1).
Those all get multiplied together. Now the problem is that the same combination of kids gets counted more than once. How many times does a team of m kids get counted?
- the first kid could have ended up in any of m positions (being chose first, second, third, etc.),
- the second kid could have ended up in any of m-1 positions,
- ...
- the mth kid can only end up in one position.
Thursday, April 9, 2009
Cardinality
For example, is the set of even integers {..., -4, -2, 0, 2, 4, ...} smaller than the set of all integers {...,-4,-3,-2,-1,0,1,2,3,4,....} ?
Our intuition says that removing an element from a set makes the set smaller, so removing an infinite number of elements should make it a lot smaller. That intuition is wrong though.
We say that two sets have the same cardinality if we can make a 1-to-1 correspondence between them. A 1-to-1 correspondance between A and B is a pairing of elements of A and B where every element of A is in exactly one pair, and every element B is in exactly one pair.
Here's a 1-to-1 correspondence between the integers and the even integers: k pairs with 2k. Every integer is on the left side (the k's) and every even integer is on the right side (the 2k's).
The 1-to-100 Game
Can she do better than an expected value of $0.50? What is Fred's best strategy? What is Ginger's?
[It turns out that the kids have actually been playing this game in math class at school, but apparently haven't analyzed it.]
They said, Ginger should look (at which card? not specified) and if the card is less than 50 then swap, otherwise stand. I said, what if Fred always writes down 2 on the red card, and 1 on the blue card. If Ginger always looks at the red card she will be fooled.
[There's another variant of the game, where Fred gets to choose which number Ginger gets to look at, which is even worse for Ginger.]
But then Ginger, if she knows Fred will do that, will always swap if she sees a two.
But then Fred will sometimes feed Ginger a 2 and a 3.
So how to fix this? We made a rule that Ginger must write down her algorithm, and then Fred can exploit any loopholes in her algorithm.
I gave them a hint. Ginger should flip a coin to determine which card to look at. (The kids said "no fair, you didn't say we could flip a coin!". I said "I'm telling you now. Coin flipping is sometimes the best way to make decisions that can handle certain adversaries.")
How to get started on analyzing the game? What if we play the 1-2 game. Fred picks two distinct numbers in the range 1 to 2. Ginger picks one number. The kids immediately saw that if Ginger sees 1 then swap, otherwise she stands, and she always wins. Fred's has no choice.
What if we play the 1-2-3 game. Fred picks two distinct numbers in the range 1 to 3. The kids argued that Fred should never pick the pair 1 and 3, because if Ginger ever sees a 1 she swaps, and if she ever sees a 3 she stands, so 1 and 3 is a loser for Fred. So Fred should always pick a 2. It took a little bit of thinking for the kids to convince themselves that Fred should sometimes pick 1 and sometimes 3 for the other number. They concluded that a coin flip is good, and that Ginger can get $0.75 expected value.
At this point the 5-minutes ran out, and one kid wanted to proceed to analyze the 1-2-3-4 game, so the other went to read about vampires or something.... The 1-2-3-4 game was a tough nut to crack for a 12-year old. The only reasonable choices for Fred are 1-2, 2-3, or 3-4. But what odds should Fred use to choose? We guessed that 2-3 should be chosen 1/2 the time, and the others 1/4 of the time each. That gave Ginger a $0.75 expected value. Then we tried choosing each pair 1/3 of the time, and that gave Ginger a $2/3 expected value. We argued that any deviation from equal odds gave Ginger more money.
Wednesday, April 1, 2009
√(2 + √(2 + √(2 + ... )))
The kids all guessed it is two by successive approxmation:
√2 = 1.414
√(2 + √2) = √ 3.414 = 1.874
√(2 + √(2 + √2)) = √3.874 = 1.9615
Algebraically we can write set x= √(2 + √(2 + √(2 + ...))). Then we observe that the inner expression is also x, so we have x=√(2+x).
Solving for x we get
x2 = 2 + x,
or
x2 - x -2 = 0.
You could use the quadratic equation or you could guess the factorization. Somehow, by hook or by crook you get
(x-2)(x+1)=0.
And so x=2, as the kids guessed.
The kids observed that it's the same trick for solving a geometric series:
1+1/2+1/4+1/8+ ... = x,
so
1 + x/2 = x,
which has solution x=2.
√2 is irrational
(p/q)2 = 2
so
p2 = 2 q2
so p2 has 2 as a factor, which means that p must have 2 has a factor. So p=2r for some r.
We now have
(2r)2 = 2 q2
so
4r2 = 2 q2
so
2r2 = q2
and therefore q has 2 as a factor.
So both p and q have 2 as a factor, but we assumed that they were relatively prime, which is a contradiction.
The kids didn't really think much of this one. They seem take it for granted that √2 is irrational, so why do they need a proof. Or maybe they don't like proof by contradiction. (Maybe they are constructionist mathematicians...)
Thursday, March 26, 2009
Circle Circumscribing a Triangle
I'll assume you know how to construct the perpendicular bisector of a line segment.
Any circle that touches both A and B must have its center on the perpendicular bisector of AB.
Similarly, any circle that touches both A and C must have its center on the perpendicular bisector of AC.
The circle we are looking for has its center at the intersection of those two bisectors, and the radius is determined from that center point to any of the three original points.
Tuesday, March 24, 2009
Triangle Inequality on R
If the points are identified as real numbers along the real line, then we have the distance between A and B defined to be
- d(A, B) = B-A if B ≥ A, and
- d(A, B) = A-B otherwise.
So now restating what we want to prove, given A, B, C in R, prove that d(A, B) + d(B, C) ≥ d(A,C).
One way to prove this is by a case analysis. There are six possible orderings of A, B, C on the line:
- A ≤ B ≤ C
- A ≤ C < B
- B < A ≤ C
- B ≤ C < A
- C < A ≤ B
- C < B < A
I'll do two cases:
- Case 1 is easy. If A ≤ B ≤ C then d(A, B) + d(B, C) = B-A + C-B = C-A = d(A, C).
- Case 5 is a little trickier.
If C < A ≤ B, then d(A, B) + d(B, C) = B-A + B-C = 2B-A-C.
How does that relate to d(A, C) = A-C?
We can approach this problem by observing what we want. We want d(A, B) + d(B, C) ≥ d(A, C),
so we want 2B-A-C ≥ A-C
so we want 2B-2A ≥ 0 (by adding A-C to both sides)
so we want B-A >=0 (by dividing both sides by two)
which is true because A ≤ B. So it will work out. We just have to run it backwards:
We know A ≤ B, therefore B-A ≥ 0 therefore 2B-2A ≥ 0 therefore 2B-A-C ≥ A-C therefore d(A,B) + d(B,C) ≥ d(A,C).
Teaching discussion:
- Sometimes you just have to do all the cases. Students, especially kids, are reluctant to do a case analysis. Six cases seems like too much. But sometimes it's just the right way to solve a problem: enumerate the cases and solve each one.
- I've seen people teach by doing something like:
"We know A ≤ B, therefore B-A ≥ 0 therefore 2B-2A ≥ 0 therefore 2B-A-C ≥ A-C therefore d(A,B) + d(B,C) ≥ d(A,C)."
It's just magic. How did you come up with that? Better when teaching is to show how to figure out what the magic sequence is. The "magic" is especially prevalent on proofs in analysis: You have to show "for every ε there is a δ" and you write down some magic formula for δ as a function of ε, and the students wonder where in the world that came from.
Monday, March 23, 2009
vector addition
- its length, and
- its direction.
limit goes to e
Exposition: Suppose you lent $1 at a 100% loan for 10 years.
- Compound once you get (1+1)^1 = $2
- Compound twice you get (1+1/2)^2 = 2.25
- Compound thrice you get (1+1/3)^3 = 2.3737
- Compound 10 times you get 2.5937
What happens as you compound more? The kids' initial guesses were that you would get an unbounded return or that you would get $3 eventually. We saw that it seemed to zero in on 2.718 by doing a million times then a billion times (at which point the calculators started producing random values in low order digits). Then I asked them to find e^1 on their calculator.
Formulas for Lines
Slope
- Draw Cartesian coordinate system, and draw a line that goes through points (0,0) and (1,1). What is the slope? (Change in y is 1, change in x is 1, so the slope is 1.
- Draw a line that goes through (2,2) and (3,2). What is the slope? (Change in y is 0, change in x is 1, so the slope is 0.
- Draw a line that goes through (2,2) and (3,1). What is the slope? (Change in y is -1, change in x is 1. Slope is -1.
- Draw a line that goes through (-1,-1) and (-1,-2). What is the slope? (Change in y is -1, change in x is zero. The slope is -1/0 which is undefined.
Five Minute Math
About Me
- Bradley C. Kuszmaul
- I work in the Google cloud now. Previously I worked in the Oracle cloud and before that I was research faculty at MIT, and Chief Architect at Tokutek. Before that I worked at Akamai, was a Yale CS professor, and worked at Thinking Machines.