# A three-gear alignment problem, simultaneous equations

1. Mar 19, 2013

### bobsalive

This is a problem that a few friends and I came up with while working on an extra-curricular robotics project:

There are three gears meshed together with idle gears inbetween so that the three gears rotate in the same direction.
http://puu.sh/2knXq [Broken]

The gear ratio between gear A has 4 teeth, gear B has 20 teeth, and gear C has 60 teeth. Therefore the gear ratio between A and B is 1:5, and the gear ratio between B and C is 1:3. A mark is made at the same position on the circumference of each gear, and are thus in an "aligned" position. Gear A is turned at a constant rate, so that the marks move in a clockwise direction. It is accepted that eventually, the marks will all be in their initial positions at the same time, and thus be "aligned" again. In this case, it can be guaranteed that after 20 x 60 = 1200 rotations of gear A, the marks will be "aligned" (it will actually become aligned sooner, but it 1200 rotations of A is a guaranteed value).

Now let us generalise the scenario a bit more. The gear ratio between gear A and gear B is f, and the gear ratio between gear B and gear C is g. Additionally, the marks made on the gears are in a random position on the circumference of the gear. The position of the mark on gear A is taken as a reference, and the position of the mark on gear B has an offset of j (in radians) and the position of the mark on gear C has an offset of k (in radians). Again, gear A is turned so that each mark moves in a clockwise direction at a constant rate. Can we still guarantee that eventually at some point in time (t), the marks will be "aligned"?

-----------------------------------------------------------------------------------

We came up with a few ways to try and "prove" a hypothesis that the marks would eventually become "aligned", but we couldn't come up with a conclusive analytical method (because our math isn't good enough). The actual question is the last method after the line, so if you want to, just skip there. These other methods are provided to show that we did think about it and try some different methods before we decided an analytical method was required.

First, a few people simplified the problem down to just two gears, A and B. It can be reasoned logically that a mark on each gear will become "aligned" given enough time (rotation). It's a bit of a step to then say that this must also apply to a three-gear situation, it just might take longer. My problem with this is that it doesn't "prove" anything, it's just an assertion. The flash image at http://science.howstuffworks.com/transport/engines-equipment/gear-ratio1.htm demonstrates what we mean by "marks", except in our scenario the gears are rotating in the same direction.

Second, a few people tried a graphical method, by drawing a graph with the angle of each gear as gear A is turned, and finding points where the lines intercept. The problem is that while it is easy to do this for a two-gear situation, it takes way too long to do this for a three-gear situation. It can also only be done for one value of f, g, j, and k at a time, rather than allowing those variables to be any value.

Thirdly, we tried doing some programming to get the computer to do the math for us. We used the simultaneous equations from the next paragraph. This essentially amounted to using a series of for loops to try every possible combination of f, g, j, k, and t until the marks were "aligned". However, there were issues with floating-point precision, and the question that came up was "how large an uncertainty is acceptable?". We were able to show that with a tolerance of 10%, the marks "align" at some point, but 10% is just too big. The ultimate decision was that there shouldn't be any uncertainty if we want to prove that the marks do "align" at some point in time. It was decided at this stage that an analytical solution would be needed to "prove" or "disprove" the hypothesis that the marks do "align".

(A few other methods were discussed and attempted by various people but I don't remember all of them and including them wouldn't be particularly useful here).

---------------------------------------------------------------------

My "proof" involved some simultaneous equations...
yA = cos(t)
yB = cos(ft + j)
yC = cos(gt + k)
xA = sin(t)
xB = sin(ft + j)
xC = sin(gt + k)
where y is the relative vertical position of the mark (between -1 and 1), and x is the relative horizontal position of the mark (between -1 and 1).

I argued that if you could solve these simultaneous equations then you would be able to prove that all three gears have the same relative x and y positions at a particular value of t, for any value of f and g between 0 and 1 and any value of j and k between 0 and 2pi (We don't necessarily need these bounds for f, g, j, and k, it just simplified the problem slightly when we tried to solve it computationally). The problem is that I don't know how to solve these equations analytically. Anyone have any advice?

Last edited by a moderator: May 6, 2017
2. Mar 19, 2013

### Vargo

Hi Bobs,

I would suggest ditching x and y coordinates and just focusing on the angles:
t,
ft+j,
gt+k,

You want to know whether there is a value of t for which these all differ by a multiple of 2pi. Lets simplify it more. Take j' = 2pi*j, k'=2pi*k, and t'=2pi*t. (In other words t',j',k' measure the percentage of the way around the circle instead of the actual angle).

2pi(t')
2pi(ft'+j')
2pi(gt'+k')

Now divide everything by 2pi so that our angles are in new units (measuring proportion of the way around the circle). What you want to check is whether there is a value of t for which all three numbers differ by whole integers.

Forgetting the primes, we are just given 4 numbers between 0 and 1: f,g,jk. We want to know whether at some time t, the three numbers:
t, ft+j, gt+k
will all have the same fractional part.

My next suggestion is to consider just two gears and try to solve that problem first.

3. Mar 25, 2013

### bobsalive

Hi Vargo,
Thanks for your help - I think doing it in terms of the angle probably makes more sense than x-y co-ordinates. I did give it a go but it doesn't seem to be working out for me.

I got:
thA = t / 2pi
thB = (ft + j) / 2pi
thC = (gt + k) / 2pi

We can solve for t for the condition where thA = thB = thC in terms of f,g,j,k.

This gets me t = (-j / (f-1) - k) / g
Which doesn't really make sense because it gives a negative time value? Also when I then plug the t value for a given f,g,j,k into either the theta equations or the x-y co-ordinate equations, they don't match up.

4. Mar 25, 2013

### Vargo

So, the point of dividing by 2pi is that instead of measuring in radians, your angle units go from 0 to 1. So you just have three variables:

Sa, Sb, Sc

These measure how far around each gear is. So, in these units, you have:

Sa = t,
Sb= pt+q,
Sc = rt+s,

where p, q, r, s are all numbers between 0 and 1. You can simplify it even more, and say that Sa=0 for all time. All you are doing is choosing your reference frame to go around with the first gear. That just shifts the formulas for Sb and Sc, but doesn't otherwise change the problem. So lets assume

Sa=0, Sb=p't+q, and Sc=r't+s. (r'=r-1, p'=p-1).

We want to find t such that all angles are whole numbers. A whole number n means that the gear is turned n complete times so it is in the same position as 0.

So,
p't+q = n,
r't+s = m,
where n and m are any whole numbers.

First solve the first equation to get:
t = (n-q)/p'
This represents an infinite number of solutions because you can put any integer n in that and get a different solution.
Sub that into the second equation:
r'(n-q)p' + s = m.

This means that the left side must be equal to an integer m. This means that you must be able to find an integer n that makes the expression on the left side an integer. If you can do that, then the gears will line up at some point.

Multiplying things out, you get:
r'p'n - m = r'p'q-s

The question becomes this: Are there integers n and m for which the above equation can be solved? The answer should depend on the numbers p', r', q, s.