# How to find solutions that yield of root of unity?

I have a polynomial with coefficients that are integer polynomials in another (complex) variable. For example:

1 + (1 - v^2) #1 + (-3 - v^2) #1^2 + #1^3 &


I want to solve for $v$ such that the second root of this polynomial is a root of unity. Notice that $v=0$ is such a solution:

In:= Root[1 + (1 - v^2) #1 + (-3 - v^2) #1^2 + #1^3 &, 2] /. {v -> 0}
Out= 1


My two attempts to pull this information out of Mathematica have not worked. Namely,

In:= Reduce[RootOfUnityQ[Root[1 + (1 - v^2) #1 + (-3 - v^2) #1^2 + #1^3 &, 2]], {v}]
Out= False


and

In:= Solve[RootOfUnityQ[Root[1 + (1 - v^2) #1 + (-3 - v^2) #1^2 + #1^3 &, 2]], {v}]
Out= {}


both say that there are no solutions, which is not the answer that I am looking for.

# Question:

How do I solve for $v$ such that some expression is a root of unity?

• Have you noticed that this function is linear in $v^2$? This means that a very simple formula for $v$ can be found as the square root of a rational function of #1. Replacing #1 by $\exp(2 k \pi i/n)$ for integral $k$ and nonzero integral $n$ finishes the job. May 23, 2012 at 15:48

Reduce[1 + (1 - v^2) (x + I y) + (-3 - v^2) (x + I y)^2 + (x + I y)^3 == 0 && x^2 + y^2 == 1, {y, x, v}] seems to give what you want. In general, one might wish to try expanding complex variables into explicit real and imaginary parts, if the usual treatments do not work.
• Note that the condition x^2 + y^2 == 1 does not necessarily guarantee that x + I y is a root of unity, but this is at least a starting point... May 23, 2012 at 14:30
• Along those lines, I suppose that Reduce[1 + (1 - v^2) x + (-3 - v^2) x^2 + x^3 == 0 && Exists[n, Element[n, Integers] && n > 0 && x^n == 1], {x, v}] would work, but I have no idea how long it will take to execute given that there is an existential quantifier. May 23, 2012 at 15:10
The reason why your attempts didn't work is that RootOfUnityQ like all functions ending in Q gives False if the object cannot be determined right away as unit root. For example RootOfUnityQ[x] evaluates straight to False, and so does RootOfUnityQ[Root[1 + (1 - v^2) #1 + (-3 - v^2) #1^2 + #1^3 &, 2]]. So e.g. your first attempt basically reduces to Reduce[False, {v}] which of course evaluates to False.
It is easy to be fooled by those *Q functions which from their name look more like mathematical functions than structural ones, see e.g. the answers on Why does Mathematica claim there is no even prime? for more detailed explanations of those *Q functions. I consider them one of the most confusing functionalities (if not the most confusing functionality) of Mathematica, but basically, the key thing to remember is that all *Q functions have an implied TrueQ.
As of a mathematical expression which could replace RootOfUnityQ I think in many cases Abs[x] == 1, while not exactly equivalent, should suffice. For those where it doesn't, maybe Log[x]/(I Pi) \[Element] Rationals would be a good replacement.