# Patterns in the minimal polynomial of sum of square roots

n = $$1$$: Let the root of $$x+p=0$$ be $$x_1$$.
The minimal polynomial of $$\sqrt{x_1}$$ is $$(x-\sqrt{-p})(x+\sqrt{-p})=x^2+p$$

n = $$2$$: Let the roots of $$x^2+px+q=0$$ be $$x_1,x_2$$.
The minimal polynomial of $$\sqrt{x_1}+\sqrt{x_2}$$ is $$\prod_{\mu_1,\mu_2\in\{\pm1\}}(x-(\mu_1\sqrt{x_1}+\mu_2\sqrt{x_2}))=(x^2+p)^2-4 q$$

n = $$3$$: Let the roots of $$x^3+px^2+qx+r=0$$ be $$x_1,\dots,x_3$$.
The minimal polynomial of $$\sqrt{x_1}+\dots+\sqrt{x_3}$$ is $$\prod_{\mu_1,\dots,\mu_3\in\{\pm1\}}(x-(\mu_1\sqrt{x_1}+\dots+\mu_3\sqrt{x_3}))\\=\left(\left(x^2+p\right)^2-4 q\right)^2+64rx^2$$

n = $$4$$: Let the roots of $$x^4+px^3+qx^2+rx+s=0$$ be $$x_1,\dots,x_4$$.
The minimal polynomial of $$\sqrt{x_1}+\dots+\sqrt{x_4}$$ is (from this post) $$\prod_{\mu_1,\dots,\mu_4\in\{\pm1\}}(x-(\mu_1\sqrt{x_1}+\dots+\mu_4\sqrt{x_4}))\\=(((x^2 + p)^2 - 4 q)^2 + 64r x^2 + 64 s)^2\\- 256 s (3 x^4+2 p x^2-p^2+4 q)^2$$

n = $$5$$: Let the roots of $$x^5+px^4+qx^3+rx^2+sx+t=0$$ be $$x_1,\dots,x_5$$.
The minimal polynomial of $$\sqrt{x_1}+\dots+\sqrt{x_5}$$ is $$\prod_{\mu_1,\dots,\mu_5\in\{\pm1\}}(x-(\mu_1\sqrt{x_1}+\dots+\mu_5\sqrt{x_5}))=f_5(x)^2+t\ g_5(x)^2$$ where $$f_5(x)=((x^2+p)^2-4 q)^2+64 r x^2+64 s\\ -256s(3 x^4+2 p x^2-p^2+4 q)^2\\ -2048t(5 x^6+3 p x^4+7 p^2 x^2-20 q x^2+p^3-4 p q+8 r)$$ and $$g_5(x)=128 x \Biggl(3 x^{10}+9 p x^8+\left(6 p^2+8 q\right) x^6+\left(-6 p^3+40 q p-96 r\right) x^4\\ +\left(-9 p^4+56 q p^2-80 q^2-192 s\right) x^2\\ -3 p^5-48 p q^2+24 p^3 q-32 p^2 r+128 q r-64 p s+256 t\Biggr)$$

n = $$6$$: Let the roots of $$x^6+px^5+qx^4+rx^3+sx^2+tx+u=0$$ be $$x_1,\dots,x_6$$.
The minimal polynomial of $$\sqrt{x_1}+\dots+\sqrt{x_6}$$ is $$\prod_{\mu_1,\dots,\mu_6\in\{\pm1\}}(x-(\mu_1\sqrt{x_1}+\dots+\mu_6\sqrt{x_6}))=f_6(x)^2-u\ g_6(x)^2$$ The degree of $$f_6(x)$$ is $$32$$.
The degree of $$f_6(x)-\left(f_5(x)^2+t\ g_5(x)^2\right)$$ is $$20$$:

