# How do you turn an irrational, non-transcendental number, like 1.618… back to its form of (a + sqrt(b))/c.

Looking at irrational numbers, I had an idea, as to computing square roots. Take the golden ratio. Numerically, it's 1.618.... but I can also write it like this: $$\frac{1+ \sqrt{5}}{2}$$

I want to figure an algorithm that can convert an irrational into the form $$\frac{u+ \sqrt{v}}{w}$$, where $$u, v, w$$ are natural numbers.(If it is possible. I'm only considering square roots for the answer.)

Now if you could, I would love it if you could complete my idea. I believe the given irrational can be a the root of a quadratic (not cubic or higher because I'm only considering square roots) by comparing the form $$\frac{u+ \sqrt{v}}{w}$$to the quadratic equation, if i let the number say, $$n = \frac{u+ \sqrt{v}}{w}$$, i think, if i take another number say $$m = \frac{u- \sqrt{v}}{w}$$ and keeping them as the roots off the quadratic, all the coefficients will be, natural numbers. (I'm not sure if this is 100% true, but I'm confident it is).

This said algorithm is to be coded into a computer, which will take a large number of digits as the input for accuracy.

Thank you.

• Your last sentence begins to address the central issue, how the purported irrational-but-not-transcendental number is to be input into some algorithm. In principle an infinite number of digits may be required to decide the quadratic irrational expression. – hardmath Dec 2 '18 at 7:09
• @hardmath The way i see it, say 30 digits may not get you to (1+sqrt(5))/2 but perhaps 0.9998 + sqrt(4.999)/1.99. (Is this what you meant?) Then I could just round off the numbers. – Anonymous Dec 2 '18 at 7:53
• I think there is the germ of a good problem here. Let me try to sketch it, and you can tell me if you are interested. Your input is a decimal expansion of limited places, so really we have an approximation problem. Any real number can be approximated as closely as we like with numbers of the form you ask about (which is true already with rational numbers, as a special case $v=0$). The best approximation has meaning if we limit the allowed sizes of $u,v,w$. So one might ask to find that best approximation subject to $0 \le u,v,w \le M$ for suitable positive integer $M$. – hardmath Dec 3 '18 at 19:19
• @hardmath I'm sorry for such a late reply. I like your idea but it is incomplete I think. It's been almost a month and I don't have a solution. – Anonymous Dec 29 '18 at 8:44
• Yes, you can take the 30 digits and convert it to a continued fraction, looking for evidence of repeating denominators. Your Question includes no motivation for the problem, so Readers will have little idea about what guarantees "this will work". Perhaps describing the intended application will encourage more suggestions. – hardmath Dec 29 '18 at 14:48

A quadratic irrational will have an eventually periodic continued fraction.

• I'm sorry I didn't quite understand (due to my lack of knowledge). – Anonymous Dec 2 '18 at 7:56
• See e.g. periodic continued fraction – Robert Israel Dec 2 '18 at 15:39
• @RobertIsrael unfortunately I don't think this resolves the question. How would you get from the numerical value to the (infinite!) exact continued fraction in the first place? – YiFan Dec 2 '18 at 22:09
• You don't. But you look at as many terms of the continued fraction as you can get from the decimal places you have, and see if it appears to be periodic. For example, $.645751311 \approx [0;1,1,1,4,1,1,1,4,1,1,1,4,1,1,1,4,2]$. Assuming that last $2$ should actually be $1$, this seems to be $1,1,1,4$ repeated, in which case it is $\sqrt{7}-2$. – Robert Israel Dec 3 '18 at 2:52

As asked the question has no solution. This is simply because, regardless of what numerical value you feed the computer, there will always exist infinitely many approximations to that numerical value of the form $$(u+\sqrt v)/w$$, $$u,v,w\in\mathbb Z$$ up to arbitrarily many digits. For example,

$$\frac{1+\sqrt5}{2}\approx \frac{10^n+\sqrt{5\cdot10^{2n}+1}}{2\cdot10^n}$$

where $$n$$ is a large positive integer. In fact, by making $$n$$ to be arbitrarily big, we can make this approximation to have infinite precision. There's nothing special about the base of the exponential; instead of $$10$$ it can be $$2$$ or $$17$$ or whatever number you like. We could also have in the square root, $$5\cdot10^{2n}+2$$, or $$-1$$, or $$+7$$ instead. We have so many approximations to the same number; even 100-digit precision won't suffice! One way to resolve this issue is to somehow make your program prioritize smaller $$u,v,w$$ in its numerical search, but this doesn't work perfectly.

• I see there's a common factor 10^n on everything, I could make it so to remove the common factor and reduce it as much as possible. – Anonymous Dec 3 '18 at 7:00
• @Anonymous it's very close to having a common factor, but there actually isn't because of the $+1$ under the square root. – YiFan Dec 3 '18 at 7:43