Problem: Let $n$ be an even positive integer, and let $A, B \in \operatorname{Mat}_{n}(\mathbf{R})$ such that $A=B^{2}$. Let $p(x)$ denote the characteristic polynomial of $A$, and let $q(x)$ denote the characteristic polynomial of $B$. Prove that $p\left(x^{2}\right)=q(x) q(-x)$.
Attempt: $ \det(A-x) = \det(B^2-x) \iff \det(A-x^2) = \det(B^2 - x^2) = \det( (B-x)(B+x) ) = \det(B-x) \det( B+x) \iff p(x^2) = q(x)q(-x) $.
I haven't used the fact that $ n $ is an even positive integer so my proof feels specious. I have no idea if it's right, do you think the proof's correct? if not then how'd one prove the theorem above?
Let $\lambda_1,...,\lambda_n$ be the complex eigenvalues of $B$. Then we know that $\lambda_1^2,...,\lambda_n^2$ be the complex eigenvalues of $A$ since $A=B^2$.
Then $$p(x^2) = (\lambda_1^2-x^2)...(\lambda_n^2-x^2)$$ and $$q(x) = (\lambda_1-x)...(\lambda_n-x).$$ Hence $$p(x^2)=q(x).q(-x).$$
Here $n$ is an even positive integer ensures the sign of the equality.