# Converting sums of square-roots to nested square-roots

When solving different equations, I have realised, that some roots containing only arithmetic operations and square roots (4th, 8th roots too, because they can be represented using only square roots) can be converted to nested square roots form. Examples (these are roots of equations of 2nd, 4th, 4th and 8th degree): $$\sqrt{2}+\sqrt{3}=\sqrt{5+\sqrt{24}}$$ $$\sqrt{2}+\sqrt{3}+\sqrt{6}=\sqrt{15+\sqrt{160+\sqrt{6912+\sqrt{18874368}}}}$$ $$1+\sqrt{2}+\sqrt{3}+\sqrt{6}=\sqrt{21+\sqrt{413+\sqrt{4656+\sqrt{16588800}}}}$$ $$\sqrt{2}+\sqrt{3}+\sqrt{5}=\sqrt{14+\sqrt{140+\sqrt{4096+\sqrt{8847360}}}}$$ However, I have failed to convert to such form following root (8th degree equation): $$3+\sqrt{2}+\sqrt{3}+\sqrt{5}$$ Performing any operations with it, number of square roots inside increases, what makes me think that converting that root is impossible.

So, question: Can it be done with that root and with what roots in general?

Some forms I was able to get: $$\sqrt{19+6 \sqrt{2}+6 \sqrt{3}+6 \sqrt{5}+2 \sqrt{6}+2 \sqrt{10}+2 \sqrt{15}}$$ $$\sqrt{19+2\left(\sqrt{33+6 \sqrt{30}}+\sqrt{37+6 \sqrt{30}}+\sqrt{51+6 \sqrt{30}}\right)}$$

If one don't know how I got those expressions, here you are an example.

$$\sqrt{2}+\sqrt{3}+\sqrt{5}=\sqrt{\left(\sqrt{2}+\sqrt{3}+\sqrt{5}\right)^2}=$$ $$=\sqrt{10+2 \left(\sqrt{15}+\sqrt{6}+\sqrt{10}\right)}=\sqrt{10+2 \left(\sqrt{15}+\sqrt{\left(\sqrt{6}+\sqrt{10}\right)^2}\right)}=$$ $$=\sqrt{10+2 \left(\sqrt{15}+\sqrt{16+4 \sqrt{15}}\right)}=\sqrt{10+2 \left(\sqrt{15}-a+a+\sqrt{16+4 \sqrt{15}}\right)}=$$ $$=\sqrt{10+2a+2 \left(\sqrt{\left(\sqrt{15}-a\right)^2}+\sqrt{16+4 \sqrt{15}}\right)}=$$ $$=\sqrt{10+2a+2 \left(\sqrt{15+a^2-2a \sqrt{15}}+\sqrt{16+4 \sqrt{15}}\right)}=$$ $$[2a=4 \Rightarrow a=2]$$ $$=\sqrt{14+2 \left(\sqrt{19-4\sqrt{15}}+\sqrt{16+4 \sqrt{15}}\right)}=$$ $$=\sqrt{14+2 \sqrt{\left(\sqrt{19-4\sqrt{15}}+\sqrt{16+4 \sqrt{15}}\right)^2}}=$$ $$=\sqrt{14+2 \sqrt{35+4 \sqrt{16+3 \sqrt{15}}}}=\sqrt{14+\sqrt{140+\sqrt{4096+\sqrt{8847360}}}}$$

• do you want to $3+\sqrt{2}+\sqrt{3}+\sqrt{5}$? I don't fully understand the question.
– Guy
Mar 20, 2014 at 18:01
• Yes, I can't convert it to nested square roots form. Mar 20, 2014 at 18:02
• Okay, this will be interesting.
– Guy
Mar 20, 2014 at 18:05
• It might, because none of methods I used to get those nested square roots work. Mar 20, 2014 at 18:08
• A little-bit off topic, but you can find a lot of paper about Ramanujan's works on nested radicals. For example this one, or this, or this, or this, etc. Aug 27, 2014 at 15:59

