Instantly share code, notes, and snippets.

# Bike Math!

Note: For the sake of clarity I'll probably write things you already know. It's just as much to eliminate communication errors as it is for me to keep track of what the fuck I'm even talking about. It does not imply any kind of judgment of what I assume about you :)

Here's the math behind gears and how they are used to efficiently rotate wheels. The same principles underlie how cars work but the mechanisms are (obviously) more complicated.

1. Knowledge is Power

What follows is a short overview of the relevant mechanical physics. In common language we use words like "force," "energy," and "power" somewhat interchangeably. I'm going to be a robot and precisely distinguish them.

Force is how we measure the change in motion applied to some object. Thanks to Newton's Second Law of Motion we know we calculate this by multiplying the mass of said object by the acceleration (change in velocity over time) caused:

``````Force = mass (kg) * acceleration (m/s^2)
``````

The unit `(kg*m)/s^2` is called a Newton (`N`) in his honor. How touching. Units really help elucidate all this so we'll be keeping track of them.

Torque is essentially rotational force about a pivot. In the special case that we are rotating in a circle (thank God), torque is calculated like so:

``````Torque = Force (N) * distance from center (m)
``````

Energy is a measure of force applied to an object over a distance. You measure it like so:

``````Energy = Force (N) * distance (m)
``````

Both energy and torque, if you look at the units, measure the same thing.

This is useful as we'll see in a moment.

Power is defined as the rate at which energy is expended.

``````Power = Energy (N*m) / time (s)
``````

Finally, we will be exploiting the Law of Conservation of Energy, that energy can neither be created nor destroyed. Since power is a measure of energy transferred through a system, we can also know that power in a closed system is conserved: that energy has to go somewhere after all.

There's an alternative to measuring angles and rotations in degrees, called the radian. Strictly speaking radians are not a unit of measurement, though we will sometimes speak as if they are to convey a point.

Take a circle with radius `r`. The circumference around that circle is `2*pi*r`. Half a rotation is just `pi * r`, while 2 rotations is `4*pi*r`. Etc.

Someone came up with the idea of measuring rotations of any given circle by declaring that

``````1 full rotation = 2*pi rad
``````

So regardless of the radius of the circle you can measure the number of its rotations in radians. Multiplying a radian measurement by an actual radius will give you the distance around the circle traveled. Nifty.

I promise this will become relevant.

1. Going in circles

The stage is set; let's begin with the pedals.

Most pedal cranks are between 170mm and 175mm in length. You push on a pedal, which resists you for all sorts of reasons (whether or not you're moving, friction, total weight of the bike plus you, etc). To get it to turn you apply a certain force and you will do this at a certain angular speed, or cadence (`radian/s`).

Thus the torque you apply is

``````Input torque = Force on pedals (N) * length of cranks (m)
``````

And if you multiply by the cadence, you can compute the power:

``````Input power = Torque (N*m) * cadence (radian/s)
``````

Since radians aren't really a unit of anything, we have some power measured in `N * m / s`. So far so good.

The cranks are fixed to the front chainring. The chainring may have several different possible gears but at any given moment it has its own radius. Because they're side-by-side, they must

1. Have the same cadence; and
2. Have the same power.

The radius is now different, the cadence is the same, and the force times the radius times the cadence must result in the same total power. Since the radius decreased, the force must increase to maintain conservation of power.

If you have a crank length of `l_crank` and a chainring radius of `l_chainring`, then

``````Force out of chainring = ( l_crank / l_chainring ) * input Force
``````

Since the crank length is (hopefully!) longer than the radius of the chainring, this multiplies the Force that will pull the chain.

Connecting two gears in series with a chain is fundamentally equivalent to having them actually touch each other. The chain just lets a gear be far away from its partner really.

In practice the chain sucks power out of the system in the form of heat from friction. However we can just note that the output power of the bike is the input power minus a thousand little points of friction that, in a good bike, don't make much difference.

So the rear gear is being turned by the chain with some force. The power is (basically) still constant, so we have the following equation:

``````Power at rear gear = Force from chain (N) * radius of gear (m) * rear
``````

or

``````Rear cadence = Power at rear gear (N*m/s) /
( Force from chain (N) * radius of rear gear (m) )
``````

As with the front gear, you can change which rear gear you're on but at any given moment its radius is fixed. Thus the cadence, generally speaking, is going to want to be faster.

The last bit, of course, is the rear wheel. It is also fixed side-by-side with the rear gear (bikes which coast allow it to spin freely one direction, but when you're pedaling the rear gear and the rear wheel are fixed together).

Again, we hold power to be constant. The radius of the rear wheel dwarfs the radius of the rear gear. However, they must spin with the same cadence.

``````Power out of rear wheel = Force from chain (N) *
radius of rear wheel (m) *

= Force from chain (N) *
distance bike is traveling (m) /
time (s)
``````

This has the effect of greatly reducing the force we had coming out of the chain, but also of making the rear wheel spin with the cadence of the rear gear.

1. Shifting Gears

So I've been describing this whole system from front to back, in one direction. However you must also remember there are forces going from back to front. The rear wheel essentially must move the mass of the bike + rider + any extra equipment.

You may very well apply a force to the pedals but it must be enough to accelerate the total mass of the bike. The front chainring multiplies the force but the flipside of that is that you are limited in how fast you can turn the cranks because they can only turn as fast as the chainring, which is limited by the chain, and so-on.

Thus a low gear is one which maximizes the force coming out of the rear wheel at the expense of cadence - and, hence, distance traveled per second.

A high gear makes the opposite tradeoff: it sacrifices force in order to maximize cadence.

Hence bicycles (and cars) start in low gears because there is no existing acceleration. You need to generate a lot of force. Once you are moving there becomes a diminishing return on adding more force because you are limiting how fast your wheel can turn. So you "shift up" a little. You still contribute a lot of force but now you can convert more of your power into cadence.

Once you get the feel for it you can accelerate quickly by generating a burst of power and shifting up at the right time.

I hope this wasn't too boring!

### BrunoChevalier commented Jul 31, 2017

 Fun quick read. One remark however: ``````1 radian = 2*pi `````` Should be ``````1 full rotation = 2*pi rad `````` because one radian is just under 57.3 degrees.
Owner Author

### gatlin commented Apr 21, 2018

 Thanks @BrunoChevalier! Silly oversight on my part.