The hanging cable

The following question was posted to our discussion board. This is allegendary an Amazon interview question.

A cable is hanging between two poles. Given the length (L) and the sag (h), how far apart are the poles?


The shape of a cable hanging between two points is called chain curve or catenary. It was thought to be a parbola for a long time until Leibniz, Huygens, and the Swiss mathematician Johann Bernoulli found the right solution. According to the story, the question was brought up by Bernoulli's brother Jacob who was interested in the problem. Everything is connected to everything, this is the same Bernoulli who discovered the mathematical constant e which we will meet in a second.

Based on the wikipedia article chain curves are members of the cosh family:

This is the general formula for any chain curve, if we want to give it a physical meaning we need to define the parameter a. As Bernoulli and his gang showed, this can be calculated from the mass per unit length λ, the acceleration of gravity g and the horizontal tension acting on the cable T0. The latter is a constant for any point of the curve.

This is still too general for our purposes, but in our case the two end points of the cable are at the same height and a can be determined geometrically as well:

What's even more interesting, and shows the beauty of nature, is that there is a closed formula for the distance of the poles:

That is if the usage of the arcosh function is allowed.