You know that feeling when you have two mirrors facing each other, and it gives the illusion
of there being an infinite tunnel of rooms?
Or if they’re at an angle with each other, it makes you feel like you’re part of a
strange kaleidoscopic world with many copies of yourself all separated by angled pieces
of glass.
What many people may not realize is that the idea underlying this illusion can be quite
helpful for solving serious problems in math.
We’ve already seen two videos describing the block collision problem with it’s wonderfully
surprising answer.
Big block comes in from the right, lots of clacks, the total number of clacks looks like
pi, and we want to know why.
Here we see one more perspective explaining what’s going on, where if the connection
to pi wasn’t surprising enough we add one more unexpected connection to optics.
But we’re doing more than just answering the same question twice.
This alternate solution gives a richer understanding that can let you answer other questions about
the setup, and it’s also core to how I coded accurate simulations of these blocks without
requiring absurdly small time steps and huge computation time.
Last time we used a coordinate plane where each point encodes a pair of velocities.
Here, we use one where each point encodes the positions of both blocks.
Again, the idea is that by representing the states of a changing system with individual
points in some space, problems in dynamics turn into problems in geometry, which are
hopefully more solvable.
Specifically, let the x-coordinate of a 2d plane represent the distance from the wall
to the left edge of the first block, what I’ll call d1.
And let the y-coordinate represent the distance from the wall to the right edge of the second
block, what we’ll call d2.
That way, the line x=y shows us where the two blocks clack into each other, since that
happens whenever d1 equals d2.
Here’s what it looks like for our scenario to play out.
As the two distances of our blocks change, the two-dimensional point of our configuration
space moves around, with a position that always fully encodes the information of those two
distances.
You may notice that at the bottom there, its bounded by the line where d2 is the same as
the small block’s width, which is what it means for the small block to hit the wall.
You might be able to guess where we’re going with this: The way this point bounces between
these two bounding lines is a bit like light bouncing between mirrors.
The analogy doesn’t quite work, though.
In the lingo of optics, the angle of incidence doesn’t equal the angle of reflection.
Just think of that first collision: A beam of light coming in from the right would bounce
off this 45-degree x=y line and end up going straight down, which would mean only the second
block is moving.
This does happen in the simplest case, where the second block has the same mass as the
first and picks up all of the momentum like a croquet ball, but for other mass ratios
that first block will keep moving a bit, so the trajectory of our point in this configuration
space won’t be pointed straight down.
Even if it’s not immediately clear why this analogy with light would be helpful, and trust
me it will be helpful in many ways, run with me and see if we can fix it for the general
case.
Seeking analogies in math is very often a good idea.
As with last video, it’s helpful to rescale the coordinates.
In fact, motivated by what we did then, you might think to rescale the coordinates so
that x=sqrt(the first mass, m1) * d1.
This has the effect of stretching our space horizontally, so changes to our big block’s
position now result in larger changes to the x-coordinate of our point.
Likewise, let’s write the y-coordinate as sqrt(m2) * d2, even though in this particular
case that second mass is 1, so it doesn’t matter.
Maybe that strikes you as making things uglier, and somewhat of a random thing to do, but
as with last time, including square roots of masses like this plays more nicely with
the laws of conserving energy and momentum.
Specifically, the conservation of energy will translate to the fact that our little point
in configuration space is always moving at the same speed, which in our analogy you might
think of as meaning there’s a constant speed of light.
And the conservation of momentum will translate to the fact that as our point bounces off
the “mirrors” of our setup, so to speak, the angle of incidence equals the angle of
reflection.
Doesn’t that seem bizarre?
That the laws of mechanics should translate to laws of optics like this?
To see why this is true, let’s roll up our sleeves and work out the math.
Focus on is the velocity vector for our point in the diagram, showing which direction its
moving and how quickly.
Note, this is not a physical velocity, like the velocities of the moving blocks; instead
it’s a more abstract rate of change in the context of our configuration space, whose
two dimensions worth of possible directions encodes both velocities of the blocks.
The x-component of this little vector is the rate of change of x.
Likewise, its y-component is the rate of change for y.
So what is the rate of change for the x-coordinate?
Well, x is sqrt(m1)*d1, and the mass doesn’t change, so it depends only on how d1 changes.
The rate at which d1 changes is the velocity of the big block, what I’ll call v1.
Likewise, the rate of change for y is sqrt(m2)*v2.
Now notice what the magnitude of our little configuration-space-change-vector is: Using
the pythagorean theorem, it’s the square root of the sum each of these component rates
of change squared, which is the sqrt(m1*v1^2 + m2*v2^2).
That inner expression is twice the kinetic energy, so the speed of our point in configuration
space is some function of the total energy, which stays constant throughout the process.
Remember, a core assumption here is that no energy lost to friction or to the collisions.
Alright, that’s cool, with these rescaled coordinates our little point always moves
with a constant speed.
I know it’s not obvious why you’d care, but among other things it’s important for
the next step, where the conservation of momentum implies that these two bounding lines act
like mirrors.
First, notice that the line for d1=d2, representing where blocks collide, is no longer the 45-degree
x=y line.
Instead, after a little rearrangement, see see it looks like the line x/sqrt(m1) = y/sqrt(m2)
which is a line with slope sqrt(m2 / m1).
That’s a nice expression to tuck away in the back of your mind.
After the blocks collide, meaning our point hits this line, the way to figure out how
they move is to use the conservation of momentum, which says the value m1*v1 + m2*v2 remains
unchanged after the collision.
Notice, this looks like a dot product between two column vectors, [m1, m2], and [v1, v2].
Rewriting it slightly for our rescaled coordinates, the same thing could be written as a dot product
between a column vector with the square roots of the masses, and one with the rates of change
for x and y.
I know this probably seems like a complicated way to talk about a simple momentum equation,
but there is a good reason for shifting to a language of dot products in our new coordinates.
Notice, that second one is the rate of change vector for the point in our diagram.
The key is that this square-root-of-the-masses vector points in the same direction as our
collision line, since its rise over run is sqrt(m2) over sqrt(m1).
If you’re unfamiliar with the dot product, you can find another video on this channel
describing it, but real quick let’s review what it means geometrically.
The dot product of two vectors equals the length of the first, time the length of the
projection of the second one onto that first, considered negative if they point in opposite
directions.
You often see this written as the product of the lengths of each vector, and the cosine
of the angle between them.
Alright, so look back at this conservation of momentum expression, telling us that the
dot product between this square-roots-of-the-masses vector with our change vector is the same
before and after the collision.
Since we just saw that this change vector has a constant magnitude, the only way for
this dot product to stay the same is if the angle it makes with that collision line stays
the same.
In other words, again using the lingo of optics, the angle of incidence and the angle of reflection
off this collision line must be equal.
Similarly, when the small block bounces off the wall, our little vector gets reflected
about the x-direction, and our configuration point bounces off a horizontal line just as
a beam of light would, since only its y-component changes
So, stepping back, what this means is that our original question of counting block collisions,
and trying to understand why on earth pi would show, can be translated to a completely different
question: If you shine a beam of light at a pair of mirrors, meeting each other at some
angle theta, how many times will that light bounce off the mirrors, as a function of that
angle?
Remember, the mass ratio of our blocks determines this angle theta in the analogy.
Now I can hear some of you complaining: “Haven’t we replaced one tricky setup with another?”.
This might make for a cute analogy, but how is it progress?
It’s true, counting the number of light bounces here is hard.
But now we have a helpful trick:
When the beam of light hits the mirror, instead of thinking of the beam as reflecting about
the mirror, think of the beam as going straight while the whole world gets flipped.
It’s as if the beam is passing through a piece of glass into an illustory “looking
glass universe.”
Think of actual mirrors here.
This wire on the left will represent a laser beam coming into the mirror, while the one
on the right will represent its reflection.
The illusion is that the beam goes straight through the mirror, as if passing through
a window separating us from another room.
But notice!
Crucially!
For this illusion to work the angle of incidence has to equal the angle of reflection.
Otherwise the flipped copy of the reflected beam won’t line up with the first part.
So all that work we did rescaling coordinates and futzing through the momentum equation
was certainly necessary.
But now we get to enjoy the fruits of our labor, watch how this helps us elegantly solve
the question of how many mirror bounces there will be.
Everytime the beam hits a mirror, don’t think of the beam as getting reflected, let
it continue straight while the world gets reflected.
As this goes on, the illusion to the light beam is that instead of getting bounced around
between these two angled mirrors many times, it’s passing through a sequence of angled
pieces of glass, all the same angle apart.
Right now I’m showing all the reflected copies of our bouncing beam, which I think
has a very striking beauty to it.
But for a clearer view, just focus on the on the original bouncing beam, and the illusory
straight one.
The question of counting bounces turns into a question of how many pieces of glass this
illusory beam crosses; how many reflected copies of the world does it pass into.
Well, calling the angle between the mirrors theta, the answer here is however many times
you can add theta to itself before you get more than halfway around the circle, which
is to say more than pi total radians.
Written as a formula, the answer to our question is the floor of pi divided by theta.
Let’s review!
We started by drawing a configuration space for our colliding blocks, where the x and
y coordinates represented the two distances from the wall.
The kind of looked like light bouncing off two mirrors, but to make the analogy work
properly, we needed to rescale the coordinates by the square roots of the masses.
This made the slope of one line sqrt(m2) / sqrt(m1), so the angle between our two bounding lines
will be the inverse tangent of this slope.
To figure out how many bounces there are between two mirrors like this, think of the illusion
of the beam continuing straight through a sequence of looking glass universes separated
by a semicircular fan of windows.
The answer, then, comes down to how many times the value of angle fits into 180-degrees,
which is pi radians.
From here, to understand why exactly the digits of pi show up, when the mass ratio is a power
of 100, it’s exactly what we did in the last video, so I won’t repeat myself here.
And finally, as we reflect on how absurd the initial appearance of pi seemed, on the two
solutions we’ve now seen, and on how unexpectedly helpful it can be to represent the state of
your system with points in some space, I leave you with this quote form computer scientist
Alan Kay: “A change of perspective is worth 80 IQ points”.