Web Rarely

Once a word has been allowed to escape, it cannot be recalled. -- Quintus Horatius Flaccus (Horace)

Converting repeating decimal numbers into proper fractions

2015-09-17

Last night while lying in bed, I was thinking about how to convert repeating decimal numbers into proper fractions. For instance 4/7 = 0.571428. But if you see 0.571428, how can you turn it back into 4/7? (Remember, 0.571428 = 0.571428571428...) So I divided out 1/7 through 6/7 and interestingly they all have the same repeating digits (0.142857, 0.285714, 0.428571, 0.571428, 0.714285, and 0.857142, which are rotations of each other), but that didn't help me. (I've seen that rotation pattern with other numbers as well. It's fairly clear why it happens, but that's a digression.)

So I thought about the simplest case: 0.1. Now if we want to convert this into a fraction p/q = 0.1, then we have q/p = 1 / 0.1. (I just tried this on a hunch.) Doing the division the long way, we figure that the first digit of the quotient is 9. Then we subtract 9 x 0.1 = 0.9, and since 1 - 0.9 = 0 (because 0.9 = 1), we're done and the quotient is 9. Thus, q/p = 9 and p/q = 1/9. And indeed, 1/9 = 0.1. And since 0.2 = 0.1 x 2, 0.2 must equal 2/9. And in general, 0.X = X/9 for any single digit X.

Then I tried slightly harder cases. What about 0.10? Dividing 1 by 0.10, we again start with 9 in the quotient. That leaves a remainder of 1 - 0.90 = 0.09. (1 - 0.90 = 0.10, but then we have to borrow for the 0.0090, so we get 0.0910, but then we borrow for the 0.000090, and get 0.090910, and this pattern continues.) Then, continuing the division, 0.09 / 0.10 is "obviously" 9/10, so the full quotient is 9 and 9/10ths, or 99/10. That's q/p, and we invert it to get p/q: 10/99. And indeed, 10/99 = 0.10. I also tried 0.12 and got an answer of 4/33, which was correct.

So I had successfully converted several simple repeating numbers into fractions but wasn't confident that I could convert any repeating number through this method. I next tried 0.123 and after dividing got a quotient of 8.12195. That didn't look like an improvement! I could have tried inverting 0.12195, but I really had to get to sleep. I did it after waking up and got 41/5, and that inverts to 5/41, so the full quotient for 0.123 is 8 and 5/41sts, which is 333/41, so 0.123 therefore equals 41/333. I got the answer, but I still wasn't sure that the process would always terminate in a reasonable or even finite amount of time.

Then I saw the pattern! And a quick test through the division method confirmed that 0.01 = 1/99. Thus any two-digit repeating fraction 0.XY = XY/99! That fit: 0.12 = 4/33 = 12/99. And any three-digit repeating fraction is that number over 999, et cetera. (A quick check: 0.123 = 41/333 = 123/999.) So back to the original question, we can see that 0.571428 must simply be 571428/999999. But wait, does that really equal 4/7? 999999 is divisible by 7? Turns out it is. If 571428/999999 = 4/7, then 1/7 = (571428/4)/999999 = 142857/999999, and indeed, 999999/142857 = 7. So it's right. That must mean that every nonzero integer that could be the denominator in a fraction with an infinite decimal expansion evenly divides some number comprising one or more nines followed by zero or more zeros. That in itself is a rather interesting result. For instance 26 and 42 and 54 and 77 and most(?) other two-digit numbers all evenly divide 9999990. (9999990/26 = 384615 and 1/26 = 0.0384615 = 384615/9999990.)

For completeness, there are also repeating decimal numbers with some non-repeating portions. 1/26 = 0.0384615 was given as an example above. But these are easy once you have the repeating part figured out, since in general any nonnegative repeating decimal number W.ABXY equals W + (AB + XY / (10len(XY)-1)) / 10len(AB) (where len(x) is the number of digits in x). That looks complicated, but it's fairly simple. (It follows from the fact that 12.345 = 12 + 3 x 10-1 + 45 x 10-3.) Consider 2.3461538. We have W = 2, AB = 3 and XY = 461538, and len(3) = 1 and len(461538) = 6. So the whole thing is 2 + (3 + 461538 / (106-1)) / 101 = 2 + (3 + 461538 / (1000000-1)) / 10 = 2 + (3 + 461538/999999) / 10 = 2 + 3/10 + 461538/9999990 = 23461515/9999990 = 61/26. So 2.3461538 = 61/26. If the number is negative, use the absolute value and negate the result. And that's how ya dos it!

P.S. Now, what makes the all-nines denominator so special? Why all nines and not some other number? (Any zeros at the end are just to shift the result over, and can be ignored here.) After thinking about it for a short time, what I've been able to come up with is this:

  • First, if we accept that 0.9 = 1, which it does, then any number like 0.1 or 0.01 or 0.001 can be produced like so. Take 0.001. This is 0.999/999 = 0.9/999 = 1/999. Then 0.123 = 0.001 * 123 = 1/999 * 123 = 123/999. So the all-nines denominator might be somehow connected to the ambiguity in rendering real numbers into digits that causes every number with a finite representation (like 2) to also have a representation that ends in an infinite string of nines (like 1.9).
  • Second, we can think of a number like 0.123 as equaling 123/103 + 123/106 + 123/109 + ... = 0.123 * (1/100 + 1/103 + 1/106 + ...) = 0.123 `xx sum_(n=0)^oo 1/10^(3n)`. We can convert the infinite series into its standard geometric form, `sum_(n=0)^oo ar^n` , by taking a = 1 and r = 1/1000. Then the solution is a / (1-r) = 1 / (1 - 1/1000) = 1/0.999. Multiplying by 0.123 gives us 0.123/0.999 = 123/999. Also, `sum_(n=1)^oo 1/10^(3n)` = `sum_(n=0)^oo 0.001/1000^n` = 0.001 / (1 - 1/1000) = 0.001/0.999 = 1/999. So the all-nines denominator can be thought of as the sum of the infinite series of powers of 10 used to take a number like 123 and infinitely replicate it in the repeating decimal fraction, shifted over by 3 digits each time.

Comments

No comments yet.

Add a comment

Note: The information you enter (including your name and email address) will be displayed publicly.




Line breaks are converted to <br>'s, and all HTML tags except b, u, i, tt, and pre are filtered out.