# Why colliding blocks compute pi

## Метаданные

- **Канал:** 3Blue1Brown
- **YouTube:** https://www.youtube.com/watch?v=6dTyOl1fmDo
- **Дата:** 13.03.2025
- **Длительность:** 26:07
- **Просмотры:** 5,390,198
- **Источник:** https://ekstraktznaniy.ru/video/16127

## Описание

The physics behind one of the most surprising occurrences of pi
Next video on Grover's Algorithm: https://youtu.be/RQWpF2Gb-gU
Instead of sponsored ad reads, these lessons are funded directly by viewers: https://3b1b.co/support
An equally valuable form of support is to simply share the videos.

Next video on Grover's Algorithm:
https://youtu.be/RQWpF2Gb-gU

The original paper by Gregory Galperin:
https://www.maths.tcd.ie/~lebed/Galperin.%20Playing%20pool%20with%20pi.pdf

Adam Brown's paper on the analogy with Grover's Algorithm:
https://arxiv.org/pdf/1912.02207

Here's a lovely interactive built by GitHub user prajwalsouza after watching this video: https://prajwalsouza.github.io/Experiments/Colliding-Blocks.html

Matt Parker's Pi Day video:
https://youtu.be/vlUTlbZT4ig

NY Times blog post about this problem:
https://wordplay.blogs.nytimes.com/2014/03/10/pi/

Timestamps:
0:00 - Intro
0:48 - Recap, the surprise pi
3:58 - How to analyze the blocks
13:30 - The geometry puzzle
18:35 - Smal

## Транскрипт

### Intro []

In 2019, I put out a video about how two colliding blocks can compute pi. It's very fun, very surprising, and if you include the adaptations into shorts that I've posted since then, it is the most popular thing that I've put on the internet, and by a pretty wide margin. This year, for Pi Day, I want to revisit this topic, because there's actually a lot that I never talked about in the original video, including a fact that I didn't know when I first posted it, and which I suspect no one in the world knew, which is how this is all secretly connected to quantum computing, more specifically, something known as Grover's algorithm for search. Also, the whole crowd pleaser is that this is connected to pi, but very technically speaking, that full connection to pi is an unsolved problem. I'll explain what I mean at the end here. Just to recap, in case you haven't seen it, the setup of that original video was to have two blocks on a frictionless plane.

### Recap, the surprise pi [0:48]

At the very beginning, the one on the left is stationary, and we'll think of it as smaller, maybe 1kg, and the block on the right is coming in with some speed. The two blocks bounce off of each other, there's a wall to their left, and the puzzle is to figure out how many total collisions would take place, including the collisions with that wall. So for example, in the smallest case, where both blocks have the same mass, with each collision all of the momentum gets transferred from one block to the other, and including that one clack against the wall, the final count is 3. If that right block is bigger, maybe 100kg, it means it has a lot more momentum when it's coming in, so it takes a lot more collisions to fully redirect that momentum. In this case, with a mass ratio of 100 to 1, the total number of collisions is 31. For an even bigger mass ratio, let's say 10,000 to 1, that little block ends up getting really crammed up against the wall, and almost all of the collisions happen in this rapid burst right in the middle. In this case, it takes over 300 in total to turn that big block around, and after a nice long pause, as if the universe has a strong taste for drama, we see that the exact answer rolls in at 314, a number with eerily familiar digits. I do want to highlight a couple unrealistic things about this puzzle, the kind of nuances you can't fit into a short. When this big mass is growing, that burst of collisions in the middle just gets more and more concentrated. In order to get the delightful result here, we have to make a number of idealizing assumptions. One assumption is that no energy is lost in the collisions. Physicists would call those perfectly elastic collisions. The astute viewers would then be raising their hands and complaining, well hang on, shouldn't that mean we don't hear any sounds? This is true, I'm throwing in the sounds as an artistic choice, partly because I like it, it makes it kind of fun. But more substantively, I think it's otherwise really hard to communicate purely visually just how dense that burst of collisions in the middle is. Like here for example, with a mass ratio of a million to one, that burst contains almost 3,000 collisions, and the final count comes in at 3,141. Now as that big mass gets even more massive, that little block would have to move so quickly during that little burst that a physically accurate analysis should start to take into account relativistic effects, and there's just so many other practical realities that would cause everything here to break down completely. But we're going to be ignoring all of that, we'll only be treating this as a pure, overly idealized classical physics puzzle. Because when you do, the big surprise is that as that large mass grows by powers of 100, the total number of collisions always has the same digits as pi. Now even if this gets unrealistic for big mass ratios, you can actually see it in practice for smaller ratios. This footage here for example comes from a group of students at the University of Bonne demonstrating how when the mass ratio is 100 to 1, you really do get 31 collisions. Also Matt Parker just put up a video about the attempts that he and I and a couple others had to do so at Cambridge. What makes this puzzle great, aside from the surprising pi of course

