Gear Ratios to Gear Tooth Count

  • Thread starter Mark111
  • Start date
  • #26
The tone of this thread includes some theoretical approaches already so perhaps it's OK if I post the method here.

Compound Gear Train Calculations

Let's say we wanted to achieve a ratio of 13.36838 from the OP's example.

We want to find the gear sizes required to produce an overall speed ratio of R. Let's settle on a three stage gear train for this. A 2-stage would only achieve 3 digit accuracy at best.

In non-gear speak we are looking for three fractions whose product is R. Or as close to R as requested. As well, all numerators and denominators must not be greater than 100. There was no minimum number specified in the problem but a practical gear minimum is 12 teeth (involute profile, pressure angle ## 20^\circ ##).
$$ \left ( \frac {b} {a} \right ) \left ( \frac {d} {c} \right ) \left ( \frac {f} {e} \right ) = R \ (13.36838) $$
There is one equation and six (6) unknowns: a, b, c, d, e, f. These represent the number of teeth on six gears. Each of these integers is limited to a range of 12 to 100.

Frankly my math skills are not sufficient to consider Diophantine equations which may offer some beneficial lower and upper bounds to our problem. Also it's not at all clear whether we should pursue the more abstract math branches such as related Prime Factorization, B-smooth Numbers, and offline Bin-Packing.

So instead let's barge ahead with an implementable computer programmable solution.

Brute-force attack

If one proceeds with an impulsive brute-force method, one is faced with a huge number of permutations. Each of the six gears can have 89 sizes (100 - 12 + 1)
$$ 89^6 = 496,981,290,961 $$
Nearly four hundred ninety-seven billion! Trying out all permutations to see which one comes closest to the desired result would take a computer from a few hours to a few days of computing time.

That method is already impractical and would become more so for higher number of gears. Adding one more stage would multiply the above computations by 7921 (##89^2##). Now we'd be facing years or even decades of computing time.

It should be intuitively obvious that churning through all possible permutations of gear sizes is extremely wasteful. There is no interaction of gears assumed. In other words, partially calculated ratios from some of the gears does not narrow the search field for the remaining gears even though it's logical that they should.

We are forced to evaluate billions of impossible ratios that are given an 'equal' chance at success. Not to mention the millions of duplicate ratios that the six gears' interchangeability generate.

If you are told that a target is hanging on one wall and you are led to this room blindfolded, is it sensible to throw billions of darts in every direction including the floor and ceiling?

A Faster Method

Fortunately the Gear Train Calculator performs the calculation in much less time. It does not try out all permutations in the manner suggested. Instead it attempts to factor only candidate rationals ## \frac {B}{A} ## which are close to the desired ratio. Remember that a rational number is a fraction (composed of integer numerator and denominator).

Our six gear sizes a,b,c,d,e,f are combined rather than treated separately.
$$ \frac {B}{A} = \left ( \frac {b \times d \times f }{a \times c \times e } \right ) $$
This may seem like a trivial distinction from the previous brute-force approach. However, we are now considering only a single fraction ## \frac {B}{A} ## whose numerator and denominator need to be factorable into three factors each. The number of permutations that need to be considered are now dramatically reduced.

If gears a, c, e (the denominators) are all at their minimum size then A is minimized:
A's minimum value is ## 12^3 = 1,728 ##
The largest that A can get when B is maximized: ## \frac {100^3}{13.36838} = 74,803 ##

Therefore A can range from 1,728 to 74,803. This means we will test 73,076 fractions. A lot less than 497 billion. A nearly seven million factor speedup.

The numerator B is always ## A \times 13.36838 ##, rounded to the nearest integer. We divide out that fraction to check how close it is to that ratio. If the result is fairly close (for example, closer than a previous estimate) then we try to factor B and A into three factors each that satisfy our teeth range limits. Factoring consists of a linear search for divisibility, done recursively for subsequent stages. However there are optimizations possible for factoring odd numbers as well as dynamically narrowing search ranges.

It turns out that the best fraction ## \frac {B}{A} ## whose numerator and denominator is factorable into 3 factors each is ## \frac {154993}{11594} ##

For the final result this best ratio ## \frac {B}{A} ## is re-factored to find the optimum gears. This time all possible factorizations are evaluated rather than stopping at the first possible one as was done above. It is desirable to get the lowest total tooth count. At least that's what I assumed gear hobbers would like. Therefore factorizations are favoured where the sum of ## b + d + f ## is minimized as well as the sum ## a + c + e ##.

The final step is to present the gear sizes in order - largest to smallest. This comes out naturally from the direction of the factorization flow so a sort was not necessary.

Optimum result:

In this result as in any result, odd-positioned numbers may be interchanged with other odd-positioned numbers. Similarly even-positioned gears may be exchanged with other even-positioned gears. This does not affect the ratio since all we are doing is shuffling the numerators or denominators amongst themselves.

The result can be interpreted as:
$$ \frac {71}{31} \times \frac {59}{22} \times \frac {37}{17} = 13.36838019665344 $$
Summary thoughts

The method described reduces the search for compound gear train teeth counts by a substantial amount compared with an exhaustive random gear permutation search. It does this by focusing only on 'close' approximations to the desired ratio. While it's still a labour intensive exhaustive search, the order of complexity is minimized.

The method is still not practical enough to be hand-calculable. Such is not possible given the class of this mathematical problem. Students of mechanical engineering will need to continue to use established methods to approximate ratios and the necessary multiple attempts to factor them and to show their work! It is however clear that unless a decidedly exhaustive search is undertaken, or the use of computer solutions such as the one here, their solutions will not be guaranteed to be optimal.

The Gear Train Calculator can also perform reverted gear train solutions. The method for that function are considerably different than the one described here so far.
Last edited:
  • Like
Likes OldEngr63 and billy_joule
  • #27
Gold Member
Very interesting write-up. I hope that you will do something similar for the reverted gear train design.

Just a very small quibble here.

Back in the 1980s when I was much more concerned with these matters, the AGMA standard for involute gear teeth said the following regarding the minimum number of teeth on a pinion:
20 deg Coarse Pitch -- min number of teeth = 18
25 deg Coarse Pitch -- min number of teeth = 12
20 deg Fine Pitch -- min number of teeth = 10
I would expect these min values to still apply since I cannot see that anything has changed to make things different.
  • #28
Yes you are right. I was probably looking it up for 25 degree by mistake - just to get a quick number. Even the maximum of 100 is probably not realistic to make for home machinists. However in this particular example the maximum teeth count required was 71.

Any teeth count limits can be tried in the calculator from 3 to 400. It's interesting to see how the final result is affected. Choosing a more restrictive range will result in ratios with greater error from the desired ratio. Sometimes the total number of teeth is greatly reduced with just a small penalty of increased error. This may be desirable for manufacturing ease.

I could do a writeup of my method of calculating gears for a reverted train design. Again it will be in the form of an algorithmic approach. The assumption is that a computer is the intended tool of choice.

I'm frankly surprised that there is so little available to take gear train calculations out of the dark ages. Perhaps the horologists want to keep it a black art on purpose. I mean, we have tons of good programmers and mathematicians. Perhaps the disciplines rarely intersect.

The Guinness Book of World Records has recently inducted a watch company for their "most precise lunar phase wristwatch".
Hmmmm, the ratios could be worked out in 0.02 seconds (0.25 seconds on my iPhone).
Ratio 118.1223554124 (synodic month x 4 for a 2x moon display driven from an hour hand) gives a 3-stage gear train:
67:93,13:88,7:88. These gears produce an error of 1 day in over 2 million years just like the watch.
Maybe I'm missing something. Or maybe I should win the Nobel Prize.
  • #29
Gold Member
I'm frankly surprised that there is so little available to take gear train calculations out of the dark ages.

Much of what you have done is described in Mechanics of Machines by Doughty (Wiley, 1988, Lulu, 200x), although the full computer algorithm is not developed there. This seems to have been a bit of an anomaly at that time, and remains so today. As far as I can tell, the attitude of most engineers in most situations is along the lines, "We have to slow it down (speed it up) by about a factor of x," but hitting the exact ratio is not often considered critical. The clock/watch case is obviously an exception, and I think on the whole, we could do better engineering if we would but try. I think your work here is a very significant contribution, and you are to be congratulated. Please do write up the reverted train design process.
  • #30
OK here goes. This is more like a math / algebra / computer algorithm lesson rather than physics and gearing... but like I said, these disciplines happen to intersect in gear design as far as I can see.

Reverted Gear Train Algorithm

A reverted gear train is one where the input and output shafts are collinear. Usually what is implied is a 2-stage gear train. Examples are clocks whose hour and minute hand rotate around a "common" shaft - although they are actually on separate shafts that are nested one inside the other. Many transmissions are designed to have their output shaft in line with the input shaft. Yet those shafts are at opposite ends of the casing. This too satisfies the requirement for a collinear arrangement.

What it means mathematically is that the distance of the centers of the first gear pair is equal to the distance in the second gear pair. Or put another way, the teeth count totals of the pairs must be equal.

So not only do we have to meet the requirement:
$$\tag{1} \left( \frac {B}{A} \right) \left( \frac {D}{C} \right) = R \ \text {(Standard 2-stage gear train)}$$
Also collinear axes arrangement is maintained by
$$\tag{2} A+B=C+D$$
The restriction is enforced by the module or diametrical pitch being equal on all gears. Otherwise a regular 2-stage gear train would suffice where the pairs of gears simply have different pitches to comply with their center distances matching.

Again as in the compound gear train example we seem to be faced with too many unknowns. The second formula is just a filter. If our teeth range is 10 to 110, leaving a latitude of roughly 100 possibilities per gear, then the permutations would amount to ##100^4=100,000,000##. This is not astronomical for today's computers to process but it can be greatly reduced.

Eliminate variables

Let's reduce the degrees of freedom. We can eliminate variables C and D by combining those two formulas.

From equation (2) we know ##D=A+B-C##

Therefore from equation (1) ##\frac{D}{C}## can be replaced with ##\frac{A+B-C}{C}##

The value of this fraction can be gleaned from A, B and R.

Let's go through elimination and simplification.

##R\times \frac{A}{B}=\frac{A+B-C}{C}##

##R\times \frac{A}{B}=\frac{A+B}{C}-1##

##R\times \frac{A}{B}+1=\frac{A+B}{C}##

##\therefore \tag{3} C=\lVert \frac{A+B}{R \times \frac{A}{B}+1} \rVert \ \text{(Vertical bars denote "rounding".})##

We resign ourselves to needing A and B to traverse the entire possible gear teeth range. By having eliminated C and D from our search space our permutations have been reduced from 100 million down to ##100^2=10,000##.

We can see that C and D are inferred and thus need not have their own permutation generating loops. Also, since there are minimum and maximum limits on the gear sizes, we can "early out" during some searches. For example we can determine that for certain A that B may be out of range always thus making A's initial guess invalid. So ultimately we reduce the 10,000 further, it being the worst case. It turns out that for ratios more distant from 1 the number of tries is reduced the most.

The rest is brute force

What remains is an exhaustive search within a very manageable complexity. We simply go through all A and B systematically checking each fraction multiplied by the (D/C) part that they dictate. We are guaranteed each attempt complies with the reverted gear train requirements thanks to formula (3). We keep track of the closest ratio so far and keep crunching to the end.

The Gear Train Calculator manipulates the final result so that the idler compound gear (represented by the inner two numbers) will contain the lower numbered largest gear. There is no pressing reason for this but just something extra I threw in thinking that this may be desirable.

For a ratio of 12 for example - a very common requirement in clocks as was stated at the outset, the calculator produces 10:30,8:32
Note that 10+30 = 8+32

I believe the calculator is the only one on the internet that does reverted gear trains.

None of the math techniques are groundbreaking in the reverted nor the compound gear portion. It's just that no one else has put together a finished tool that puts theory into practice.

Related Threads on Gear Ratios to Gear Tooth Count

  • Last Post
  • Last Post
  • Last Post
  • Last Post
  • Last Post
  • Last Post