# Five Minute Math

## Tuesday, November 24, 2009

### dollar auction

I tried to run a dollar auction at dinner yesterday. At first the kids (13-year-olds) wouldn't bite. Finally they started bidding. Then when it was going badly, one of them bid everything in her bank account. I had to quit since I couldn't take all that money away. She claimed victory. Then they wanted to do it again. They offered a penny, and then split the dollar.

## Sunday, July 26, 2009

### St. Petersberg Paradox

A few days ago we explored the 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

### zero-knowledge sudoku

Today we did zero-knowledge sudoku.

## 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.

1. The constant coefficent must be 1.
2. The x coefficient must 2.
3. The x2 coefficient must 4.
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)

Treating polynomials as abstract symbolics entities (rather than as a formula into which you substitute a real number for x. Q: What do you get when you multiply (1-x) by (1+x+x2+x3+...) ? A: You get 1. Thus 1/(1-x)=(1+x+x2+x3+...).

### 5-minute math for a 3-year old

My 3-year old child wanted to do five-minute math. I said, OK, I grabbed the marker, and she said "write a 3". So I wrote a 3. Then she said "write a 2". So I wrote a 2. We spent five minutes with her dictating numbers and I filled up the white board.

## Saturday, May 23, 2009

### Hilbert's Grand Hotel

We talked over dinner about Hilbert's Grand Hotel (follow the link for a good description). The hotel has an infinite number of rooms, all full, and a new guest arrives. To make room for a new guest, for all i the guest in room i is moved to room i+1.

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

Two friends found a necklace (a loop) of pearls. There are some black pearls and some white pearls, all otherwise indistinguishable. They want to cut the necklace into two parts (with two cuts) so that the number of black pearls on each side match, and the number of white pearls match. They cannot cut the pearls themselves, but instead cut the necklace between the pearls. There are an even number of black pearls, and an even number of white pearls. Prove that you can always do it, or else find a case where it cannot be done. After arguing and working on it for a 15 minutes, they came up with an argument. But afterwards Lizzy said she didn't like it much (compared for example to Sunday's freecell problem). This problem comes from one of Charles Leiserson's papers (I don't remember which) on VLSI layout.

## Sunday, May 17, 2009

### Freecell Solitaire: What Are Open Slots Worth?

Today we analysed part of Freecell solitaire. In Freecell there are
• 4 reserve slots which can hold one card, and
• 8 tableau slots which can hold a stack of cards.
A stack is a set of cards of alternating colors, of increasing ordinality. E.g., a red 3 on a black 4 on a red 5 is a stack of 3 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?
To analyse this, we define a function S(t,r) that says how big a stack can be moved when there are t open tableau and r open reserves. S satisfies this recurrence relation:
• S(0,r) = r+1, and
• S(t,r) = 2S(t-1,r), for t>0.
The first case where t=0 is known. In the second case I can use t-1 open tableaux and r open reserves to move S(t-1, r) cards to one of the free tableaux. Now I have t-1 open tableaux and r open reserves to move the next S(t-1, r) cards in the same stack to its final destination. Then I can move the first S(t-1, r) to form another stack.

Here's a solution to the recurrence for S:

• S(t,r) = 2t(r+1)
Discussion: Computer scientists see a recurrence like the one shown above, and tend to think it's a reasonable way to define a function. Mathematicians don't like defining a function in terms of itself, because you might get "definitions" that read like
• g(x) = 0, if g(x)=0, and
• g(x) = 1, otherwise.
• f(x) = 0, if f(x)=1, and
• f(x) = 1, otherwise.
The fix to this is to say that a recurrence is equation that is true of the function we are talking about, and ask what functions solve that equation. In the case of S on the nonnegative integers, there is a unique solution. For f there are no solutions, and for g there are many solutions. For S defined on the real numbers, there are many solutions.

## Tuesday, April 14, 2009

### Flip-8

Here's a game, which I'll call Flip-8. We'll flip a coin 8 times, and we'll count the number of heads. The number of heads could be 0, 1, 2, through 8. That is, there are 9 possible outcomes.

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 3 kids and I want to form a team of 2 kids, how many different teams could I create? [3]

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).
This is n!/(n-m)!.

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.
So the formula is n!/((n-m)! m!).

## Thursday, April 9, 2009

### Cardinality

The size of a set is called its cardinality. It's clear when two finite sets have the same cardinality, they have the same number of elements. What do we mean when we say to infinite sets have the same 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

Let's analyze a two-person game. Fred picks two distinct integers between 1 and 100 inclusive. Fred writes the numbers down on two cards (one red card and one blue card), and places them face down on the table. Ginger picks a card, and looks at the number. Now she must decide whether to keep her card ("stand"), or swap with the other card (which is still face down). She wins \$1 if she picks the greater number, and wins \$0 otherwise.

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 + ... )))

What is the value of this infinitely recursive expression?

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

Here's an old proof that √2 is irrational. It is a proof by contradiction, and the fundamental theorem of arithmetic (which says that factorization into primes is unique). Suppose that √2 = p/q, where p and q are relatively prime. Then
(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

Given a triangle ABC in R2, there is exactly one circle that goes through the points. How do you find the circle?

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

A bug lives on a line. The bug starts at point A and crawls to point B. Then she crawls to point C. We know that she always crawls at least as far going from A to B to C as if she had just crawled straight from A to C. How can we prove this fact mathematically?

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:

1. A ≤ B ≤ C
2. A ≤ C < B
3. B < A ≤ C
4. B ≤ C < A
5. C < A ≤ B
6. C < B < A
Question: Did we cover all the possible orders? How do you know?

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-CA-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-CA-C therefore d(A,B) + d(B,C) ≥ d(A,C).
The fact that's being proved seems obvious, but it requires a little creativity to actually do the proof for all six cases.

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-CA-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

A vector is an arrow. What is important about a vector is
• its length, and
• its direction.
The starting point of a vector is not important. You can slide an arrow around, and if you don't stretch it or turn it, it's the same vector. (Note, I'm not representing vectors as coordinate pairs, but as graphical things that I draw on the white board. They are arrows.) The rule for adding two vectors, X and Y is to slide Y until Y's starting point is on top of X's ending point. Now draw an arrow from the beginning of X to the end of Y. That's the result of adding X to Y.

### limit goes to e

We've done symbolic derivatives for polynomials with nonnegative exponents. We've also done a few simple limits. So this 5-minute math item is more advanced than some of the others Topic: What is the limit as n goes to infinity of (1+1/n)^n, proceeding by example, and using a calculator.

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.

### Plotting Some Polynomials

Plot the following functions
• y=x
• y=x+1
• y=2x
• y=2x+1
• y=x*x
• y=x*x*x

### Formulas for Lines

Lines that don't go straight up and down (i.e. those that have well-defined slopes) can be written as y=mx+b. This is called slope-intercept form because m is the slope of the line and b is the y value when the line crosses the y axis. Figure out the slope-intercept form for the problems from the previous posting.

### Slope

The slope of a line is the rate of change in the y axis divided by the rate of change in the x axis.
1. 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.
2. 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.
3. 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.
4. 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.
Discussion topics. Is the slope for #4 infinite? Maybe it's minus infinity.

### Five Minute Math

We've got a whiteboard in our dining room, and I've found that the kids can handle about five minutes of math after dinner. This blog is the list of topics that I've covered. I started the 5-minute math a few years ago, and today's topics assume some background. The key is to limit the discussion to 5 minutes (unless the kids really want to go longer). This blog's ground rules. I'm assuming that you, the reader, already know the math. So I'm going to write down what I tell my kids, and you can connect the dots.