### How to analyze the blocks [3:58]

is how well poised it is to be a general problem solving lesson. Very often when I present this as a lecture, I like to start by inviting the audience to begin by listing out a few general problem solving principles. You might enjoy thinking of a few of your own, and as we go through, I'll highlight a couple that I have written down here. For example, one that's seemingly trivial but surprisingly useful is that if you're stuck on a hard problem, and I would consider this a hard problem, it never hurts to just list any equations or theorems that might somehow be relevant. So for this puzzle where we have some colliding blocks, two relevant laws that might come to mind, especially if you have a recent physics class somewhere in your history, would be the conservation of energy and the conservation of momentum. The energy of one of these moving blocks would be ½ times its mass times its velocity squared. So let's say we call the mass of the big block m1 and call its velocity v1, and likewise the mass of that little block will be m2 and its ever-changing velocity will be v2. Then the total kinetic energy between these two blocks is what you get by plugging in the numbers and adding these two quantities. The conservation of energy essentially says this number won't change throughout the experiment. Those two velocities will change, but they have to do so in such a way that this whole expression equals the same number. This is all of course assuming that no energy is lost to friction or to the collisions. The other quantity that's conserved is momentum, and the momentum for each block looks even simpler, it's just its mass times its velocity. So again, when you plug in the numbers and you compute this expression, you'll get something, and what the conservation of momentum tells us is that whatever that number is, it doesn't change even after the blocks collide with each other. Now unlike energy, this momentum expression will actually change after that little block collides against the wall, because really what's going on is it's transferring some of its momentum into that wall. Technically speaking that should mean the wall starts moving a tiny amount, but again we'll be idealistic and assume the wall is supermassive or fixed into the earth, and any movement that it has is negligible. Another principle I have up here is to just draw pictures. When you're trying to figure something out, actually make some figures. Visual intuition can help to think about things in different ways, and sometimes staring at the right diagram can expose a solution. So in this context, where the two values that are changing are v1 and v2, you might be inspired to draw a coordinate plane, where the x-coordinate encodes this value v1, and the y-coordinate encodes this value v2. Just to be crystal clear on what I mean by that, as the experiment unfolds and the blocks collide with each other, and their two velocities change with each collision, this little point inside our space is going to move around that space as those two velocities change, always doing so in such a way that its coordinates tell you what v1 and v2 are. The hope is that as the whole experiment unfolds and we consider how exactly this point bounces around this slightly abstract velocity space, studying the path of that point can yield insights about the underlying dynamics for the blocks. Even though we're just getting warmed up, this really is the key step in our whole problem solving process, and it's a pretty common thing to do throughout physics, where if you have some dynamical situation with multiple numbers that are changing, when you package all those numbers together as a single point in a higher dimensional space, studying how that point moves through the space has a way of clarifying the whole problem. You could call this a state space, and this particular state space for us holds within it the key connection to the quantum computing parallel that we're going to be building up to. Now, in the context of this abstract velocity space, take a moment to think about what this conservation of energy equation is really telling us. When you take some number times x squared plus some number times y squared and set it equal to a constant, this is the equation for an ellipse. Our specific ellipse will be more squished in the x direction, since that number sitting in front of x is larger than the y, and the size of the ellipse will depend on the total energy of the system. And this comes from what the initial velocity of that big block was, and interestingly, I never told you that velocity. It doesn't actually change the final answer. Whether it comes in fast or it comes in slow, you get the same total number of collisions, the experiment just unfolds more quickly or more slowly. As our experiment unfolds and that pair of velocities changes, it always does so in such a way that this point inside our state space stays constrained to this ellipse. If it landed anywhere else, it would mean energy was not conserved. Another principle I want to bring up here is how math and math-adjacent fields tend to reward you when you respect their symmetries. And in this case, we already know that pi is going to be somehow relevant to the answer, and pi has everything to do with circles, relating distances around the circumference of that circle to the radius. So on our hunt for pi, it's tantalizingly close to be working with an ellipse like this, and you might feel like it would be all the more natural and maybe more promising if this was instead a circle. We can actually make this into a circle just by changing what the coordinates of that state space represent. Here's what I mean by that. The equation for a circle looks like x2 plus y2 equals some constant, without any numbers sitting in front of those variables. If I let x not represent v1, but I let it represent the square root of m1 times v1, then x2 gives us something that looks like 2 times the kinetic energy. And similarly, if y represents the square root of m2 times v2, that y-coordinate also more directly captures the energy of the little block. And this equation for the circle, x2 plus y2 equals some constant, now captures the conservation of energy but in this rescaled coordinate system. Like I said, the hope is that adding a little more symmetry will make our problem easier to solve, and in a moment you'll see how this is true. Let's take a minute to get a little familiar with what this diagram is really telling us. For example, at the very beginning, that big block has a negative velocity, so we must be somewhere on this left half of the plane, and that little block starts off stationary, meaning the y-coordinate is zero, and so we have to start out at the leftmost point of this circle, that's the initial condition. Now after they collide with each other, what happens? Where do we end up? Well, physical intuition tells us that little block picks up some kind of negative velocity, so we're going to have to end up somewhere where the y-coordinate is negative, and that big block loses some of its momentum, so the x-coordinate is going to get a little closer to zero from where it was, even if you don't know exactly how much. And again, we have to stay somewhere on this circle. The circle represents all the points that have the same total energy, and so you might guess that our point lands somewhere on this arc right here. To be more exact, we need to introduce the second conservation law, the conservation of momentum. Keep in mind though, at this point I've changed what the coordinates mean. So in our new coordinates, the momentum of the first block looks like the square root of m1 times x, and the momentum of the second looks like the square root of m2 times y. It's all saying the same thing, it's just a different coordinate system, and those masses are just constants anyway. The significance is that this whole equation is a linear equation in x and y, so in our diagram it's going to look like some kind of line. More specifically, you can work out it's a line whose slope is the negative square root of the big mass divided by the small mass. Now this slope is going to be very important for us, it's the key quantity that we'll use to get the numerical answer that has digits looking like pi, and that square root is going to be very important for us later when we get to the quantum computing case. So remember this expression. Where this momentum line sits left and right depends on what the total momentum of the pair of blocks is. We know that we start off on this leftmost point of the circle, so the line has to pass through that point. Every other point on this line is telling us every other pair of velocities that would have the same net momentum, and as you've no doubt noticed, this line intersects the circle at exactly two places, meaning there are only two pairs of velocities out there with this same kinetic energy and the same momentum as the initial condition. So after the blocks bounce off of each other, we must hop over to this other point. And honestly, that is most of the physical reasoning for this whole problem. Everything that's left is to just see how this unfolds and try to reason through what it implies. For example, that little block bounces off the wall, and all that does is flip the sign for the y-coordinate. It goes from being negative to positive, the x-coordinate doesn't change because nothing has influenced the big block. This has caused a change in the net momentum since some of it went into the wall, so our momentum line has to move over to the right however far it needs to move so that it passes through this new point. And then when the blocks bounce off each other, again we look for the other place where that diagonal line intersects the circle, and you basically keep playing this game. Little block bounces off the wall and that moves you up, blocks bounce against each other, that moves you down and to the right, and you just keep going until… well, until what, exactly? The experiment can't be done until both blocks are moving to the right, so you have to be in this quadrant here where the x and y coordinates are both positive. And also to be done, that little block has to be moving slower than the big block, meaning you sit somewhere below this line where v1 equals v2. Inside our new coordinate system, that's a line that has a slope equal to the square root of m2 over m1, a line perpendicular to those down and to the right ones we had been drawing. And let's go ahead and label this little green region the end zone, meaning when our state space point lands here, the whole experiment is done. With all of that, we've translated a physics question into a pure geometry question, one that's hopefully a lot easier to solve.

