Sunzi's dial

Sunzi’s remainder theorem, sometimes called the Chinese Remainder Theorem, posits that one can solve certain systems of modular equations. For example, suppose that $x$ satisfies the following equations

\[\begin{align} x&\equiv 2 \mod 5 \\ x&\equiv 3 \mod 7 \end{align}\]

Then there is a solution for $x$, and any two solutions are congruent mod $5\cdot 7 = 35$. The earliest statement of this is a riddle in the 3rd century Chinese book Sunzi Suanjing, written by Sunzi (meaning “master Sun”). But how do you find $x$? Enter Sunzi’s dial, a mechanical device for solving this system. Simply line up the 2 tic on the inner 5 dial with the 3 tic on the outer 7 dial. Then read off the arrow which points to 17. Indeed, $17\equiv 2 \mod 5$ and $17\equiv 3 \mod 7$.

Let’s try a system of three equations.

\[\begin{align} x&\equiv 2 \mod 3 \\ x&\equiv 3 \mod 4 \\ x&\equiv 2 \mod 5 \end{align}\]

Sunzi’s remainder theorem suggests we can solve for $x\mod 60$. Here is Sun’s dial for 60, which has three wheels. First, we set the 2 tic on the 3 wheel to the 3 tick on the 4 wheel. The arrow from the 3 wheel points to 11, so 11 is 2 mod 3 and 3 mod 5. Next we align 11 with 2 on the 5 wheel, and the arrow points to 47. Therefore, the solution is $x \equiv 47 \mod 60$.

How it works

Sun’s dial is a bit of a magic trick, because the labels on the dials are