Thursday, September 6, 2012

Simple real life application of number theory

Friend of mine recently bought hypotrochoid drawing set. The way it works is you have big (outer) ¬gear (imagine plastic board and hole cut in it in a shape of gear) and smaller (inner) gear placed in it. Example shape you can draw with it is here:

This particular one have exactly 10 squiggles. The gears were used to drew it had 50 (outer) and 35 (inner) teeth.

So I thought that it would be an interesting problem to determine number of squiggles given number of teeth in each gear.

My intuition was that since we are dealing with some sort of cyclic problem and integer numbers we will probably need things like gcd, lcm or something similar. The convention I used is that outer gear has $o$ teeth and inner one has $i$ teeth. I wrote out two examples and tried out different combinations of use of $i$, $o$ and $gcd(i,o)$ and I found out that $o/gcd(i,o)$ works in both cases. I wrote out additional example and it turned out that the formula works for it as well (you have no idea how annoying it is to count teeth on those gears...).

Since I found something that seems to work I tried to prove it. So first and in my opinion nontrivial observation is that each squiggle corresponds to one full turn of inner gear, but if you think about it then indeed one full turn corresponds the the pencil going as for away from outer gear as possible and back to the closest position again. Once this is noted the rest is quite straightforward. For simplicity let's assume that our pencil is inside a hole in one of the teeth. So if we start with our teeth with pencil hole aligned with teeth number $a$ inside outer gear, after $k$ rotations of inner gear we end up at teeth number $ a + ki\ (mod\ o)$ inside outer gear (assuming rotation in positive direction). When we finish drawing our pattern we will end up at exactly the same position that we started at. So we need to find smallest $k>0$ that $a \equiv a +ki\ (mod\ o)$. So in other words smallest k that $o | ki$, but we can notice that we can take away common divisor of $o$ and $i$ from both sides of the bar. After that we have required condition $o/gcd(i,o) | ki/gcd(i,o)$ which is equivalent to $o/gcd(i,o) | k$ (the reason being that after you divide two numbers by their gcd one does not have any factors in common with the other). So $k=o/gcd(i,o)$ which is number of rotations of smaller gear which is number of squiggles!

It may not be terribly cunning, but it is real life application of number theory, which, let's face it, does not happen that often (I do not count cryptography as real life...).