### The geometry puzzle [13:30]

Our new puzzle is this. Imagine I said we have a circle. You start at the leftmost point of that circle, and your first move is to travel down and to the right along a line with some specific slope. Here I'm drawing a slope of 4, but it could be anything. And then you move straight up until you intersect the circle, and then down and to the right with that same slope, then straight up, down and to the right, over and over until you end up inside this end zone. The puzzle is, how many lines do you draw? How many times do you zig and zag throughout this process? Of course, the answer depends on the slope. If you have a steeper slope, you end up with more total lines. And the one connection we have to the original physics is that this slope comes from the negative square root of the mass ratio. For example, when the big mass is 100 and the little mass is 1, that square root of the mass ratio looks like 10, so the slope is negative 10. And in fact we do get 31 lines, corresponding to the 31 collisions that those blocks have. It still might not be obvious how you count those lines, but it's certainly a lot less surprising that pi is relevant to the answer, and abstracted away from the physics, it is an easier question to solve. If you just stare at this diagram and you're the right combination of lucky and clever, here's something you might notice. Consider all of the points where these lines hit the circle, and consider all of the arcs along the circle in between those points. You might notice those arcs seem to be about the same size, and you might hypothesize that all of these arcs are in fact exactly the same size. This does turn out to be true, and you can prove it using the ever useful and ever delightful inscribed angle theorem. For anybody who's a little bit rusty on this one, the setup is to have three points on a circle, which I'll call P1, P2, and P3, and we care about the angle between the line from P1 to P2, and the line from P2 to P3. It turns out, no matter where you place these points, that angle is exactly half of this angle right here, from P1 to the center to P3. It's really quite fun, you can imagine moving around these points however you want, you just have to make sure P2 never goes on that arc between P1 and P3. In our little circle puzzle, think about how this might be relevant. And maybe it helps if you focus on two different lines and the one arc of the circle connecting their endpoints. These lines are separated by some angle, I'm going to call it theta, that angle is dependent just on the slope of the line, and using the inscribed angle theorem, we know that arc along the circle must run across an angle of exactly 2 times theta. Critically, it didn't matter which two lines I happened to highlight here. In all cases, the angle between the vertical line and the ones down and to the right is the same, since the slope was always the same, which means all of these little arcs along the circle cover an angle of exactly 2 theta. You might ask why this is helpful, how does this expose the number of lines? And here's a way to think about it. As you play this game of bouncing down and to the right, going straight up, down and to the right, with each one of your moves you can imagine dropping down one more of these arcs, one more segment of circumference covering 2 theta radians of angle. It's not too hard to show that this condition of falling into the end zone, a region bound by this line perpendicular to all of our down and to the right lines, happens exactly when you've dropped so many arcs that if you tried to drop one more with the same length of 2 theta, you would necessarily cause some overlap. Essentially, it happens when you've filled up the circle as much as you can using pieces of this size. So how many arcs in total have we dropped down? That's the same as asking how many times can you add some little value 2 theta to itself up until the point where adding one more would bust you over the total circumference of the circle, and that total circumference covers an angle of 360 degrees, or 2 pi radians. Phrasing things slightly differently than dividing out by that too, what is the biggest number you could multiply by this angle theta such that it stays smaller than pi? For example, imagine we were in a situation so clean and beautiful that little angle theta worked out to be exactly 0. 01 as measured in radians. The biggest number we could multiply it by would be 314, which gives us 3. 14, and if we tried to bump up the number one more, that would be 3. 15, which is bigger than pi. And more generally, if that little angle is some small power of 10, then this maximum number has the same digits as pi. I mean, this is what digits even mean. When you say pi is equal to 3. 141, you can fit in 3,141 thousandths, and adding one more would bust you above pi. At this point, maybe you're stepping back and saying, great, I see where this is going. In the case where the mass ratio is a power of 100, it's going to work out that little angle is a clean power of 10, and because of all this state-space circle-puzzle reasoning, that will explain why we see pi. This is almost true, but that's just not quite how it works out, and to make sure all of this is genuinely satisfying, let's take a moment to think through the last step. Remember how I said that the slope, not the angle, but the slope, looks like the negative square root of the mass ratio?

