TITLE: Proof that every repeating decimal is rational
QUESTION [37 upvotes]: Wikipedia claims that every repeating decimal represents a rational number.
According to the following definition, how can we prove that fact?
Definition:  A number is rational if it can be written as $\frac{p}{q}$, where $p$ and $q$ are integers and $q \neq 0$.

REPLY [2 votes]: Here's an explanation via an application to a conrete example.
$$
x = 0.15\ \overbrace{540}\ 540\ 540\ 540\ \ldots \qquad (\text{“540'' repeats.})
$$
Since the repetend has three digits, we multiply by $1000$ by moving the decimal point over three places:
$$
\begin{array}{rcc|c|cc|c|c|c|c|c|c|c|c|c}
1000x & = & 1 & 5 & 5 & . & 4 & 0 & 5 & 4 & 0 & 5 & 4 & 0 & 5 & 4 & 0 & \ldots \\
x & = & & & 0 & . & 1 & 5 & 5 & 4 & 0 & 5 & 4 & 0 & 5 & 4 & 0 & \ldots \\[4pt]
\hline\text{Now subtract: } 999x & = & 1 & 5 & 4 & . & 2 & 5
\end{array}
$$
So we have $$999 x = 155.25 = 155 + \frac 1 4$$ $$4\times 999 x = (4\times 155) + 1 $$
$$ 3996x = 621 $$
$$
x = \frac{621}{3996} = \frac{27\times 23}{27\times 148} = \overbrace{ \frac{23}{148} = \frac{\text{integer}}{\text{integer}}}.
$$
And of course it should be clear why this would still work with any repeating decimal expansion that you choose.