The problem is grip

A locomotive can only push as hard as its wheels can grip the rail.

A steel wheel on a steel rail is wonderfully efficient: so little rolls against so little that one engine can haul hundreds of tonnes on the level. The price is grip. The force a driving wheel can pass to the rail before it slips is its load times a coefficient of adhesion, about a quarter on a clean dry rail and far less on a wet one, or one covered in leaves or frost.

On a slope, gravity pulls the whole train back down the hill. The engine must push against that pull with only the weight on its own driving wheels to grip with. Make the hill steep enough and the wheels spin, however powerful the engine.

The grip lab

Try it
The rail today
Drive
Gravity's pull
Wheels' grip
Steepest by grip alone
Train weight
Adhesion values are typical figures, not measurements of any one railway. The engine sits below its coaches and pushes, as mountain engines do: if a coupling broke, the coaches would not run away from it.

Try the leaves. A railway has to work on its worst day, not its best, and that is why ordinary lines are laid at a few per cent at most. Britain's famous Lickey Incline is 1 in 37.7, under 3 %. The Bernina line in Switzerland reaches 7 % with every axle driven, about as far as wheels alone can go.

To climb a mountain directly you must stop relying on friction and give the engine something to push against.

The first rack was not for hills

Curiously, the very first rack locomotives, built in 1812 by John Blenkinsop and Matthew Murray for the Middleton Railway in Leeds, ran on almost level track. Engineers then doubted that smooth iron wheels could grip iron rails at all, so Blenkinsop cast teeth along the side of one rail. It worked, but it pulled the engine off-centre and made simple points impossible. Once it was clear that plain wheels gripped well enough on gentle grades, the side rack became a dead end. The rack only came back, in the middle of the track, when railways began to look at mountains.

Go deeper: the sums

On a gradient at angle θ, a train of mass m needs a pull of m g (sin θ + cr cos θ), where cr is the rolling resistance (taken as 0.004). The driving wheels, carrying mass md, can give at most μ md g cos θ before they slip.

Setting the two equal gives the steepest gradient by grip alone: tan θ ≈ μ md / m − cr. The engine's own power does not appear at all. Only the share of the train's weight on driven wheels, and the state of the rail, decide it.