### Small angle approximations [18:35]

In our example where the mass ratio was 100 to 1, the slope looks like negative 10. What is slope? What is that telling us? It's the rise over run, which is the change in y divided by the change in x as you move along this line. How does that relate to that little angle I drew before? The tangent of that angle, opposite over adjacent, is going to look like the change in x divided by the change in y. I'm putting a little negative sign in front of that y because in this diagram, that change in y is negative, so we want to counteract that. The tangent of this angle should be a positive number. This looks very similar to the slope, it's basically just flipping the expression and adding a negative sign. So the tangent of theta is equal to the square root of m2 divided by m1. So with a mass ratio of 100 to 1, the tangent of the angle is 0. 1. This means that the angle itself would be the arctangent of 0. 1. So in other words, it's not quite the case that our angle is so pretty and beautiful as being a small power of 10. It's instead the arctangent of But if you go and graph the arctangent, you might notice that the arctangent of a small number is almost equal to that number itself. And the key idea is that for the purpose of our question, where we're saying what's the biggest whole number that you can multiply by this little angle that keeps it from surpassing pi, these numbers are so close that they might as well be the same. You get the same whole number answer. In the example shown on screen, 3141 keeps you below pi, but adding one more would bust you above pi. This idea that the arctangent of a small number is the same as the number itself is equivalent to saying the tangent of a small number is close to that number itself, and this is known as a small angle approximation. There is an international law saying that when you're doing physics for more than a half hour, you must use at least one small angle approximation. And if you've never seen these before, there's a really nice geometric reason why you would expect this to be true. If you think about a circle with a radius 1, a unit circle, and you consider a point an angle theta off the horizontal, what the tangent of that angle is telling you is the y-coordinate divided by the x-coordinate of that point. If your angle is really small, then that x-coordinate is basically the radius, it's basically just 1, and that y-coordinate is really close to the arc length along the circle between the x-axis and the point we're looking at. And since it's a unit circle, that arc length is the angle, it is theta. So rolling everything back, using a small angle approximation, this critical value theta we care about is close enough to a power of 10 that it explains why our answer would have the same digits as pi. That in turn explains why the number of lines we draw in the circle diagram must have the same digits as pi. And this circle diagram arose from a certain state space describing the colliding blocks. Where at a very high level, if you want to say why did pi have anything to do with this, it's because the conservation of energy for a two-body system like this simply looks like a circle in that state space. But a few sticklers could be raising their hands and saying, are we positive that small angle approximations are enough here? Can we be absolutely sure that there's not going to be a little off by one error because of the deviation here? And for any calculus students among you, the more rigorous way to do this analysis would be to pull up the Taylor's approximation for the tangent of theta, where you can see that the error between the tangent of theta and theta itself is on the order of theta cubed. So for example, if theta was a number like 1 one hundredth, then when you approximate the tangent of this value as being just 1 one hundredth itself, the error term is on the order of 1 one millionth. Now that's very small, and so as you multiply by this, that error doesn't really accumulate very much. But it is possible for the final answer to our question to be an integer whose digits aren't quite the same as pi but off by one if the following was true. If at any point when you're looking at all the digits of pi and you consider the first n of those digits, if it ever happens that the next n digits are all nines, then you get this off by one error. For all of the digits of pi that we know, this is not true. Considering how many we know, and therefore how many nines you'd have to see in a row, it seems absurdly unlikely that something like this would be true. However, rigorously proving that this is true of the digits of pi is beyond the scope of what the current tools of math can prove. So very technically speaking, this fact that colliding blocks with a mass ratio that's a power of 100 can compute pi for you is an unsolved problem. Of course, the block collisions themselves are something you and I now understand very well. You can if you want write an exact formula to answer it. And if you like to pause and ponder, you might enjoy taking a moment to think about how there's nothing special about powers of 100. If you were working in another base, like base 2, then mass ratios with a power of 4 would count up to something that has the same bits as pi written in binary. Now before you leave, it would be a shame to finish all this without highlighting why this puzzle is worth studying at all.

