Happy Pi Day. Yes, it's March 14th. If you write that date like an American, it looks like this: 3/14, and that looks like 3.14. It's not the best representation of pi, but it will do. As is my tradition, I am going to do something with pi. (I have to keep the streak alive—my first Pi Day post was in 2010.)

For today's pi post, let's talk about trains and things. In particular, how does a train stay on a track—especially when it's a track with a curve in it? It's easy right? You might think that these train wheels have a flange inside the track that prevents the wheel from coming off. If you look at a train wheel head-on, you might think it looks like this:

Why would this even be a problem? Well, let's start from the beginning. How do wheels roll? You might have a wheel handy—if not, here is what it looks like when my bike rolls. Note: I added a piece of tape to the front wheel so you can see how the angular position of the wheel changes.

Now suppose I measure the angular position of the wheel in each frame of the video along with the horizontal position of the center of the wheel. Here is what that would look like:

Notice that there is a nice linear relationship between the angular position of the wheel and the horizontal position? The slope of this line is 0.006 meters per degree. If you had a wheel with a bigger radius, it would move a greater distance for each rotation—so it seems clear that this slope has something to do with the radius of the wheel. Let's write this as the following expression:

In this equation, *s* is the distance the center of the wheel moves. The radius is *r*, and the angular position is θ. That leaves *k*—this is just a proportionality constant. Since *s* vs. θ is a linear function, *kr* must be the slope of that line. I already know the value of this slope, and I can measure the radius of the wheel to be 0.342 meters. With that, I have a *k* value of 0.0175439 with units of 1/degree.

Big deal, right? No, it is. Check this out. What happens if you multiply the value of *k* by 180 degrees? For my value of *k*, I get 3.15789. Yes, that is indeed VERY close to the value of pi = 3.1415 (at least that's the first 5 digits of pi). This *k* is a way to convert from angular units of degrees to a better unit to measure angles—we call this new unit the radian. If the wheel angle is measured in radians, *k* is equal to 1 and you get the following lovely relationship:

This equation has two things that are important. First, there's technically a pi in there since the angle is in radians (yay for Pi Day). Second, this is how a train stays on the track. Seriously.

OK, so what's the problem with train wheels staying on a track? If you were able to look at a train wheel, you would see that the wheels come in pairs. Each wheel is connected to another wheel that rides on the other track. The axle connecting the two wheels is fixed. That means that if the left wheel rotates one full revolution, the right wheel must also make a complete rotation.

Now imagine that a single train axle is navigating a section of the track with a turn. Here is a diagram showing some important things.

Notice that the inner rail is part of a circle with a radius R_{1}. There is also an outer rail that is part of a circle with a larger radius R_{2}. So, as the axle goes from the starting position to the finish position in this motion, both wheels have to move the the same angle θ in order for the axle to turn with the track. But that means the outer wheel goes a distance of s_{2} = R_{2}θ (assuming θ is measured in radians) and the inner wheel goes a shorter distance of s_{1} = R_{1}θ.

But this is mostly impossible. If the two wheels rotate the same amount, they would have to roll the same distance. The only way for a flat train wheel to make this turn is for one of the wheels to stop rolling and start sliding. Of course sliding wheels on a train track would sort of defeat the whole reason for using wheels in the first place.

The solution to this problem is to have cone-shaped train wheels and not flat wheels. Here is an exaggerated view of a train wheel sitting on a track.

For a straight track, the two wheels should be at a position such that the radius of the wheel at the contact point is the same. This means that the two wheels rotate the same amount and also travel the same distance. The axle goes straight and stays on the track. But now imagine the track is turning to the right (from your viewpoint). The outer wheel (the one on the left in this diagram) has to travel a farther distance. This happens because the whole axle shifts to the left so that it makes contact with the track at a point that has a larger wheel radius.

It's actually sort of magic. If the left wheel is riding too high on a straight track, it will have a larger wheel radius. With this larger radius, this left wheel will move farther with the same number of rotations as the left wheel. This will result in the axle moving such that the wheel makes contact at a smaller radius point. This will make the axle move back to a centered position. It's self-correcting. Check this out. I made my own version of a train wheel axle. You can see that even though the axle isn't perfectly lined up with the track, it stays on.

What if you switch the wheels around so that the thinner part of the wheel faces the inside of the track and the bigger part of the wheel is on the outside of the track? In this case, it's a failure. If the wheel is not perfectly centered, one wheel will have a contact point with a radius larger than the other wheel. This larger contact radius will make that wheel move a greater distance, and the whole axle will shift. But since the wheel gets wider on the outside, it's now riding on an EVEN LARGER radius. This just makes the whole thing get even more off track. Check it out.

Yes, I know my wheels aren't perfect—but imagine they were perfectly aligned. Even a slight axle tilt to the left would cause the left wheel to move to a smaller radius and cause MORE TILT. The whole axle would just skip off the track. This probably would be even worse on a curving train track which would also produce a derailment event. In the train world, they have a word for this—it's called "bad." But we don't have to worry about that. The train wheels we have work great and they also use pi. Happy Pi Day everyone.