Playing with Cos(z)

​We did a neat project with Newton’s method yesterday:

Exploring Newton’s Method with kids

That project plus the fact that my son is starting to learn a bit of trigonometry got me thinking about what the transformation z -> Cos(z) “looks like.”

During the day today I printed the real and imaginary parts of this transformation:

After printing those shapes I had a different idea – I’d look at how the function z -> Cos(z) mapped circles centered at the origin. To see the images of different circles, I put the circle with radius R at a height R in the map. That ended up being a bit too squished, though, so I changed the height in the image to 3R. Here’s what it looked like in Mathematica:

[ I’m having a little trouble with the videos below. Maybebecause I took them on my phone – not sure – but hopefully they at least show the shape and a few of the ideas my kids had.]

Here’s what the 3d print looked like:

and here’s how the boys described the shape. My younger son went first:


My older son went second


Fawn Nguyen’s Olive problem

Last night Fawn Nguyen posted a neat problem for kids:

I thought it would be fun to try out the problem with the boys this morning. My younger son went first (while my older son was practicing viola in the background). He described his approach as “guess and check”:

My older son went next. I think we wasn’t super focused at first because Fawn’s problem about 75 olives became a problem about 40 apples, but once he got back on track he found a nice solution. His approach looked at the number of non-green olives since that number stayed constant:

It was fun to see the two different approaches, and also interesting to see that my two kids approach percentages very differently. This was a nice problem to start the day.

Exploring Newton’s method with kids

Yesterday we had about a 30 min drive and I had the boys open up to a random page in this book for a few short discussions in the car:

There were some fun topics that were accessible for kids, but then Newton’s method came up. Ha ha – not really drive time talk 🙂

It did seem like it could be a fun project, though, so I took a crack at it today. The goal was not computation, but mainly just the geometric ideas. Here’s how we got started:

Next I asked the boys if they could find situations in which Newton’s method wouldn’t work as nicely as it did in the first video. They were able to identify a few potential problems:

Now I had both kids draw their own picture to play out what would happen when you used Newton’s method to find roots. I think there’s a lot of ways to used the exercise here to help older kids understand ideas about tangent lines and function generally. I mostly let the kids play around here, though, and the results were actually pretty fun:

Finally, we went to Mathematica to see some situations in which Newton’s method produces some amazing pictures. Here we switch from real-valued functions to complex valued functions. Since I wasn’t going into the details of now Newton’s method works, rather than using some easier to understand code, I just borrowed some existing code from here:

The page from A. Peter Young at U.C. Santa Cruz that gave me the Newton’s method code for Mathematica

The boys were amazed by the pictures. For example, (and this is one we looked at with the camera off) here’s a picture showing which root Newton’s method converges to depending on where you start for the function f(z) = z^3 - 2z + z - 1:


Definitely a fun project. Even if the computational details are a bit out of reach, it is fun to share ideas like this with kids every now and then.

Counting paths

This week both kids had a homework problem in their enrichment math program that involved counting different paths on the edges of a cube.

I thought it would be fun to use those problems as a way to visit the ideas of counting paths in a lattice.

I started the project with a pretty standard path counting problem -> counting the number of paths that go from corner to corner in a rectangular lattice:

Nice I changed the shape of the lattice and ask the boys how they thought the number of paths would change:

Now we moved on to a problem that was similar to the problem they had for homework -> count the paths going from one corner to the opposite corner on a cube:

Now for a challenge -> count the paths on a 2x2x2 cube going from one corner to the other (in this case each step will have length 1):

This is a fun introductory counting exercise. I was a little surprised how difficult it was to keep track of the numbers on the final 2x2x2 cube, but it was nice to see that they boys could see how to count those paths directly with choosing numbers.

Struggling through an AMC 8 problem

My younger son has been practicing for the AMC 8. This week we’ll be going over a few problems here and there that give him trouble. The problem from the practice test today was #16 from the 2016 AMC 8:

Problem 16

This problem really gave him some trouble – as you’ll see from his 5 min struggle below:

I was caught a bit by surprise over the difficulty he was having. It wouldn’t surprise me if the mistakes he was making were quite common mistakes for a problem like this, but I was stuck on what to do. So, I decided to show him one path that leads to the solution to the problem:

So, having shown him one way to solve the problem, I challenged him to find a different solution. Initially he struggled, but then he did something pretty clever:

I definitely struggle to see a good way forward when a problem is giving one of my kids as much trouble as this one was. Hopefully my son was able to see some of the important ideas in the problem after we talked through it in the second video. I really do like the solution he came up with in the third video, though, especially since it is more geometric and less reliant on calculation.