8192 u (209 x^20+954 p x^18+2049 p^2 x^16-792 q x^16+3928 p^3 x^14-8384 p q x^14+13824 r x^14+7650 p^4 x^12+32480 q^2 x^12-32480 p^2 q x^12+9600 p r x^12+51072 s x^12+10620 p^5 x^10+95040 p q^2 x^10-61632 p^3 q x^10+23808 p^2 r x^10-109056 q r x^10+106752 p s x^10-82944 t x^10+8714 p^6 x^8-13312 q^3 x^8+116896 p^2 q^2 x^8+30720 r^2 x^8-62032 p^4 q x^8+71296 p^3 r x^8-260608 p q r x^8-99712 p^2 s x^8+518144 q s x^8-201728 p t x^8+854016 u x^8+3864 p^7 x^6-45056 p q^3 x^6+78720 p^3 q^2 x^6+24576 p r^2 x^6-32320 p^5 q x^6+41984 p^4 r x^6+77824 q^2 r x^6-168960 p^2 q r x^6-68096 p^3 s x^6+270336 p q s x^6-49152 r s x^6-231424 p^2 t x^6+393216 q t x^6+466944 p u x^6+813 p^8 x^4+55552 q^4 x^4-48128 p^2 q^3 x^4+26656 p^4 q^2 x^4-24576 p^2 r^2 x^4+245760 q r^2 x^4+724992 s^2 x^4-7776 p^6 q x^4+640 p^5 r x^4-153600 p q^2 r x^4+35840 p^3 q r x^4-58240 p^4 s x^4-206848 q^2 s x^4+294912 p^2 q s x^4-417792 p r s x^4-2048 p^3 t x^4-32768 p q t x^4+49152 r t x^4-331776 p^2 u x^4+1081344 q u x^4+90 p^9 x^2+512 p q^4 x^2-6144 p^3 q^3 x^2+131072 r^3 x^2+4416 p^5 q^2 x^2+32768 p^3 r^2 x^2-131072 p q r^2 x^2+139264 p s^2 x^2-1088 p^7 q x^2+2304 p^6 r x^2+24576 q^3 r x^2+24576 p^2 q^2 r x^2-16896 p^4 q r x^2-14080 p^5 s x^2-102400 p q^2 s x^2+81920 p^3 q s x^2-65536 p^2 r s x^2+32768 q r s x^2+35840 p^4 t x^2+409600 q^2 t x^2-229376 p^2 q t x^2-98304 p r t x^2-327680 s t x^2+172032 p^3 u x^2-720896 p q u x^2+1572864 r u x^2+21 p^10-2048 q^5+7424 p^2 q^4-6144 p^4 q^3+2144 p^6 q^2+2048 p^4 r^2+32768 q^2 r^2-16384 p^2 q r^2+20480 p^2 s^2-32768 q s^2+131072 t^2-344 p^8 q+384 p^7 r-24576 p q^3 r+18432 p^3 q^2 r-4608 p^5 q r+384 p^6 s+16384 q^3 s-2048 p^2 q^2 s-2048 p^4 q s+8192 p^3 r s-32768 p q r s-9216 p^5 t-114688 p q^2 t+65536 p^3 q t-81920 p^2 r t+262144 q r t-65536 p s t+18432 p^4 u+131072 q^2 u-98304 p^2 q u)


The leading term of $$g_6$$ is $$3840 x^{26}$$:

