Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to prove that a number is rational if and only if it has an eventually periodic decimal expansion. One part is simple; without loss of generality we consider $q=0.\overline{d_1\dots d_k},$ set $p=d_1\dots d_k$ so $$q=\sum\limits_{n=1}^{\infty}\frac{p}{10^{kn}}=\frac{p}{10^k-1}\in\mathbb{Q}.$$ To prove the converse, I have been given the hint to apply the pigeonhole principle. Can someone give some suggestions (or just post the answer if you like; it's not homework) because I'm not too familiar or confident in using the pigeonhole principle, even though I feel like it might be some simple trick I don't see right now.


share|cite|improve this question
How about $$\frac1{2^a 5^b}?$$ Is it periodic & rational ? – lab bhattacharjee Aug 14 '14 at 8:43
You should probably say something like "eventually periodic". I think this is what @labbhattacharjee is referring to. – MPW Aug 14 '14 at 8:50

To see that every rational has an eventually repeating decimal representation, suppose the rational is $\pm a/b$ with $a\geq 0$ and $b>1$ (we may exclude $b=1$ since then $a/b$ is integral and so has a decimal representation ending in a repeating string of zeroes already). Then just perform long division of $a$ by $b$. At each successive step in the long division, you either get a remainder of $0$ (and you are done, the decimal representation ends in a repeating string of zeroes), or you get a positive integral remainder which must lie in $\{1,\ldots,b-1\}$. There are at most $b-1$ possible distinct remainders, so by the $b^{\textrm{th}}$ successive step you must have a repeated remainder; the sequences of successive remainders must then repeat those previously encountered since the repeat, in order, producing the same sequence of generated digits in the quotient as desired.

share|cite|improve this answer

Let $q=\dfrac{a}{b}\in\mathbb Q$ be given. Suppose this rational has decimal expansion $$ q=\frac{a}{b}=c.d_1d_2... $$ Then we have more generally that $$ 10^kq=c_k.d_{k+1}d_{k+2}... $$ where $10^ka=bc_k+r_k$ and $r_k\in\{0,1,...,b-1\}$ is the remainder after the division $10^ka/b$. Therefore $$ \frac{r_k}{b}=0.d_{k+1}d_{k+2}... $$ Now since $r_k$ can only assume finitely many values (this is essentially the apllying pigeonhole principle) the remainder and thus the decimal expansion will eventually repeat itself so that $r_k=r_m$ for some $k<m$. Thus $$ 0.d_{k+1}d_{k+2}...=0.d_{m+1}d_{m+2}... $$ showing that the decimal expansion is periodic with period $m-k$.

share|cite|improve this answer

Since you just wanted the answer here it is: Proof that every repeating decimal is rational I had to figure it out to answer a Project Euler problem, the principle is the same as the other answers.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.