Sharing Sam Hansen’s “Knotty Helix” podcast with kids

The latest Relatively Prime podcast is fantastic:

The short description from the podcast’s website is:

“Sure DNA is important, some might even claim it is absolutely integral to life itself, but does it contain any interesting math? Samuel is joined by UC-Davis Professor of Mathematics, Microbiology, and Molecular Genetics Mariel Vazquez for a discussion proves conclusively that mathematically DNA is fascinating. They talk about the topology of DNA, how knot theory can help us understand the problems which occur during DNA replication, and how some antibiotics are really pills of weaponized mathematics.”

Since it is only 20 min long, I thought it would be fun to share with the boys. We listened to it in the car when we went out to breakfast this morning. Upon returning home I asked the kids what they thought and what were somethings they learned. Here’s what they had to say:

Next we looked at an interesting process described in the podcast. That process was an example by Mariel Vazquez of how you can go from a link with 6 crossings to two unlinked circles.

The process in the podcast seems simple – maybe even obvious – but I think that the process is actually much more subtle than it seems listening to it.

Here we followed the steps to go from the trefoil knot to the two unlinked circles. I think the ideas we followed here are a great way for kids to explore the process described in the podcast:

The next thing we looked at was the idea that when you cut a loop with an even number of twists in half, the halves would be linked. We took a long strip of paper and gave it 6 twists, taped the ends together, and then cut it down the middle.

I fast forwarded through the taping and cutting part, but forgot to remove the sound. Sorry for the “Alvin and the Chipmunks” middle part of this video.

I think both the podcast and the follow up projects are a great way for kids to explore some math ideas that wouldn’t normally be part of a school curriculum.

We’ve done a few other projects with knots and with paper cutting. Here’s a link to those collections:

Our knot projects

A collection of some of our paper cutting (and folding) projects

It was really neat to hear about how knot theory applies to biology.

Sharing Nassim Taleb’s dart probability problem with kids

Last week Nassim Taleb posted a fun probability problem on Twitter:

I “live blogged” my work on this problem at the link below and eventually found the solution (though after a long detour):

Sort of live blogging a solution to a problem posed by Nassim Taleb

One of the boys had to leave early this morning for a school event, so I was looking for a quick project. With some of the work I did in Mathematica on Taleb’s problem still up on my computer screen, I decided to run through the problem with the boys. The point here wasn’t for them to figure out the solution, but rather to see a neat example of counting techniques used to solve a challenging problem.

I started by explaining the problem and asking them to take a guess at the answer. The boys also had some interesting thoughts about the probability of the balls all ending up in different boxes.

Next we went to Mathematica to walk through my approach to solving the problem. In talking through my approach these ideas from number theory and combinatorics come up:

(1) Partitions of an integer,
(2) Binomial coefficients,
(3) Complimentary counting,
(4) Permutations and combinations, and
(5) Correcting for over counting.

Here’s our quick talk through one solution to Taleb’s problem (and, again, this isn’t intended as a “discovery” exercise, rather we are just walking through my solution) :

To wrap up we returned to the idea of the balls spreading out completely -> a maximum of 1 ball per box. Both boys thought this case was pretty likely and were pretty surprised to find it was less likely than ending up with 3 or more balls in a box!

This problem is little bit on the advanced side for 8th and 6th graders to solve on their own, but they can still understand the ideas in the solution. Also, there are some fun surprises in this problem – the chance of the balls spreading out completely was much lower than they thought, for example – so I think despite being a bit advanced, it is a fun problem to share with kids.

Sort of live blogging a solution to a problem posed by Nassim Taleb

This morning Nassim Taleb posed this problem on Twitter:

A later tweet clarified that the problem was asking for “at least 3.”

I wanted to write up my solution because I think that it is important to share the thought process rather than just the answer to a question. I’ve written up solutions to similar problems before and was originally inspired to write posts like this one after seeing Tim Gowers “live blog” a solution to an IMO problem.

A couple of notes to be clear:

(Edit) (0) Make sure to read all the way to the bottom as I now have corrected a counting mistake

(1) I’m not sure this solution is correct (EDIT – with the final correction at the bottom I am now much more confident),

(2) Incredibly, two keyboards broke while typing up this post, so sorry if there are typos. It is a miracle that the latex formulas work.

Anyway . . .

I understood the problem to be the same question as this one:

