# Specifying algebraic numbers over $\mathbb{Q}$ using GAP

When trying to have GAP compute the minimal polynomial of some algebraic irrational over $$\mathbb{Q}$$ I ran into problems. How do I specify root expressions other than square roots? For instance it works to say MinimalPolynomial(Rationals,Sqrt(2)). This gives the expected result x_1^2-2. However when using MinimalPolynomial(Rationals,2^(1/2)) I get an error. In fact 2^(1/2)) per se is an error whereas (2.0)^(1/2)) is not. I realized that Sqrt(2) is actually translated to E(8)-E(8)^3. So how can I find the minimal polynomial of say $$a=\sqrt{2}$$? The answer is of course $$X^3-2$$ but how can I make GAP tell me that? If I knew how to express $$a$$ as a linear combination of roots of unity I probably wouldn't be asking in the first place.

If you want to construct minimal polynomials of numbers that are sums (or iterated) expressions of roots, one can do arithmetic with minimal polynomials. The key is a construct called a resultant, which takes two univariate polynomials, and returns an element -- the determinant of the Sylvester matrix -- in the base ring. (Alas, resultants have dropped ouyt of the standard abstract algebra curriculum a while ago.) Often this is used on multivariate polynomials, eliminating one variable.

A crucial property (see, e.g. Cohen, A course in computational algebraic number theory) is that $$\mbox{res}_x(f(x),g(y-x))$$ will be a polynomial in $$y$$ whose roots are of the form $$\alpha+\beta$$, where $$\alpha$$ are roots of $$f$$ and $$\beta$$ roots of $$g$$.

So, for example, to find a polynomial that has root $$\sqrt{2}+\sqrt{2}$$, you could use:

gap> x:=X(Rationals,"x");;y:=X(Rationals,"y");;
gap> f:=x^2-2;
x^2-2
gap> g:=x^3-2;
x^3-2
gap> r:=Resultant(f,Value(g,y-x),x);
y^6-6*y^4-4*y^3+12*y^2-24*y-4
gap> Factors(r);
[ y^6-6*y^4-4*y^3+12*y^2-24*y-4 ]


This polynomial has root $$\sqrt{2}+\sqrt{2}$$ and is irreducible, thus is its minimal polynomial.

For iterated expressions one can compose polynomials. So $$x^3-2$$ has root $$\sqrt{2}$$. $$(x-2)^3-2=x^3-6x^2+12x-10$$ has root $$2+\sqrt{2}$$ and (replacing $$x$$ by $$x^2$$) the polynomial $$x^6-6x^4+12x^2-10$$ has root $$\sqrt{2+\sqrt{2}}$$.

The only way to represent (e.g.) $$\sqrt{2}$$ in GAP is as formal AlgebraicExtension from the minimal polynomial $$x^3-2$$. The reason that such roots cannot be represented from roots of unity is that cyclotomic numbers (linear combinations of roots of unity) have an abelian Galois group, while the Galois group of the splitting field of $$\sqrt{2}$$ is nonabelian.

Since finding the minimal polynomial of $$\sqrt[a]{b}$$ is not hard, you probably want to do something else, e.g. find a minimal polynomial for a more complicated expresssion. If that is the case, ask so!

• Thank you. But does that mean I already have to know the minimal polynomial of an algebraic number in order to use it? In particular I wanted to play around with splitting fields of minimal polynomials of numbers like $\sqrt{2}+\sqrt{2}$ or even $\sqrt{2+\sqrt{2}}$. In principle I know how to calculate the minimal polynomial by hand but that gets tedious very fast which is why I wanted GAP to do that for me. Apr 26 '20 at 7:34
• Yes and no. You can do arithmetic with minimal polynomials. I'll give another anwer focussing on this. Apr 27 '20 at 15:08