As you may remember from school, rational numbers have a terminating or eventually repeating (*periodic*) decimal expansion, whereas irrational numbers don’t. So, for example, 0.123123123123…, with 123 repeating forever, is rational (in fact, it is equal to 41/333), whereas something like 0.123456789101112131415…, which will never repeat, is irrational.

But do you know *why* this is true? (Despite what your teachers may have told you, the most important question in mathematics is not *how*, it is *why*!) Today I will show why every rational number has a terminating or eventually repeating decimal expansion, and in a future post I will show why every repeating or terminating decimal expansion represents a rational number. From these two pieces of information, of course, we can also deduce that every decimal expansion which *doesn’t* terminate or repeat must represent an *irrational* number, and vice versa.

First, what is a decimal expansion? By convention, we use place notation to give each digit a value based on a negative power of ten. In particular,

(Here’s an explanation of sigma notation if you don’t know what the means.) For example, recalling that ,

Now, how can we convert a rational number, represented as a fraction , into a decimal representation? The answer, of course, is to use long division to divide *p* by *q*, extending *p* with zeros after the decimal point as necessary.

Consider performing the division . At each step in the division, we are left with a remainder. This remainder, of course, will always be a value between 0 and *(q-1)*, inclusive (if the remainder were larger, it would mean that the quotient we wrote on top was too small). If the remainder is ever zero, then we are done: the decimal representation terminates. If we never get zero as a remainder, the fact that there are only a finite number of possible remainders means that at some point, we must get a remainder that we already got before. But this means that the quotient will now repeat: since we are only bringing down zeros from the dividend, the remainder exactly determines the next digit in the quotient, which determines the next remainder, and so on.

As an example, consider finding the decimal expansion of the rational number 3/7:

It should be clear from the example that after reaching a remainder of 3 for the second time that the quotient will start repeating: 3/7 = 0.428571428571428571…

Therefore, the decimal representation of any rational number will either terminate, or eventually become periodic. (As a bonus challenge, can you figure out how to tell the difference between rational numbers whose decimal expansion terminates, and those whose expansion repeats?) Note that we also know something else: since there are only (*q*-1) possible non-zero remainders when dividing by *q*, the repeating portion of the decimal expansion of a rational number with a denominator of *q* can be at most (*q*-1) digits long. It could be shorter, but it can’t be any longer. You can also look at this in reverse; for example, if you see a periodic decimal whose repeating portion is ten digits long, you know that the rational number it represents must have a denominator of at least 11.

One more thing to note is that a “terminating” decimal can also be thought of as being followed by an infinite sequence of zeros. So in this sense, even “terminating” decimals are actually periodic.

Next time, I’ll show why the converse is also true: any terminating or repeating decimal represents a rational number. Maybe you can try to figure this out for yourself in the meantime!

I’ve been fascinated at how any multiple of 1/7 that’s not an integer repeats the same digits in decimal expression, only starting at different points in the sequence:

1/7 = .142857…

2/7 = .285714…

3/7 = .428571…

4/7 = .571428…

5/7 = .714285…

6/7 = .857142…

Yup! Do you see why, now? Also, it turns out that there’s nothing particularly special about 7: try experimenting with other denominators, such as, say, 17. I hope to write about this in more detail in a future post.

Not really. I mean, why doesn’t the same hold true for, say, 11?

Well, instead of answering you I think I’ll just write about this in my next post. =)

What is the exact decimal equivalent of 3922632451/729 ?

I know it MUST either terminate or repeat, but I cannot find a calculator that will give me enough decimal places to determine the exact decimal equivalent.

Hi David,

I can imagine you would have trouble finding a calculator with enough precision! In general the repeating period could be up to 728 digits long — although it turns out to be only 81 digits:

3922632451/729 = 5380840.[124828532235939643347050754458161865569272976680384087791495198902606310013717421]

I computed this using a little computer program that I wrote previously (it’s not hard in principle — just do long division, keep track of the remainders along the way, and stop when you see a remainder you’ve seen before). But in general you might want to check out sagenb.org — it lets you use the powerful open-source Sage mathematics package via a web interface! I don’t know the exact Sage commands you would use but I’m absolutely certain that it can compute arbitrary-precision decimals.

I find this all very interesting! To answer your question about whether a fraction’s decimal expansion will repeat or terminate, a fraction will terminate if and only if the prime factorization of the denominator is made up entirely of 2′s and 5′s. This is unsurprising, because 2 X 5 = 10.

Pingback: Decimal expansion zoo « The Math Less Traveled

Pingback: More on decimal expansions « The Math Less Traveled