Repeating Decimal expansions are Rational
A lazy afternoon has made me spend some time with math. I figured let me read a theorem and try to write some basic proofs for it. So, let's write a proof for this high school theorem which states that all the rational numbers have terminating or repeating decimal expansions.
Basics
Before getting the hands dirty, let's first discuss some basics. What are rational numbers? In general, a rational number is the ratio of a whole number and a natural number. In other words, a number is rational if it can be expressed in the p/q form, where p is a whole number, q is a natural number, and p∈Z and q∈N. In a simple manner, rational numbers are fractions. They are denoted by Q.
What are decimal expansions? By convention, we use place notation to give each digit a value based on a negative power of ten. In particular,
0.d1d2d3... = i=1∑∞10-idi
For example, 0.1624 = 1/10 + 6/100 + 2/1000 + 4/10000 + ...Now, how can the rationals be expressed as decimals? The answer, of course, is to use long division to divide p by q, extending p with zeroes after the decimal point as necessary.
Theorem
Any rational number, and only a rational number, has a repeating or terminating decimal expansion. From this, it is straightforward to deduce that every decimal that doesn't repeat or terminate is an irrational number.
Proof
Let's first see the conversion of decimal to fraction. The simplest way to do this is by multiplying the decimal by 10 or 100 or with the power of ten corresponding to the number of repeating digits. We then subtract one copy of the original number which gets rid of the repeating part, and simplifying this would leave us with a fraction.
x = 1.262626...
100x -x = 125
99x = 125
x = 125/99
Here, the question to ponder is, will this work when there are some non-repeating decimals on the right before it starts repeating? In this case, we can simply multiply by a power of ten, and then perform the same steps as above.
x = 1.342222...
10(100x) - (100x) = 132.22...
900x = 1208
x = 1208/900
Now, coming to the formal proof. Let's say there is a repeating decimal i = x.yz̄ where x, y, and z are a group of digits, and we can make the non-repeating and repeating parts separate. To start with, let n = [log10y], the number of digits of y, and multiply by 10n. This now leaves us with 10ni = x.yz̄. Here, if the decimals terminate, then z = 0, and the proof is done. So, now, assume z is not equal to 0 and i = x.z̄.
Now, let's say z has m digits, then multiple 10^m-1, and we are left with an integer, that directly gives us a fraction. So, the series would be as follows
i = x + z + 10-mz + 10-2mz + ...
Now, let's multiply by 10m-1 to get
(10m-1)i = (10m-1)x + (10mz+z+10-mz+...) - (z+10-mz+10-2mz+...)
= (10m-1)x+10mz.
Since, z has m digits, 10mz is an integer. Therefore, i = ((10m-1)x+10mz)/(10m-1), where (10m-1)z+10mz is an integer, and 10m-1 is a natural number, as required.
Another way to prove this, which is quite straightforward, is to do the long division. It's been a long time since I last worked with theorems. It's still fun, as math will always be!