256 (15 x^26+135 p x^24+498 p^2 x^22+24 q x^22+858 p^3 x^20+744 p q x^20-1440 r x^20+165 p^4 x^18-2544 q^2 x^18+5544 p^2 q x^18-10368 p r x^18+17088 s x^18-2475 p^5 x^16-21168 p q^2 x^16+20376 p^3 q x^16-33120 p^2 r x^16+31104 q r x^16+40128 p s x^16+157440 t x^16-5940 p^6 x^14+17664 q^3 x^14-76224 p^2 q^2 x^14-147456 r^2 x^14+44784 p^4 q x^14-62464 p^3 r x^14+159744 p q r x^14-25856 p^2 s x^14+160768 q s x^14+432128 p t x^14+69632 u x^14-7524 p^7 x^12+96000 p q^3 x^12-154560 p^3 q^2 x^12-331776 p r^2 x^12+63504 p^5 q x^12-78400 p^4 r x^12-168960 q^2 r x^12+345600 p^2 q r x^12-139520 p^3 s x^12+388096 p q s x^12+233472 r s x^12+803840 p^2 t x^12-1069056 q t x^12+339968 p u x^12-6039 p^8 x^10-40704 q^4 x^10+211200 p^2 q^3 x^10-191520 p^4 q^2 x^10-184320 p^2 r^2 x^10+147456 q r^2 x^10+1953792 s^2 x^10+59472 p^6 q x^10-69888 p^5 r x^10-528384 p q^2 r x^10+419840 p^3 q r x^10-101760 p^4 s x^10+1017856 q^2 s x^10+25600 p^2 q s x^10-835584 p r s x^10+1271808 p^3 t x^10-3334144 p q t x^10+1818624 r t x^10-3502080 p^2 u x^10+10747904 q u x^10-3135 p^9 x^8-114432 p q^4 x^8+234240 p^3 q^3 x^8+393216 r^3 x^8-145824 p^5 q^2 x^8-40960 p^3 r^2 x^8+98304 p q r^2 x^8+2117632 p s^2 x^8+36144 p^7 q x^8-45248 p^6 r x^8+225280 q^3 r x^8-648192 p^2 q^2 r x^8+328960 p^4 q r x^8+23168 p^5 s x^8+1779712 p q^2 s x^8-558080 p^3 q s x^8-307200 p^2 r s x^8-2375680 q r s x^8+961024 p^4 t x^8+991232 q^2 t x^8-3223552 p^2 q t x^8+1654784 p r t x^8+1998848 s t x^8-4706304 p^3 u x^8+14942208 p q u x^8-9306112 r u x^8-990 p^10 x^6+6144 q^5 x^6-87552 p^2 q^4 x^6+126720 p^4 q^3 x^6-63168 p^6 q^2 x^6-122880 p^4 r^2 x^6-393216 q^2 r^2 x^6+589824 p^2 q r^2 x^6+401408 p^2 s^2 x^6+1146880 q s^2 x^6-13107200 t^2 x^6+13176 p^8 q x^6-20480 p^7 r x^6+262144 p q^3 r x^6-458752 p^3 q^2 r x^6+180224 p^5 q r x^6+36608 p^6 s x^6+737280 q^3 s x^6+643072 p^2 q^2 s x^6+1572864 r^2 s x^6-353280 p^4 q s x^6+655360 p^3 r s x^6-3670016 p q r s x^6+108544 p^5 t x^6-1933312 p q^2 t x^6+245760 p^3 q t x^6-819200 p^2 r t x^6+4849664 q r t x^6+1179648 p s t x^6-2248704 p^4 u x^6+2949120 q^2 u x^6+8257536 p^2 q u x^6-22806528 p r u x^6+56360960 s u x^6-150 p^11 x^4-55296 p q^5 x^4+16896 p^3 q^4 x^4+17664 p^5 q^3 x^4-393216 p^2 r^3 x^4+1572864 q r^3 x^4-10944 p^7 q^2 x^4-86016 p^5 r^2 x^4-1376256 p q^2 r^2 x^4+688128 p^3 q r^2 x^4+172032 p^3 s^2 x^4-622592 p q s^2 x^4+3538944 r s^2 x^4-4718592 p t^2 x^4+2184 p^9 q x^4-5664 p^8 r x^4+188416 q^4 r x^4+221184 p^2 q^3 r x^4-236544 p^4 q^2 r x^4+65024 p^6 q r x^4-5376 p^7 s x^4+901120 p q^3 s x^4-536576 p^3 q^2 s x^4-786432 p r^2 s x^4+99328 p^5 q s x^4-184320 p^4 r s x^4-2686976 q^2 r s x^4+1409024 p^2 q r s x^4-113664 p^6 t x^4+3080192 q^3 t x^4-3751936 p^2 q^2 t x^4-4718592 r^2 t x^4+1200128 p^4 q t x^4-491520 p^3 r t x^4+3276800 p q r t x^4-589824 p^2 s t x^4+2359296 q s t x^4-1437696 p^5 u x^4-12386304 p q^2 u x^4+9043968 p^3 q u x^4-14155776 p^2 r u x^4+26738688 q r u x^4+11796480 p s u x^4+17825792 t u x^4+3 p^12 x^2+61440 q^6 x^2-79872 p^2 q^5 x^2+42240 p^4 q^4 x^2-11520 p^6 q^3 x^2+2359296 s^3 x^2+1680 p^8 q^2 x^2-4096 p^6 r^2 x^2+262144 q^3 r^2 x^2-196608 p^2 q^2 r^2 x^2+49152 p^4 q r^2 x^2-61440 p^4 s^2 x^2-196608 q^2 s^2 x^2+294912 p^2 q s^2 x^2-524288 p r s^2 x^2-3670016 p^2 t^2 x^2+10485760 q t^2 x^2+33554432 u^2 x^2-120 p^10 q x^2-640 p^9 r x^2-163840 p q^4 r x^2+163840 p^3 q^3 r x^2-61440 p^5 q^2 r x^2+10240 p^7 q r x^2-8000 p^8 s x^2-344064 q^4 s x^2+770048 p^2 q^3 s x^2-448512 p^4 q^2 s x^2-262144 p^2 r^2 s x^2+1048576 q r^2 s x^2+101376 p^6 q s x^2-81920 p^5 r s x^2-1310720 p q^2 r s x^2+655360 p^3 q r s x^2-10240 p^7 t x^2-131072 p q^3 t x^2-98304 p^3 q^2 t x^2+73728 p^5 q t x^2+49152 p^4 r t x^2+1835008 q^2 r t x^2-655360 p^2 q r t x^2+131072 p^3 s t x^2+524288 p q s t x^2-7340032 r s t x^2-86016 p^6 u x^2+4718592 q^3 u x^2-1376256 p^2 q^2 u x^2+25165824 r^2 u x^2+393216 p^4 q u x^2+3932160 p^3 r u x^2-19922944 p q r u x^2+2359296 p^2 s u x^2-2097152 q s u x^2-6291456 p t u x^2+3 p^13+12288 p q^6-18432 p^3 q^5+11520 p^5 q^4-3840 p^7 q^3+262144 p s^3+720 p^9 q^2+4096 p^5 s^2+65536 p q^2 s^2-32768 p^3 q s^2+131072 p^2 r s^2-524288 q r s^2+524288 p^3 t^2-2097152 p q t^2+4194304 r t^2-72 p^11 q+32 p^10 r-32768 q^5 r+40960 p^2 q^4 r-20480 p^4 q^3 r+5120 p^6 q^2 r-640 p^8 q r-320 p^9 s-81920 p q^4 s+81920 p^3 q^3 s-30720 p^5 q^2 s+5120 p^7 q s-4096 p^6 r s+262144 q^3 r s-196608 p^2 q^2 r s+49152 p^4 q r s-6400 p^8 t-65536 q^4 t+458752 p^2 q^3 t-319488 p^4 q^2 t-524288 p^2 r^2 t+2097152 q r^2 t-1048576 s^2 t+77824 p^6 q t-114688 p^5 r t-1835008 p q^2 r t+917504 p^3 q r t-98304 p^4 s t+524288 q^2 s t+262144 p^2 q s t-1048576 p r s t+36864 p^7 u-1572864 p q^3 u+1376256 p^3 q^2 u-393216 p^5 q u+393216 p^4 r u+4194304 q^2 r u-2621440 p^2 q r u+786432 p^3 s u-2097152 p q s u-3145728 p^2 t u+8388608 q t u)


