Firstly, a little nomenclature and background:

- The distance between the two axles is often called the "chainstay length", named after the structural members running between the them.

- The rear sprocket is normally called "sprocket" and the front one is called "chainring".

- Sprockets and chainrings are measured by the number of teeth they possess, and their circumference (where the chain rests) can easily be calculated by multiplying the number of teeth by the chain pitch (which is almost always a half inch).

Here's the maths I've done so far (including a diagram showing the problem), which can be used to calculate the chain length given the size of the sprocket and chainring, and the distance between their centres.

**Spoiler:**

Now, when it comes to calculating the distance between the axles from the length of the chain, it gets a bit tricky. I don't know of any way to rearrange the above (spoilered) equation to form a function for l

_{cs}, and I can see any other way to solve it from the diagram. I'm tempted to just do it numerically, obtaining a starting point by assuming α

_{s}and α

_{c}to both be 90°, simplifying the problem to just subtracting a couple of half circumferences and (twice) a Pythagorean calculation, then iteratively feeding this approximate value into the formula above and adjusting based on how the result deviates from the expected chain length. However, if anyone has any other ideas, I'd be very interested to hear them.

Actually, after writing this, I've just realised that it can be simplified a little, using the following:

**Spoiler:**

Thanks! (Also, INB4 homework. It isn't.)