## Counting collisions

Here is an interesting problem that I saw recently, that involves a nice combination of physics, programming, and mathematics, with a surprising solution.

Imagine two balls on a frictionless floor near a wall, as shown in the figure below. The green ball is initially at rest between the wall and the blue ball, which is $m$ times more massive and moving toward the green ball. Assume everything is nicely Newtonian, and collisions are perfectly elastic.

As a function of $m$, how many collisions are there?

For example, if $m=1$, so that the two balls have equal mass, then there are three collisions: the blue ball strikes the green ball, which bounces off the wall, then returns to strike the blue ball again, sending it off to the right.

However, if the blue ball is heavier, say $m=100$ times heavier, then the green ball will bounce back and forth many times between the wall and the blue ball, for a total of 31 collisions, before finally failing to catch up to the blue ball as it moves off to the right.

What if the blue ball is $m=10,000$ times heavier? Or one million times?

Following is my Python implementation of a solution.

```def collisions(m):
v1, v2 = 0, -1
bounce = 0
while v1 > v2:
v1, v2 = (((1 - m)*v1 + 2*m*v2) / (1 + m),
(2*v1 - (1 - m)*v2) / (1 + m))
bounce = bounce + 1
if v1 < 0:
v1 = -v1
bounce = bounce + 1
return bounce

print(collisions(10000))
```
This entry was posted in Uncategorized. Bookmark the permalink.

### 2 Responses to Counting collisions

1. B. Harris says:

Did you see it here, perhaps?: https://www.youtube.com/watch?v=jsYwFizhncE

• No, I was referred to this problem in Peter Winkler’s latest Mathematical Puzzles book. The linked video is a great explanation of what’s happening… but it doesn’t mention what I think is one of the most interesting wrinkles, namely that we don’t actually know whether the easy-to-state “theorem” describing this behavior is actually true or not! That is, does m=10^(2d) *always* yield a number of bounces given by the first d+1 decimal digits of pi? It’s possible that it could “miss” for some values of d, but this depends on sufficiently long sequences of 9s appearing in the digits of pi, the frequency of which we don’t currently have any proven guarantees.

This site uses Akismet to reduce spam. Learn how your comment data is processed.