Is there any formal algorithm to format decimal fraction (for example, $0.110\overline{25}$) as proper rational fraction $\frac mn$ ?
-
1What do you mean by: 0,110(25)? – Jul 26 '13 at 18:08
-
@DannyCheuk I think he means (in English notation) $0.110\overline{25}$ – Thomas Andrews Jul 26 '13 at 18:08
-
Thanks, thomas! @demas, here: http://math.stackexchange.com/questions/295195/h0w-t0-prove-that-periodic-decimal-numbers-are-rational-a-1-a-kb-1b-2-b-l – Jul 26 '13 at 18:10
-
http://math.stackexchange.com/questions/379330/repeating-decimals/379355#379355 – Kaster Jul 26 '13 at 18:10
-
Yes, thanks. I have even known that it have different notation... – ceth Jul 26 '13 at 18:10
3 Answers
Here's a nice trick: if you want a repeating decimal, put the sequence of digits over $9$s. So, for example: $$ 0.\overline{123}=\frac{123}{999}=\frac{41}{333} $$ For your example, we would note that $$ 0.\overline{25}=\frac{25}{99} $$ Divide it by $1000$ to move it over three decimal points to get $$ 0.000\overline{25}=\frac{25}{99000} $$ Finally, add $0.11$ to get $$ \begin{align} 0.110\overline{25}&= \frac{110}{1000}+\frac{25}{99000}\\ &= \frac{11}{100}+\frac{25}{99000}\\ &= \frac{11\times990+25}{99000}\\ &= \frac{10915}{99000}\\ &= \frac{2183}{19800} \end{align} $$ Any rational number can be similarly reduced. Begin by finding the repeating part, shift it over, then add the initial terminating decimal.
If you're looking for how computers do this with only however many digits, this is a good place to start looking.
An "explicit algorithm" to express any sequence of digits $0.a_1a_2\dots a_n\overline{b_1b_2\dots b_m}$ as a fraction would be as follows:
We know (following the above process) that the expression will be $$ \frac{b_1b_2\cdots b_m}{\underbrace{99\cdots 9}_{m}\underbrace{00\cdots 0}_{n}} + \frac{a_1a_2\cdots a_n}{10^n} $$ We can explicitly write that first denominator as $$ \begin{align} \underbrace{99\cdots 9}_{m}\underbrace{00\cdots 0}_{n} &= 10^n\times(\underbrace{99\cdots 9}_{m})\\ &=10^n\times(1\underbrace{00\cdots 0}_{m}-1)\\ &= 10^n\times(10^m-1) \end{align} $$ So, we could always write the fraction as $$ \frac{b_1b_2\cdots b_m+(10^m-1)\times a_1a_2\cdots a_n}{10^n\times(10^m-1)} $$
From there, it's just a matter of reducing the fraction.

- 225,327
-
This suggests an algorithm. I think this answer would end up more useful if the algorithm got made explicit. – Doug Spoonwood Jul 26 '13 at 18:36
-
I presume your example is $0.110\overline{25}$, where the overline represents the repeat. Let $x=0.110\overline{25}$. Then $100x=11.0\overline{25}$, so $99x=11.025-.110=10.915, x=\frac {10.915}{99}=\frac {10915}{99000}=\frac {2183}{19800}$ reduced to lowest terms. I chose $100=10^2$ to multiply by because the repeat had length $2$, so the "infinite tail" would subtract off.

- 374,822
$$0.110\overline{25}=0.110+\frac1{1000}\cdot .\overline{25} $$
Now, let $y=.\overline{25}=.2525\cdots$
$\implies 100y=25.2525\cdots$
On subtraction, $100y-y=25\implies y=\frac{25}{99}$
$\implies 0.110\overline{25}=0.110+\frac1{1000}\cdot .\overline{25}=\frac{11}{100}+\frac1{1000}\cdot\frac{25}{99}=\frac{11}{100}+\frac1{40\cdot99}=\frac{11\cdot2\cdot99+5}{200\cdot99}=\frac{2183}{19800}$

- 274,582