Re: square roots in Q[r]

• To: mathgroup at smc.vnet.net
• Subject: [mg107791] Re: [mg107764] square roots in Q[r]
• From: Daniel Lichtblau <danl at wolfram.com>
• Date: Fri, 26 Feb 2010 04:06:01 -0500 (EST)
• References: <201002252235.RAA16943@smc.vnet.net>

```Kent Holing wrote:
> Assume that we have f(x) an irreducible polynomial of degree
> n with rational coefficients and f(r) = 0 for r real. Given an
> element u in Q[r], is it an easy way, using mathematica, to check
> if u is a square in Q[r]?
> Kent Holing

Here is a more constructive method than the first I had sent, in that it
provides teh square root(s). We have a defining polynomial f(z). We are
given another polynomial, p(z), which we want to rewrite, if possible,
as a square in Q/f(z). We set up a second one of the form w^2-p(z). We
then find a defining polynomial for w (can use Resultant or
GroebnerBasis). If it factors, we use the individual factors in a
Groebner basis to see if w now becomes a polynomial in z, modulo f(z).

Examples (two are from my other reply, the third is rigged to be a less
obvious square).

In[112]:= defpoly = 1 - 7*z + 11*z^2 - 2*z^3 + z^5;

In[113]:= poly1 = z^2 + 2*z + 1; wpoly1 =
GroebnerBasis[{defpoly, w^2 - poly1}, w, z][[1]]
f1 = Factor[wpoly1]

Out[113]= -400 + 620 w^2 - 329 w^4 + 74 w^6 - 9 w^8 + w^10

We now try each factor separately and see what we get for w.

Out[114]= (20 - 30 w + 7 w^2 + 8 w^3 - 5 w^4 + w^5) (-20 - 30 w -
7 w^2 + 8 w^3 + 5 w^4 + w^5)

In[119]:= wsol1 =
Solve[Last[GroebnerBasis[{defpoly, w^2 - poly1, f1[[1]]}, {w, z}]] ==
0, w]
wsol2 = Solve[
Last[GroebnerBasis[{defpoly, w^2 - poly1, f1[[2]]}, {w, z}]] == 0, w]

Out[119]= {{w -> 1 + z}}

Out[120]= {{w -> -1 - z}}

Now try with a different p(z).

In[99]:= poly2 = 3*z^4 + z^2 + 2*z + 1;
wpoly2 = GroebnerBasis[{defpoly, w^2 - poly2}, w, z][[1]]
f2 = Factor[wpoly2]

Out[100]= -643837 + 689384 w^2 - 163076 w^4 - 5071 w^6 - 117 w^8 + w^10

Out[101]= -643837 + 689384 w^2 - 163076 w^4 - 5071 w^6 -
117 w^8 + w^10

It did not factor, so is not a square in Q/(f(z)).

Last example is to recover +-(3*z^4 + z^2 + 2*z + 1).

In[121]:= poly3 =
PolynomialReduce[(3*z^4 + z^2 + 2*z + 1)^2, defpoly, z][[2]]
wpoly3 = GroebnerBasis[{defpoly, w^2 - poly3}, w, z][[1]]
f3 = Factor[wpoly3]
wsoln1 = Solve[
Last[GroebnerBasis[{defpoly, w^2 - poly3, f3[[1]]}, {w, z}]] == 0, w]
wsoln2 = Solve[
Last[GroebnerBasis[{defpoly, w^2 - poly3, f3[[2]]}, {w, z}]] == 0, w]

Out[121]= 88 - 629 z + 1131 z^2 - 443 z^3 + 118 z^4

Out[122]= -414526082569 + 265261574232 w^2 - 33736172162 w^4 -
11065975 w^6 - 23831 w^8 + w^10

Out[123]= (-643837 + 689384 w - 163076 w^2 - 5071 w^3 - 117 w^4 +
w^5) (643837 + 689384 w + 163076 w^2 - 5071 w^3 + 117 w^4 + w^5)

Out[124]= {{w -> 1 + 2 z + z^2 + 3 z^4}}

Out[125]= {{w -> -1 - 2 z - z^2 - 3 z^4}}

Daniel Lichtblau
Wolfram Research

```

• Prev by Date: Re: Controlling Memory Usage from JLink
• Next by Date: Re: Problems with ChoiceDialog inside a Dynamic: Bug or not (well) documented limitation?
• Previous by thread: Re: square roots in Q[r]
• Next by thread: auto-save in Mathematica