### The value of pure puzzles [23:30]

I mentioned already how Matt Parker's Pi Day video this year is all about putting this block collision process into practice, and suffice to say, you run into practical issues very quickly in the attempt. So some of you might complain, you know, is everything that we just did over-idealized to the point of pointlessness? And there's two justifications I could give you for stripping away the messiness of the real world, one that's straightforward and another that's a little more thought-provoking. The first is that if you want to solve any problem, it's often helpful to start with the simplest possible variant, and then once your teeth are sunk into that, you often have a first approximation of reality, and very often when you want to account for the added details and messiness of the real world, the way that works is to start with the simplistic solution and slowly modify it step by step to be more accurate. Here for example, if you want to take into account the energy loss in each collision, that might look like having the circle shrink with each one of those clacks. Now the deeper reason for abstracting away from the messiness of the real world is that purity can expose hidden connections. This whole video is already about one hidden connection between blocks and pi, but the original paper that described this phenomenon by Gregory Galperin presented it in the context of yet another connection, a beautiful analogy between these colliding blocks and the way that a beam of light would bounce between two mirrors at an angle. If you want the details, another one of the videos I made back in 2019 is all about that perspective. If you liked this, you will almost certainly enjoy that video. But even more surprising is what I referenced at the beginning, how this whole solution is secretly mirrored inside an algorithm within quantum computing. There's a lot to unpack to explain what that is, which is why I'm pulling that out into a separate video that we'll do next, but for right now I just want to leave you with one point. When pure mathematicians pull out the messiness of reality from their problems, it's not just out of laziness. I mean it's a little bit laziness, but it's not just that, and it's not out of apathy for applications. It's because distilling a problem into its core essence can expose hidden connections, and it's through those connections that mathematicians make progress. A hard problem in one context, where it might seem deeply confusing, sometimes can look clearer in another setting, but the analogy may not be obvious, and a lot of the progress of math through history has looked like developing a richer and richer web of hidden connections.
