number of roots of unity which satisfy a given polynomial Let $A$ be a matrix over $\mathbb{R}$ and $p_A(x)$ its characteristic polynomial. Is there an easy way to find out how many of the roots of $p_A(x)$ are roots of unity?
Fixing a positive integer $k$, the multiplicity of 1 as a root of $p_{A^k}(x)$ is the number of roots of unity of order dividing $k$ which satisfy $p_A(x)$, which gives some of the information. If $A$ is normal, then I can simply count the multiplicity of 1 in $p_{AA^*}(x)$, but this is not true for general matrices.
I'm mainly interested in matrices of order 4, for which there is a formula for the roots. I want to run some computer program to count the number of roots of unity, and I prefer not to use division and square\cube roots to avoid (as far as I can) precision errors. There is, on the other hand, a way to check how many real\complex roots a quartic polynomial has by using only polynomial functions of its coefficients, and the question is if there is something similar to count the roots of unity.

First, you don't need your matrix $A$ in this problem, only the polynomial $p$, which I will call $f$ instead since $p$ will be a prime number later.
I call $S_n$ the set of common roots of $f$ and $x^n-1$ and $S_\infty$ the union of all sets $S_n$.
For fixed $d$, your problem is easy: the roots of unity of order $d$ are the roots of $x^d-1$, thus the elements of $S_d$ are exactly the roots of $\mathrm{gcd} (f, x^d-1)$.
For variable $d$, you can find all the roots of $p$ lying in the complex unit circle $\mathbb{U}$: use the parametrization of the circle by $\mathbb P^1(\mathbb R)$ given by $t \mapsto q(t) = (\frac{1-t^2}{1+t^2}, \frac{2t}{1+t^2})$ and write $f(q(t)) = u(t) + i v(t)$. The roots of $f$ on the unit circle are exactly the images by $q$ of the common roots of $u$ and $v$, computed as the roots of $\gcd (u, v)$. Out of this list, the roots of unity are algebraic integers. But not all algebraic integers are roots of unity!
However, once you have this list of candidates, it should be easier to search for roots of unity.
