Show that every rational number $q\in\mathbb{Q}, q\in [0,1]$ has an eventually repeating ternary expansion. Show that every rational number $q\in\mathbb{Q}, q\in [0,1]$ has an eventually repeating ternary expansion. Recall that $q$ is a rational number provided it can be written as $q=\frac{m}{n}$ where $m\in\mathbb{Z}$ and $n\in\mathbb{N}$. Conversely, show that every number with a repeating ternary expansion is a member of $\mathbb{Q}$.
I can see this computationally by finding the ternary expansion for different rational numbers. 
For example, for $\frac{3}{4}$ we have 
$$\frac{3}{4} \times 3 = \frac{9}{4} - 2 = \frac{1}{4} \rightarrow 2$$
$$\frac{1}{4} \times 3 = \frac{3}{4} - 0 = \frac{3}{4} \rightarrow 0$$
So then it's ternary expansion is $.\overline{20}$ and it satisfies the above question.
However, I am unsure how to go about proving this. 
 A: Let $q={a\over b}$ with $0< a<b$ (the cases $q\in\{0,1\}$ are trivial). In order to obtain the ternary expansion of $q$ with pencil and paper you integer-divide $a:b$ and obtain $0.$ with remainder $$r_0=a\in[0\>..\>b'],\quad b':=b-1\ .$$ You then "fetch a zero" and integer-divide $3r_0:b$, resulting in $a_1\in\{0,1,2\}$, so that you now have $0.a_1$ and a remainder $r_1\in[0\>..\>b']$. You then proceed in this way: Integer-divide $3r_1:b$, etc. Since there are only $b$ possible remainders there will be a first $n$ when $r_n$ is equal to some $r_m$ with $m<n$. At this point you can assert that things will repeat forever. The period is then $(a_m,a_{m+1},\ldots, a_{n-1})$, and has a length $\leq b-1$, since $0$ cannot occur as a remainder when the period has length $>1$.
A: I'll show you a proof for the decimal system. The exact same proof will work for the ternary system.
Suppose $\frac{a}{m}$ is a fraction such that $m$ is relatively prime to $10$. Note that $m \mid 10^{m-1}-1$ by Fermat's little theorem. Let's say that $mp = (10^{m-1}-1)$, so that we rewrite as follows: $$\frac{a}{m} = \frac{a\cdot10^{m-1}}{m\cdot10^{m-1}} = \frac{a\cdot(10^{m-1}-1)}{m\cdot10^{m-1}} + \frac{a}{m\cdot10^{m-1}} =\frac{ap}{m\cdot10^{m-1}} + \frac{a}{m\cdot10^{m-1}}  $$.
Do you see what is happening here! The repeating decimal is infact $ap$, and you can write $\frac{a}{m} = .\overline{ap}$, where you add enough zeros behind $ap$ so that there are $m$ such digits.That's the proof for decimal expansions.
Now, for the ternary expansion, note that $3$ is prime, so $\frac{a}{m}$ in it's simplest form, is such that $3$ doesn't divide $m$. Now, $m \mid 3^{m-1} - 1$ by Fermat's little theorem, so continue in the manner above. In fact, do a few examples and actually derive the ternary expansion for yourself. The above even proves that the recurring part of the decimal has less digits than $m$!
