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.
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$.