[Math] Convert from decimal to fraction

fractions

I know this sounds silly, and it's easy for many situations. But sometimes i have been completely taken back as i don't know how to do it.

So please tell me is there any way to convert certain numbers into fractions..even with remainder tagging along like 3 1/4 which is 13/4. And if not why is it that certain numbers can't be represented in fraction form.

Also is there way to let's say have number x in decimal form and find a fraction that is most close to it.

Best Answer

Case I: Finite Decimal

Suppose that the decimal is $$.a_1a_2\ldots a_n$$ Then by definition of that notation, the number can be written $$\frac{a_1}{10}+\frac{a_2}{10^2}+\cdots+\frac{a_n}{10^n}$$ You can then combine the fractions and reduce.

Example. $$.18=\frac{18}{100}=\frac{9}{50}$$


Case II: Infinite Repeating Decimal

We already know that the first (finite) non-repeating component may be written as a decimal per the algorithm above. For the repeating part $$.00\ldots 0a_1a_2\ldots a_na_1\ldots a_n\cdots$$ which the sequence $a_1\ldots a_n$ repeated infinitely, we have by the formula $$a+ar+ar^2+\cdots=\frac{a}{1-r}\qquad (|r|<1)$$ that, if there are $m$ zeros initially, $$\begin{align}.0\ldots 0\overline{a_1\ldots a_n}&=\frac{a_1\ldots a_n}{10^{m+n}}+\frac{a_1\ldots a_n}{10^{m+2n}}+\cdots \\ &=\frac{a_1\ldots a_n}{10^{m+n}}\left(1+10^{-n}+10^{-2n}+\cdots\right) \\ &=\frac{a_1\ldots a_n}{10^{m+n}}\left(\frac{1}{1-10^{-n}}\right)\end{align}$$

Example. $$0.333\ldots=\frac{3}{10}\left(1+\frac{1}{10}+\frac{1}{10^2}+\cdots\right)=\frac{3}{10}\left(\frac{1}{1-10^{-1}}\right)=\frac{3}{10-1}=\frac{1}{3}$$


Case III: Infinite Non-Repeating Decimal

These types of numbers are called irrational, and cannot be written as fractions of integers (for example, $\sqrt 2$ has no fractional expression).

However, they can be approximated by fractions to any degree of accuracy needed. A straightforward algorithm for doing this is provided by the theory of the Stern-Brocot tree. It provides the "simplest" approximation which starts with the correct $n$ decimal places.

Example. The decimal expansion of $\pi$ (an irrational number) begins $3.141592653589793\ldots$. Using a computer program, I find that the first few best rational approximations for the decimal part $.141592653589793\ldots$ are $$\begin{align}{1 \over 7} &=0.142... \\ {9 \over 64} &=0.1406... \\ {15\over 106} &=0.14150... \\ {16\over 113}&=0.1415929... \\ &\;\vdots \\ {3612111\over 25510582}&=0.14159265358979267...\end{align}$$