For $$n>1$$, let the roots of $$x^n+\sum_{k=0}^{n-1}a_{n-k}x^k=0$$ be $$x_1,\dots,x_n$$.

A procedure to obtain the minimal polynomial of $$\sqrt{x_1}+\dots+\sqrt{x_n}$$ is squaring:

n = $$1$$: $$x=\sqrt{x_1}$$

$$x^2-(\sqrt{x_1})^2=x^2+p$$

n = $$2$$: $$x=\sqrt{x_1}+\sqrt{x_2}$$

$$x^2-(\sqrt{x_1}+\sqrt{x_2})^2=x^2+p-2\sqrt{x_1x_2}$$

$$(x^2+p)^2-(2\sqrt{x_1x_2})^2=(x^2+p)^2-4q$$

n = $$3$$: $$x=\sqrt{x_1}+\sqrt{x_2}+\sqrt{x_3}$$

$$x^2-(\sqrt{x_1}+\sqrt{x_2}+\sqrt{x_3})^2=x^2+p-2(\sqrt{x_1x_2}+\sqrt{x_1 x_3}+\sqrt{x_2 x_3})$$

$$(x^2+p)^2-(2(\sqrt{x_1x_2}+\sqrt{x_1 x_3}+\sqrt{x_2 x_3}))^2=(x^2+p)^2-4q-8\sqrt{x_1x_2x_3}(\sqrt{x_1}+\sqrt{x_2}+\sqrt{x_3})\\=(x^2+p)^2-4q-8\sqrt{x_1x_2x_3}x$$

$$((x^2+p)^2-4q)^2-(8\sqrt{x_1x_2x_3}x)^2=((x^2+p)^2-4q)^2+r(8x)^2$$

n = $$4$$: $$x=\sqrt{x_1}+\sqrt{x_2}+\sqrt{x_3}+\sqrt{x_4}$$

$$x^2-(\sqrt{x_1}+\sqrt{x_2}+\sqrt{x_3}+\sqrt{x_4})^2=x^2+p-2(\sqrt{x_1 x_2}+\sqrt{x_1 x_3}+\sqrt{x_2 x_3}+\sqrt{x_1 x_4}+\sqrt{x_2 x_4}+\sqrt{x_3 x_4})$$