You have 8 balls and 16 boxes numbered 1 through 16. For each ball you select a box uniformly at random and place the ball in the selected box. After placing the 8th ball in one of the boxes, what is the probability that at least one box contains at least 3 balls.

My first inclination was to do a quick back of the envelope calculation using the Poisson and Binomial distributions:


So, assuming a Poisson distribution for the number of balls in each box (with expected value 1/2), the probability of 3 or more balls in a box is about 1.44%. The probability that no boxes have 3 is (1 – 0.0143877)^16 which is about 80%. So the probability of at least one box having 3 or more balls would be around 20%.

The same calculation assuming a binomial distribution with 8 balls having a 1/16 chance of going in a box leads to a guess of around 16% for the probability of a box having at least 3 balls.

I knew that neither of these approaches was correct, but I thought that starting this way would give me a sense of what the right answer would be.

Next I asked how many different ways there were to put 8 balls into 16 boxes. This question is a classic “stars and bars” question from combinatorics. The answer is 23 \choose 8 which is 490,314.

So, how can I makes sense of these 490,314 different ways to put the balls in the boxes?

My first thought here was to look at the partitions of 8, since no matter how the balls are distributed, the sum of the number of balls in each box has to be 8. Turns out there are 22 ways to partition 8:


Since there are only 5 partitions with only 2’s and 1’s, I figured I’d just count the different ways that those partitions could occur in the 16 boxes.

So, for example:

(1) [1,1,1,1,1,1,1,1] can occur in 16 \choose 8 = 12,870 ways

(2) [2,1,1,1,1,1,1] can occur in 16 \choose 1 * 15 \choose 6 = 80,080 ways

The full calculations for the partitions with only 2’s and 1’s and the ones that include numbers 3 or greater are here:


So, I had to check these calculations a bunch of times since the ones we want to exclude add up to only 258,570 out of 490,314 -> not even close to 80%. But, checking and checking and checking kept getting me to the same answer.

The total ways to distribute the balls in ways that at least one box gets 3 or more balls is 231,744, and thus the probability of a box getting at least 3 balls is 231,744 / 490,314 which is roughly 47.3%. This probability is much higher than I would have guessed.

Later I saw this follow up tweet from Taleb:


I spent the rest of the day trying to come up with a better formulation, but really was not that successful. The best I could come up with was a formulation using generating functions.

The total number of ways to distribute the 8 balls into 16 boxes is given by the coefficient of x^8 in the polynomial:

(1 + x + x^2 + x^3 + x^4 + x^5 + x^6 + x^7 + x^8)^{16}

Luckily that number is 490,314.

Similarly, the total number of ways to distribute the 8 balls into 16 boxes with at most 2 balls per box is given by the coefficient of x^8 in the polynomial:

(1 + x + x^2)^{16}

and that number is also what we found above -> 258,570.


So, we get the same answer as above.

The generating function approach also gives a way to solve the general problem in the second part of Taleb’s tweet. We’d just look at the coefficients of x^n in these two polynomials:

(1 + x + x^2 + x^3 +\ldots + x^{n-1} + x^n)^{d}, and

(1 + x + x^2 + x^3 +\ldots + x^{m-2} + x^{m-1})^{d}.

Then do the same calculation as above.

However, although this approach with generating functions is easy to describe, it really isn’t much easier to calculate, so I doubt it was the reformulation that Taleb had in mind.

(EDIT that goes from here to the end)

[I’ve had to steal a keyboard from my son since one broken keyboard doesn’t type symbols like $, [], and {} making latex formulas impossible and the other doesn’t type the letter t. 4:00 am problems!]

At 4:00 am I woke up and realized an error in the approach. By that time there were a few comments on twitter also pointing out the under counting.

the error in counting comes in assuming the each distribution of balls coming from a partition of 8 is equally likely. That’s not the case. The distribution [1,1,1,1,1,1,1,1] can indeed occur in 16 \choose 8 ways, but there are also 8! (8 factorial, I mean, in case it displays incorrectly) arrangements for each of those ways.

However, the distribution [2,1,1,1,1,1,1] which occurs in 16 \choose 1 * 15 \choose 6 has 8! / 2! different arrangements.

So, factoring in that under counting leads to the following correct count for the cases with only 1’s and 2’s:


The 3,567,874,400 cases are out of a total of 16^8 cases and thus the probability of having a 3 in more than one box is given by:


So, the result is (happily) closer to the back of the envelope result that’d get and I don’t have to worry that the Poisson / Binomial approximations are way off!

Now, back to bed 🙂