Three symmetric math riddles

March 19, 2025 · 9 mins · 1663 words

I like problems that are easy to pose, and that seem difficult to solve at first glance, but that a slight change of perspective makes them simple and easy to solve. In this post, I will expose my 3 favorite problems of this type.

For each riddle, I’ll first explain the problem, then solve it the hard way, and finally show the elegant and simple solution. These three problems are widely known, so I’m sorry if you already know them.

Two bikes and a fly

This is one of my favorite problems to ask at parties or social events. You can ask this question to anyone with basic math knowledge and they’ll understand the question and the easy solution. And -in my experience- the more math you know the more you enjoy the trick used in the simple solution.

Problem: Two cyclists start 30km apart and ride towards each other. Both cyclists travel at 5km/h. A fly starts on one cyclist's handlebar and flies towards the other cyclist. As soon as the fly reaches the other cyclist it goes back to the first one. The fly goes back and forth between them at 10km/h until they meet. What total distance does the fly travel?
Hard solution The hard solution here involves summing the infinite sum. We'll calculate the distance the fly travels in each "leg" of its journey.
Easy solution To solve the problem you just neeed to know how long would it take for the cyclists to meet and the multiply this time by the speed of the fly.

There’s a funny story about this problem involving John von Neumann. Someone once asked von Neumann this question, expecting it to be challenging. To their surprise, von Neumann solved it almost instantly. The person who asked the question was disappointed and said, “Oh, I guess you figured out the quick trick to solve it!”. Von Neumann, looking confused, replied, “What trick? I just added up the infinite series.”

Ants on a ruler

I don’t remember when I first heard about this problem, but it was a long time ago - maybe during my Physics degree. I remember it was the first time when I smiled in awe after a math proof 1.

Problem: A 1-meter stick has 50 ants randomly placed on it, facing random directions. Ants move at 1 meter per minute. When they arrive at the end of the ruler they fall off at the ends. If two ants meet they reverse direction and keep moving. How long do you have to wait to be sure all the ants have fallen off?
Hard solution In this case I wasn't able to get an analytics solution, so I decided to solve it with code. Here we'll simulate the ants for a couple of experiments and analyze the results.
import random

def initialize_ants(n_ants=10, stick_length=1.0,):
    ants = [(random.uniform(0, stick_length), random.choice([-1, 1])) 
            for _ in range(n_ants)]
    return ants

def simulate_ants(ants, stick_length, ant_speed=1.0, dt=0.0001):
    # Initialize ants as (position, direction) tuples

    time = 0
    while ants:  # While there are ants still on the stick
        # Move all ants
        ants = [(pos + dir * ant_speed * dt, dir) for pos, dir in ants]
        
        # Handle collisions
        for i in range(len(ants)-1):
            for j in range(i+1, len(ants)):
                if abs(ants[i][0] - ants[j][0]) < 1e-7:
                    # Swap directions
                    ants[i] = (ants[i][0], -ants[i][1])
                    ants[j] = (ants[j][0], -ants[j][1])
        
        # Remove ants that fell off
        ants = [(pos, dir) for pos, dir in ants if 0 < pos < stick_length]
        
        time += dt

        if time > 1.:
            print(ants)
            break
    
    return time
If you run the below code for some iterations you can plot an histogram like the following one.
Time to fall distribution
Time to fall distribution
There you can see that the maximum amount of time the ants spend on the rule is 1 minute.
Easy solution Here's the key insight: it doesn't matter if the ants bounce off each other when they collide. Since all ants look the same, we can pretend they just pass right through each other without changing direction. The only thing we care about is when the final ant drops off the ruler. And since each ant moves at 1 meter per second along a 1-meter ruler, we know that after exactly 1 minute, every ant must have reached one end or the other and fallen off.

Boarding a plane

Problem: A plane with 100 seats is boarding. The first passenger boards and sits randomly in one of the 100 seats. Each subsequent passenger boards and takes their assigned seat, but if their seat is already occupied by someone who sat randomly, they occupy a random empty seat instead.
Hard solution Let's solve this rigorously by calculating the probabilities. Let's denote by f(n) the probability that the last passenger gets their assigned seat in a plane with n seats.

1. Initial Probabilities

When passenger 1 boards, they can:

2. Case Analysis

Case A: Passenger 1 sits in seat 1

  • Everyone else will get their assigned seat
  • Contribution to $f(n)$ is $(1/n) \times 1 = 1/n$

Case B: Passenger 1 sits in seat n

  • The last passenger can't sit in their seat
  • Contribution to $f(n)$ is $(1/n) \times 0 = 0$

Case C: Passenger 1 sits in seat $i$ ($2 \leq i \leq n-1$)

  • When passenger $i$ arrives, they'll choose randomly among remaining seats
  • This creates the same scenario as with $n-1$ seats
  • Contribution to $f(n)$ is $((n-2)/n) \times f(n-1)$

3. Mathematical Formulation

Putting it all together:

$$ f(n) = \frac{1}{n} + \frac{n-2}{n} f(n-1) $$

4. Solving the Recurrence

5. Conclusion

By induction, $f(n) = 1/2$ for all $n \geq 2$

Easy solution The easy solution consists in making a slight change of perspective: when a new passenger arrives and finds their seat occupied, the passenger asks the occupier to move and choose another seat at random. Before we were following what happens to each passenger, but now we can focus only on the first passenger, who is the only one choosing seats randomly. This way we can see that the first passenger will keep being moved around until only two seats remain: seat 1 and seat 100. At this point, the first passenger will choose randomly between these two seats, giving a 50% probability that the last passenger gets their assigned seat.

  1. The second time was during Cantor’s diagonal proof.