$$(x^2+p)^2-(2(\sqrt{x_1 x_2}+\sqr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right) \left(\sqrt{x_2}+\sqrt{x_3}+\sqrt{x_4}\right)\right)^2\\ =(((x^2 + p)^2 - 4 q)^2 + 64r x^2 + 64 s)^2- 256 s (3 x^4+2 p x^2-p^2+4 q)^2$$ the last line used: $$3 x^4 + 2 p x^2 - p^2 + 4 q=8 \left(\sqrt{x_1}+\sqrt{x_2}+\sqrt{x_3}\right) \left(\sqrt{x_1}+\sqrt{x_2}+\sqrt{x_4}\right) \left(\sqrt{x_1}+\sqrt{x_3}+\sqrt{x_4}\right) \left(\sqrt{x_2}+\sqrt{x_3}+\sqrt{x_4}\right)$$

By the last step of the procedure, the minimal polynomial of $$\sqrt{x_1}+\dots+\sqrt{x_n}$$ is of the form $$f_n(x)^2-(-1)^na_ng_n(x)^2$$ for some polynomials $$f_n(x),g_n(x)$$ and $$f_n(x)=f_n(-x),g_n(x)=g_n(-x)$$.

Note that $$(-1)^na_n=x_1\dots x_n$$.

Let $$P_0=\prod_{\substack{\mu_1,\dots,\mu_n\in\{\pm1\}\\\mu_1\dots\mu_n=1}}(x-(\mu_1\sqrt{x_1}+\dots+\mu_n\sqrt{x_n}))\\ P_1=\prod_{\substack{\mu_1,\dots,\mu_n\in\{\pm1\}\\\mu_1\dots\mu_n=-1}}(x-(\mu_1\sqrt{x_1}+\dots+\mu_n\sqrt{x_n}))$$ Let $$P_0=f_n(x)-\sqrt{x_1\dots x_n}g_n(x)\\ P_1=f_n(x)+\sqrt{x_1\dots x_n}g_n(x)$$ then $$f_n(x)=\frac{P_0+P_1}2\\ g_n(x)=\frac{P_1-P_0}{2\sqrt{x_1\dots x_n}}$$

Note that $$P_0,P_1$$ are products of $$2^{n-1}$$ polynomials with leading term $$x$$,
so $$P_0,P_1$$ are polynomials with leading term $$x^{2^{n-1}}$$,
so $$f_n(x)$$ is a polynomial with leading term $$x^{2^{n-1}}$$.

Note that $$f_n(x),g_n(x)$$ are unchanged under each automorphism $$\phi_i:\sqrt{x_i}\mapsto-\sqrt{x_i}$$,
so $$f_n(x),g_n(x)$$ contain no square roots.

Also, the leading term of $$g_n(x)$$ is $$2^{n-1}(n-1)!x^{2^{n-1}-n}$$. I put this question into a separate post.

Setting $$x_n=0$$ in the expression of $$P_0$$:

$$P_0=\prod_{\substack{\mu_1,\dots,\mu_n\in\{\pm1\}\\ \mu_1\dots\mu_n=1}}(x-(\mu_1\sqrt{x_1}+\dots+\mu_{n-1}\sqrt{x_{n-1}}))\\ =\prod_{\substack{\mu_1,\dots,\mu_{n-1}\in\{\pm1\}}}(x-(\mu_1\sqrt{x_1}+\dots+\mu_{n-1}\sqrt{x_{n-1}}))$$ it becomes the minimal polynomial for $$n-1$$.

Similarly, setting $$x_n=0$$ in the expression of $$P_1$$, it becomes the minimal polynomial for $$n-1$$.

So, setting $$x_n=0$$ in the expression of $$f_n$$, it becomes the minimal polynomial for $$n-1$$.

Consider the difference of $$f_n(x)$$ with the minimal polynomial for $$n-1$$ $$\tag1\label1 f_n(x)-\left(f_{n-1}(x)^2-(-1)^{n-1}a_{n-1}g_{n-1}(x)^2\right)$$ As a polynomial in $$x_n$$, \eqref{1} has a root $$x_n=0$$, so it is divisible by $$x_n$$.

By symmetry, \eqref{1} is divisible by $$x_1\dots x_n$$,
so \eqref{1} is divisible by $$a_n$$.

For $$n=2,3$$, \eqref{1} is identically zero.

My question is: Is the following true?

For $$n\ge4$$, the degree of \eqref{1} is $$2(\deg g_n)-(\deg f_n)$$.

I verified it for $$n=4,5,6$$.

For example, $$n=5$$ in the above,
the leading term of $$f_5(x)$$ is $$x^{16}$$,
the leading term of $$g_5(x)$$ is $$384x^{11}$$,
the difference $$f_5(x)-\left(f_4(x)^2-s\ g_4(x)^2\right)=-2048t(5x^6+\cdots)$$ has degree $$6=2\times11-16$$.