All difference between numbers of the form $$x=a+b\sqrt{2}+c\sqrt{3}+d\sqrt{5}\qquad\qquad (a,b,c,d\in\mathbb{Z}_+)$$ and $$y=a+b\sqrt{2}+c\sqrt{3}+d\sqrt{6}\qquad\qquad (a,b,c,d\in\mathbb{Z}_+)$$ is that their powers can be written (uniquely) as $$x^p = k_{p1} + k_{p2}\sqrt{2} + k_{p3}\sqrt{3} + k_{p4}\sqrt{5} + k_{p5}\sqrt{6} + k_{p6}\sqrt{10} + k_{p7}\sqrt{15} +k_{p8}\sqrt{30}, \tag{1}$$ but $$y^p = l_{p1} + l_{p2}\sqrt{2} + l_{p3}\sqrt{3} + l_{p4}\sqrt{6}, \tag{1'}$$ where $k_{pj}\in\mathbb{Z}_+$, $l_{pj}\in\mathbb{Z}_+$.

If one want to write $x$ in the form of nested radicals $$x=\sqrt{a_1+\sqrt{a_2+\sqrt{...+\sqrt{a_{n-1}+\sqrt{a_n}}}}},$$

then $x$ is the root of the polynomial of $2^n$-th degree $$P(x) = \left(\left(\left(x^2-a_1\right)^2-a_2\right)^2-\cdots-a_{n-1}\right)^2-a_n,$$ $$P(x) = x^{2^n} + p_{2^{n-1}-1}(a_1,...,a_n)x^{2^n-2}+\cdots + p_1 (a_1,...,a_n)x^2 + p_0(a_1,...,a_n),$$ $$P(x) = \sum_{j=0}^{2^{n-1}} p_{j}(a_1,...,a_n)x^{2j},$$ where $p_{j}(a_1,...,a_n)$ are polynomials of $a_1,...,a_n$ with integer coefficients.

Let's split polynomial $P(x)$ into $8$ linear (rational) independent parts:

$$P(x) =\\ 1\cdot \sum_{j=0}^{2^{n-1}}p_j(a_1,...,a_n)k_{2j,1} \\ + \sqrt{2} \cdot \sum_{j=0}^{2^{n-1}}p_j(a_1,...,a_n)k_{2j,2} \\ + \sqrt{3} \cdot \sum_{j=0}^{2^{n-1}}p_j(a_1,...,a_n)k_{2j,3} \\ + \sqrt{5} \cdot \sum_{j=0}^{2^{n-1}}p_j(a_1,...,a_n)k_{2j,4} \\ + \cdots \\ + \sqrt{30} \cdot \sum_{j=0}^{2^{n-1}}p_j(a_1,...,a_n)k_{2j,8}.\tag{2}$$

Sum in each row must be equal to $0$.

But each sum as polynomial of $a_1,...,a_n$ depends on $n$ integer variables/values.

$8$ (non-linear) equations for $n$ values.

There must be very lucky coincidence if $4$ variables $a_1,a_2,a_3,a_4$ will support all $8$ equations.

I think, there must be $8$ nested radicals here to provide as many "free" variables $a_1,...,a_n$:

$$a+b\sqrt{2}+c\sqrt{3}+d\sqrt{5} = \sqrt{a_1+\sqrt{a_2+\sqrt{...+\sqrt{a_7+\sqrt{a_8}}}}}.$$

It is hard to find such form at all.

Note: if $x$ is of the form $$x = b\sqrt{2}+c\sqrt{3}+d\sqrt{5},$$ then (see $(1)$) $$x^{2j} = k_{2j,1}+k_{2j,5}\sqrt{6}+k_{2j,6}\sqrt{10}+k_{2j,7}\sqrt{15},$$ (coefficients near $\sqrt{2},\sqrt{3},\sqrt{5},\sqrt{30}$ are $0$), so there are only $4$ rows in $(2)$.

A few examples of radicals of such form:

$$\sqrt{2}+\sqrt{3}+\sqrt{7} = \sqrt{16+\sqrt{180+\sqrt{10\;496 + \sqrt{34\;406\;400}}}},$$

$$\sqrt{2}+2\sqrt{3}+\sqrt{5} = \sqrt{23+\sqrt{392+\sqrt{77\;824+\sqrt{3\;538\;944\;000}}}},$$

$$3\sqrt{2}+\sqrt{3}+\sqrt{5} = \sqrt{32+\sqrt{672+\sqrt{229\;824+\sqrt{11\;943\;936\;000}}}}.$$

• Just letting you know, I can prove that $3+\sqrt{2}+\sqrt{3}+\sqrt{5}$ can't be represented with 4 or less nested radicals. So I will try to find it with 8 roots, however numbers will be so big, that I don't know if my computer will find solution in reasonable time. Aug 28, 2014 at 8:15
• @Somnium, yes, I think it must be huge work. Each next $a_j$ is product of $2$ in high powers. And search can be (maybe) simplified if use alternative form of nested radicals: $$\sqrt{14+\sqrt{140+\sqrt{4096+\sqrt{8847360}}}} = \sqrt{14+2\sqrt{35+4\sqrt{16+3\sqrt{15}}}},$$ $$\sqrt{32+\sqrt{672+\sqrt{229824+\sqrt{11943936000}}}} = \sqrt{32+2\sqrt{168+6\sqrt{399+60\sqrt{10}}}}.$$ Aug 28, 2014 at 12:07
• I even failed to prove that form with 5 radicals do not exist - not enough memory. Aug 28, 2014 at 19:52

Writing a number $\alpha$ in this nested square root form $$\sqrt{a_1+\sqrt{a_{2}+\sqrt{...\sqrt{a_n}}}} \; \; (1)$$ implies that $\alpha$ satisfies the equation $$(((x^2-a_1)^2-a_2)^2...)^2-a_n = 0 \; \; (2)$$ where the $a_i$ are integers. In fact, allowing both values for the square root, the numbers of the form (1) are precisely those satisfying equation (2).

Expanding out (2), we find that it is a monic polynomial in $x^2$ of degree $2^{n-1}$ with integer coefficients. For $n \ge 3$, the polynomial will have more than $n$ coefficients after the first, so these cannot be freely specified via choosing $a_1,...,a_n$. We do get, however, that if number $\alpha$ can be written in the form (1) then $\alpha^2$ is a root of a monic integer polynomial of degree $2^k$ for some $k \in \{0,1,2,...\}$.

If you generalise the form to $$a_1+\sqrt{a_2+\sqrt{a_{3}+\sqrt{...\sqrt{a_n}}}} \; \; (1*)$$ then the necessary condition becomes that $\alpha$ itself is a root of such a polynomial.

Roots of monic integer polynomials (of any degree) are called algebraic integers. See http://en.wikipedia.org/wiki/Algebraic_integer

• You write "a number $\alpha$ can be written in the form $(1)$ if and only if $\alpha$ is a root of a monic polynomial of degree $2^k$…" The implication only goes one way. If $\alpha$ is of the form $(1)$, then it is the root of such a polynomial. But every algebraic integer is a root of some integer polynomial of degree $2^k$: Take $f(x)$ to be the minimal polynomial and then look at $x^{2^k-\deg f} f(x)$ for $k$ large enough. $(1)$ implies more strongly that the minimal polynomial is degree $2^k$, and the Galois group is a $2$-group, but this doesn't help either ... Aug 13, 2014 at 16:09
• because any element of the field $\mathbb{Q}(\sqrt{2}, \sqrt{3}, \sqrt{5})$ obeys those conditions. We need some test which can prove that a number $\alpha$ is not a nested square root, even though the field $\mathbb{Q}(\alpha)$ is generated by nested square roots. Aug 13, 2014 at 16:11
• The previous two comments address a previous version of the answer, but I think they are still useful as general warnings. Aug 13, 2014 at 16:12
• I don't fully understand - answer states that if some number $\alpha$ can be written as $(1*)$ then it also can be written as $(1)$? Aug 13, 2014 at 17:37
• @DavidSpeyer Could you explain why (1) implies that the minimal polynomial must be of degree $2^k$? This could be used to show that a given number cannot be expressed in the form (1) (or (1*)). Aug 13, 2014 at 22:56

For any pair $(a,b)$ one can write $$\sqrt{a}+\sqrt{b} = \sqrt{A+2\sqrt{B}},\tag{1}$$ where
$A=a+b$,
$B=ab$.

For any ordered triple $(a,b,c)$, such that $1\le a\le b \le c$, one can write $$\sqrt{a}+\sqrt{b}+\sqrt{c} = \sqrt{A +2\sqrt{B+2\left(\sqrt{p}+\sqrt{q}\right)}} = \sqrt{A + 2\sqrt{B + 2\sqrt{C + 2\sqrt{D}}}},\tag{2}$$

where
$A=3a+b+c$,
$B=(a+b)(a+c)$,
$p = ac(b-a)^2$,
$q = ab(c-a)^2$,
$C = p+q$, (see $(1)$)
$D = pq$.

Note, that
$\sqrt{p} = (b-a)\sqrt{ac}$,
$\sqrt{q} = (c-a)\sqrt{ab}$,
$\sqrt{D} = a (b-a) (c-a) \sqrt{bc}$.

Maybe there is reason to search $\sqrt{a}+\sqrt{b}+\sqrt{c}+\sqrt{d}$ in the form $$\sqrt{a}+\sqrt{b}+\sqrt{c}+\sqrt{d}= \sqrt{A+2\sqrt{B+2\sqrt{C+2\sqrt{D+2\left(\sqrt{p}+\sqrt{q}+\sqrt{r}\right)}}}},\tag{3}$$ and (if success) apply $(2)$ to the sum $\sqrt{p}+\sqrt{q}+\sqrt{r}$.

Here is other approach. I hope it is most helpful.

A.
For any vector $v$ with integer coefficients $$v = (a,b,c,d,e,f,g,h)$$ denote linear combination $$x_v = a+b\sqrt{2}+c\sqrt{3}+d\sqrt{5}+e\sqrt{6}+f\sqrt{10}+g\sqrt{15}+h\sqrt{30}.\tag{1}$$

Values $x_v$ generate ring (all sums, products of them has form $(1)$ etc).

Value $$x_v^2-A$$ has according/appropriate vector with integer coefficients (vector $w=(a',b',c',d',e',f',g',h')$, where its coefficients are defined as $$\begin{array}{l} a'=a^2+2b^2+3c^2+5d^2+6e^2+10f^2+15g^2+30h^2-A;\\ b'=2(ab+3ce+5df+15gh),\\ c'=2(ac+2be+5dg+10fh),\\ d'=2(ad+2bf+3cg+6eh),\\ e'=2(ae+bc+5fg+5dh),\\ f'=2(af+bd+3eg+3ch),\\ g'=2(ag+cd+2ef+2bh),\\ h'=2(ah+bg+cf+de).\tag{2} \end{array}$$

So, one can define vector transformation $$w = T(v,A),\tag{3}$$ described by $(2)$.

B.
If there is representation $$3+\sqrt{2}+\sqrt{3}+\sqrt{5}=\sqrt{A_1+\sqrt{A_2+\sqrt{A_3+...+\sqrt{A_{n-1}+\sqrt{A_n}}}}},\tag{4}$$ then for vector $v_0=(3,1,1,1,0,0,0,0)$ exist these transformations:

$$v_1=T(v_0,A_1),\\ v_2=T(v_1,A_2),\\ ...\\ v_n=T(v_{n-1},A_n),\tag{5}$$ where $v_n$ iz zero-vector: $v_n=(0,0,0,0,0,0,0,0)$.

C.

Now, apply modular arithmetic to $(2), (3), (5)$.

For $m\in\mathbb{N}$ denote transformation

$$z = T_m(v,A),\tag{3'}$$ where $z=(a'\bmod m, ~ b'\bmod m, ~ c'\bmod m, ... , ~ h'\bmod m)$, and $a',b',c',...,h'$ are defined in $(2)$.

If there exist transformations $(5)$ converting $v_0=(3,1,1,1,0,0,0,0)$ to $v_n=(0,0,...,0)$, then for any $m\in\mathbb{N}$ must exist transformations

$$z_1=T_m(v_0,A_1),\\ z_2=T_m(z_1,A_2),\\ ...\\ z_n=T_m(z_{n-1},A_n),\tag{5'}$$

where $z_n=(0,0,0,0,0,0,0,0)$.

D.

For $n=4$ ($4$ nested rdicals), if we choose $m=5,7,10,11,...$, then for $0\le A_1,A_2,A_3,A_4 <m$ value $z_4$ cannot be zero-vector.

For $n=5$ one can use $m=11,13,17,19,...$ to see that $z_5$ cannot be $\vec{0}$.

For $n=6$ one can use $m=31, 41, 43, 47, ...$ to see that $z_6$ cannot be $\vec{0}$.

So, must be at least $n\ge 7$ radicals. (I'll update this answer after checking $n=7$).

How D is working (temporary part):

Example for $n=5$, $m=11$:

starting vector is (a[0]=3,b[0]=1,c[0]=1,d[0]=1,e[0]=...=h[0]=0)

I need to check if there is sequence $A[0],...,A[4]$ that generates (0,0,0,0,0,0,0,0).

It can be used "as is", or more smart:
if there is sequence $A[0], ..., A[2],A[3]$ that generates vector (a,b,c,d,e,f,g,h), where $a$ can be nonzero; or even so:
if there is sequence $A[0], ..., A[2]$ that generates vector (a,b,c,d,e,f,g,h), where $a$ can be nonzero and one of $b,c,d,e,f,g,h$ is nonzero too.

If apply some modulo $m$, then each $A[j]$ is equivalent to $0$ or $1$ or $2$ or ... or $m-1$.

Then test:

for A[0]=0,1, ..., m-1
for A[1]=0,1, ..., m-1
for A[2]=0,1, ..., m-1
{
a[1] =  (a[0]*a[0]+ 30*h[0]*h[0] - A[0]) mod m;
b[1] = 2(a[0]*b[0]+...+15*g[0]*h[0]) mod m;
...
h[1] = 2(a[0]*h[0]+...+d[0]*e[0]) mod m;

a[2] =  (a[1]*a[1]+ 30*h[1]*h[1] - A[1]) mod m;
b[2] = 2(a[1]*b[1]+...+15*g[1]*h[1]) mod m;
...
h[2] = 2(a[1]*h[1]+...+d[1]*e[1]) mod m;

and
a[3], b[3],   ...,  h[3] same way;

and
a[4], b[4],   ...,  h[4] same way, but use 0 instead of A[3];

then check if only one of b[4],c[4],...,h[4] is nonzero (say d[4]);
if "yes", then success (possible solution);
then A[3] = a[4], and A[4] is based on this last non-zero term (like d[4]);
}

• Nice approach, and modular arithmetic in computer is much faster than non-linear equations system solving. Sep 9, 2014 at 17:45
• Can you please describe D part in more details, I don't understand how do you check. Sep 11, 2014 at 8:43
• @Somnium, I described shortly in updated answer. Sep 11, 2014 at 14:01
• I wrote C++ program wihich performs this check. I have checked for $n=7$ modulus $2\leq m\leq 138$ and found no counterexamples. Maybe $m=139$ will be counterexample because it's running too long... Jan 16, 2016 at 11:54

If you have something of the form $\sqrt{a+\sqrt b}$, it can be denested as follows:

$\sqrt c+\sqrt d=\sqrt{(\sqrt c+\sqrt d)^2}=\sqrt{(c+d)+2\sqrt{cd}}=\sqrt{(c+d)+\sqrt{4cd}}=\sqrt{a+\sqrt b}$

So we have $c+d=a,cd=\frac b4$. $c$ and $d$ are therefore the solutions of $x^2-a x+\frac b4=0$. A similar process works for $\sqrt{a-\sqrt b}=\sqrt c-\sqrt d$. If the roots are rational, you have denested the square.

Similarily, for something like $\sqrt{w+\sqrt x+\sqrt y+\sqrt z}$, we have

$\sqrt a+\sqrt b + \sqrt c=\sqrt{(\sqrt a+\sqrt b + \sqrt c)^2}=\sqrt{(a+b+c)+\sqrt{4ab}+\sqrt{4ac}+\sqrt{4bc}}$, so we have $a+b+c=w,ab+ac+bc=\frac{x+y+z}{4},abc=\frac{\sqrt{xyz}}{8}.$ So $a,b,c$ are solutions of the cubic equation $u^3-wu^2+\frac{x+y+z}{4}u-\frac{\sqrt{x y z}}{8}=0$. For example,$\sqrt{10+2 \left(\sqrt{15}+\sqrt{6}+\sqrt{10}\right)}=\sqrt{10+ \sqrt{60}+\sqrt{24}+\sqrt{40}}$, has the corresponding cubic equation $u^3-10u^2+31u-30=0$, with roots $u=2,3,5$, so $\sqrt{10+2 \left(\sqrt{15}+\sqrt{6}+\sqrt{10}\right)}=\sqrt 2+\sqrt 3+\sqrt 5$.

Do you get how to do this? In general, if you have a square root with $\frac{n (n-1)}{2}$ square roots under it for some integer $n$, and exactly $1$ rational number, you can rewrite is as a sum of $n$ square roots. By squaring it and square rooting, you can equate various components, and possibly manipulating them (as done with the cubic coefficients), you can use Vieta's formulas to determine an $n$th degree polynomial whose roots determine how to denest it. For something like $\sqrt{14+\sqrt{140+\sqrt{4096+\sqrt{8847360}}}}$, you have to denest the first radical inside, then the next one... etc. You could generalise the result to higher roots than just squares, but I imagine it would be messier. As for when the denesting works, you'd better hope the roots of those polynomials are rational, or otherwise you'll end up with more nested radicals. Otherwise it doesn't have a denested form. Hope this answers your question!

• I need to nest not denest, and I have no idea how I can use this to nest square roots. Aug 10, 2014 at 20:21

The irrational number satisfies the following equation: $$x=3+\sqrt{2}+\sqrt{3}+\sqrt{5}$$ $$x^8-24 x^7+212 x^6-792 x^5+622 x^4+3768 x^3-10140 x^2+8568 x-2151=0$$ Let it be: $$x=\sqrt{a+\sqrt{b+\sqrt{c}}}$$ Now it can be shown that: $$x^8-(8a)x^7+(28a^2)x^6-(56a^3)x^5-(2b-70a^4)x^4+(8ab-56a^5)x^3-(12a^2b-28a^6)x^2+(8a^3b-8a^7)x+(b^2-2a^4b+a^8-c)=0$$ Now: $$(24-8a)x^7+(28a^2-212)x^6-(56a^3+792)x^5-(2b-70a^4-622)x^4+(8ab-56a^5-3768)x^3-(12a^2b-28a^6+10140)x^2+(8a^3b-8568-8a^7-8568)x+(b^2-2a^4b+a^8-c+2151)=0$$ Fint integral values of $a,b,c$ after putting $x=3+\sqrt2+\sqrt3+\sqrt5$.Lot of work :(.

• Using this approach it's possible to only prove that root can't be expressed as 3 nested radicals. There should be more than 4 if possible. Aug 26, 2014 at 14:38