Direct algebraic manipulation on the roots of a polynomial?

I have a lot setup here but I want to provide some of the motivation for why I even have this question before I jump into the actual question.

Motivation

I have been working on trying to prove various angles are rational or irrational${}^\dagger$ and I have the process broken into three steps in order of easy of use.

Method 1:

If $\cos(\theta) = x$ where $x \in \mathbb{Q}$ then if $x \notin \{ {-1}, {-\frac{1}{2}}, 0, \frac{1}{2}, 1 \}$ that implies $\theta$ isn't a rational angle. In other words, the only rational values of $\cos(\theta)$ when $\theta$ is a rational angle are $\pm 1, \pm \frac{1}{2}, 0$. This is just Niven's Theorem and it's a special case of method 2 below.

Method 2:

If $2\cos(\theta)$ isn't an algebraic integer then $\theta$ must not be a rational angle. This is because rational angles are roots of unity which are algebraic integers and the sum of algebraic integers are also algebraic integers. See this answer and the comments for details. Unfortunately, if $2\cos(\theta)$ is an algebraic integer, that doesn't prove that it's rational which leads to method 3.

Method 3:

If methods 1 and 2 fail, you can construct a complex number on the unit circle corresponding to the angle and then check if that number is the root of a cyclotomic polynomial. So if $x = \cos(\theta)$ then $z = x + i \sqrt{1 - x^2}$ is a complex number on the unit circle corresponding to the angle $\theta$. Then you can find the minimum polynomial for $z$ and check if it's cyclotomic. See this answer for details.

Question

My issue arises when the value I have for $\cos(x)$ isn't in a closed form but is instead the root of a polynomial. This actually isn't a problem for using method 2 because I figured out how to find a polynomial with all roots multiplied by 2. For example the angle $\cos(\theta) = x$ where $x$ is the root of $232x^3 + 108x^2 - 88x - 13 = 0$ where $x \approx 0.50509349$. By substituting $\frac{1}{2}y$ for $x$ I get $29y^3 + 27y^2 - 44y - 13$ which isn't monic so $2\cos(\theta)$ isn't an algebraic integer and therefor $\theta$ is an irrational angle.

Unfortunately this substitution trick seems to be a complete mess for method 3. Take for example the angle $\cos(\theta) = x$ where $x$ is a root of $8x^3 + 8x^2 - 2x - 1$ and $x \approx 0.40096886$. The exact closed form for $x$ is a complete mess. I really want to manipulate the polynomial directly to construct a new polynomial for $z = x + i\sqrt{1 - x^2}$ without having to find the exact closed form for $x$. This is especially important since some angles I'm working with are the roots of polynomials with order >= 5 and may not even have closed forms.

I have been playing around with polynomials and manipulating their roots and I've figured out how to multiply, divide, add, and subtract rational numbers, take whole number powers, and even how to find the reciprocal of all of the roots. I'm not sure how to take the $\sqrt{x}$ for the roots of a polynomial (although I've played around and gotten it to work for some simple polynomials). I'm also not sure how to multiply the roots by $i$ or the other things I'd need to do to manipulate a polynomial for $x$ into a polynomial for $z = x + i\sqrt{1 - x^2}$

So my question is, how do I perform algebra on the roots of a polynomial in this way? How do I go from a polynomial like $8x^3 + 8x^2 - 2x - 1$ and $x \approx 0.40096886$ to a polynomial $z^6 + 2z^5 + 2z^4 + 3z^3 + 2z^2 + 2z + 1$ and $z \approx 0.40096886 + 0.91609168 i$ where $z = x + i\sqrt{1 - x^2}$?

(Note in this case to get the polynomial in $z$ I found the stupidly huge closed form of $x$ and then constructed $z$ and found the minimum polynomial.)

${}^\dagger$By rational angle I mean an angle of the form $\theta_{\mathrm{rational}} = \frac{2\pi m}{n} \quad \mathrm{where} \quad m,n \in \mathbb{Z},\ n \neq 0,\ \mathrm{and}\ \operatorname{GCD}(m, n) = 1$

• Sorry if I misunderstand, but if $z = x+i\sqrt{1-x^2}$ then $x = (1+z^2)/(2z)$, so \begin{align} 8x^3 + 8x^2 - 2x - 1 &= 8\left(\frac{1+z^2}{2z}\right)^3 + 8\left(\frac{1+z^2}{2z}\right)^2 - 2\left(\frac{1+z^2}{2z}\right) - 1 \\ &= \frac{z^6 + 2 z^5 + 2 z^4 + 3 z^3 + 2 z^2 + 2 z + 1}{z^3}, \end{align} and the numerator is the polynomial you want. – Antonio Vargas Nov 19 '16 at 9:01
• @AntonioVargas thank you for your reply. I see you solved for x in terms of z but when I substitute $$x = (1 + z^2)/(2z)$$ into $$8x^3 + 8x^2 - 2x - 1$$ I get $$z^9+3 z^7+2 z^6+3 z^5+4 z^4+2 z^2-z-1$$ which is irreducible. How did you know to leave the $z^3$ denominator in order to get my desired polynomial? The desired root $z \approx 0.4 + 0.9i$ value isn't even a root of the order 9 polynomial I got. – Brandon Enright Nov 19 '16 at 19:03
• You must have made a mistake with your calculation. Please re-check it. – Antonio Vargas Nov 19 '16 at 19:26
• @AntonioVargas shoot you're right! I now get the goal polynomial. Boy that was much simpler than I anticipated. If you write up your comment as an answer I'll accept it :-) – Brandon Enright Nov 19 '16 at 19:42