why do rational numbers have repeating decimals?
#math #numbertheory
My younger brother is learning about the relationship between decimals and fractions right now. Of course, some fractions (i.e. only powers of 2 and 5 in the denominator) have nice and intuitive decimal representations (think $1/4 = 0.25$), but he's just learning about repeating decimals.
This led me to a thought: why do rational numbers have repeating decimals? We define irrational numbers as numbers whose decimal representations never end and never repeat^{1}. I wonder why rational numbers repeat?
It wasn't quite as interesting as I'd hoped, but here's an outline of the proof:
 We use the traditional long division technique, adding a whole bunch of 0's after the decimal point
 We note that each digit that's spit out by the division depends only on the previous number
 Using Pigeonhole we can prove that the decimal either ends at some point or repeats
Proof time? Proof time.
We wish to show that any $x \in \mathbb{Q}$ has a decimal representation that, at some point, becomes periodic.
Consider a rational number of the form $p/q$, with $p, q \in \mathbb{N}$. We may use the standard long division algorithm to compute the decimal representation. This generates a sequence of digits in the decimal representation, computed one digit at a time. Let this sequence be $d_0, d_1, d_2 \dots$ starting from the decimal point. Thus
Note that this sequence is computed using long division, so each term depends only on the previous term (after a certain point in the division $n>n_0$, since $p$ and $q$ are finite). Therefore, the sequence $(d_n)$ is fully determined in one direction by the first digit computed. However, we have that $d_i \in \mathbb{N}$ and $0\le d_i \le 9$, so there are finitely many possible values in the sequence. However, the sequence is infinitely long (note that we consider $0.25$ and other seemingly "finitely long" decimals to be represented as $0.25000\dots$). Thus there exists $d_i = d_{i+j}$ for some $j>0$, by the Pigeonhole Principle.
Since any term in the sequence is determined from the previous term, then it follows that $d_{i+1} = d_{i+j+1}$. By induction, this implies that, for any $n \ge i$,
hence the sequence eventually becomes periodic. $\blacksquare$
An interesting point to be made here is that this argument is the exact same for any integer base $b$. This lends itself to certain applications like powers of $2$ times $\pi$; you can always multiply by 2 to the point where you have a 0 to the immediate right of the decimal point, and similarly for 1. In fact, you can do this in infinitely many ways, since there are infinitely many 1's and 0's. Just some food for thought:)
Footnotes

I vividly remember arguments where my friends just could not accept that $\pi$ never repeated. It led to the loss of recesses and paper, seeing as they tried writing all the digits until it repeated. Oh, to be young again... ↩