# Prove that a number is rational if and only if from some point on its decimal expansion becomes periodic.

Q: "Prove that a number is rational if and only if from some point on its decimal expansion becomes periodic"

Please help!! I am relatively new to algebra and I find these questions very abstract.

Any input/hint/solution would be highly appreciated!

God bless you math guys on stackexchange!

• What exactly does it mean if a number's decimal representation is periodic? Can you write an equation if $x = n.(a)(b)(b)(b)...$, where $(a)$ and $(b)$ are groups of digits? – Carl Schildkraut Sep 22 '16 at 3:18

## 3 Answers

Suppose that $r = 0.a_0a_1...a_n\overline{b_0b_1...b_m}$ (remove the integral part of $r$, that keeps it as a rational/irrational), where $a_i$ is the fixed part and $b_i$ is the recurring part. Note that: $$r\cdot10^{n} = a_0\ldots a_n + 0.\overline{b_0\ldots b_m}$$ $$r\cdot10^{n+m} = a_0\ldots a_n b_0 \ldots b_m + 0.\overline{b_0\ldots b_m}$$

Subtract: $$r(10^{m+n}-10^n) = a_0\ldots a_n b_0 \ldots b_m - a_0\ldots a_n$$ Which implies: $$r = \frac{a_0\ldots a_n b_0 \ldots b_m - a_0\ldots a_n }{10^{m+n}-10^n}$$

So $r$ is rational.

A rational number must have a repeating/terminating expansion. To see this, first we remove the integer part and assume that $r = \frac{p}{q}$, where $p < q$. Next, we note that by multiplying the numerator by $10^n$ for sufficiently large $n$, we can assume that $\frac{p(10^n)}{q}$ in it's simplest form, is of the form $\frac{s}{t}$ where $\gcd(10,t) = 1$. Once, this happens, we have Euler's theorem: $t | (10^{t-1} - 1)$.

So what we do is: $$\frac{s}{t} = \frac{s(10^{t-1}-1) + s}{t10^{t-1}} = \frac{s}{10^{t-1}}\frac{(10^{t-1}-1)}{t} + \frac{1}{10^{t-1}}\frac{s}{t}$$ Now you see where the recurrence comes from. Apply the same trick on the second $\frac{s}{t}$: $$\frac{s}{t} = \frac{s}{10^{t-1}}\frac{(10^{t-1}-1)}{t} + \frac{1}{10^{t-1}}\bigg(\frac{s}{10^{t-1}}\frac{(10^{t-1}-1)}{t} + \frac{1}{10^{t-1}}\frac{s}{t}\bigg)$$

You can see where the repeating decimal comes from. The final answer you will get is: $$\frac{s}{t} = \frac{s}{t} (10^t-1) \sum_{i=0}^\infty \bigg(\frac{1}{10^{i(t-1)}}\bigg)$$

Thus, the part $\frac{s10^{t-1}}t$ keeps repeating in the fraction, while the $10^n$ in the starting shifts the value by a slight bit. Hence the decimal recurs, because of this repeating part. If there's no repeating part, then because $n$ is finite we have a terminating decimal.

For example, let us take $\frac{4}{3}$. We subtract $1$ to give a proper fraction $\frac{1}{3}$. According to our hypothesis, $10^{3-1}-1 = 99$ is divisible by $3$, and the quotient is $33$. Hence, the answer is: $$\frac{1}{3} = 0.\overline{33} \implies \frac{4}{3} = 1.\overline{33}$$

To take a slightly more non-trivial example, let us take $\frac{19}{12}$.

Here, we first subtract $1$ and make the fraction proper, to $\frac{7}{12}$. Then, we multiply by $10^2=100$ on the top, so that we get a new fraction $\frac{175}{3}$. We again remove the part $58$ to leave $\frac{1}{3}$.

Now, $\frac{1}{3} = 0.\overline{33}$, so $\frac{175}{3} = 58.\overline{33}$, and $\frac{7}{12} = 0.58\overline{33}$, and $\frac{19}{12} = 0.58\overline{33}$.

I hope this procedure explains the reverse as well.

• @kn619 . For the second part you can observe that if you carry out a long division to compute the digits of $p/q$ there is a remainder (possibly $0$) at each step and there are only $q$ possible remainders. So eventually a remainder will occur a second time, resulting in a repeating period. – DanielWainfleet Sep 22 '16 at 4:19
• @астон вілла олоф мэллбэрг Thanks a lot! – kn619 Sep 24 '16 at 19:38

This is a bijection so you need to prove it both ways:

(number is rational) -> (at some point its decimal expansion becomes periodic)

(at some point its decimal expansion becomes periodic) -> (number is rational)

For the first,

How can I prove that all rational numbers are either terminating decimal or repeating decimal numerals?

For the second,

Proof that every repeating decimal is rational

Proving that if the decimal expansion of $x$ is finite or periodic at some point, then $x$ is rational:

• Let $|n|$ denote the number of decimal digits in $n$
• Split $x$ into the following parts:
• $\color\red{A}=$ the integer part, i.e., $\lfloor{x}\rfloor$
• $\color\green{B}=$ the fraction part's non-periodic prefix
• $\color\orange{C}=$ the fraction part's periodic postfix

Then:

$$x=\frac{\color\red{A}\cdot(10^{|\color\green{B}|+|\color\orange{C}|}-10^{|\color\green{B}|})+\color\green{B}\cdot(10^{|\color\orange{C}|}-1)+\color\orange{C}}{10^{|\color\green{B}|+|\color\orange{C}|}-10^{|\color\green{B}|}}$$

Hence $x$ is rational.

For example, consider $x=1.23\overline{456}$:

• $\color\red{A}=1$
• $\color\green{B}=23$
• $\color\orange{C}=456$

Then:

$$x=\frac{\color\red{1}\cdot(10^{2+3}-10^{2})+\color\green{23}\cdot(10^{3}-1)+\color\orange{456}}{10^{2+3}-10^{2}}=\frac{41111}{33300}$$

• @kn619: You're welcome :) – barak manos Sep 25 '16 at 6:27