Prove the n-th power of a matrix is the null matrix

Let $A,B$ be $n\times n$ matrices with complex elements, $AB=BA$, $\det(B)\ne0$, having the following property: $$|\det(A+zB)|=1, \forall z \in \mathbb{C}, |z|=1.$$ Prove $A^n=0_n$. Does this remain true if $AB \ne BA$?


So far, no idea. Any help is appreciated.

Update

I think I made some progress:

Let $f(z)=\det(A+zB)=a_nz^n + .. + a_0$

From $|f(z)|=1$ we have $f(z)\overline {f(z)}=1, \forall z, |z|=1$ then, after replacing $\overline z$ with $\frac 1 z$:

$(a_nz^n + .. + a_0)(\overline a_0z^n + .. + \overline a_n)=z^n \tag 1$

Because (1) is true for infinitely many $z$ then (1) must be a polynomial identity. Identifying coefficients I've got

$$a_0=a_1=..a_{n-1}=0, a_n\overline a_n=1$$

So $\det(A+zB)=a_nz^n$ where $|a_n|=1$. It follows that $det(A)=0, det(B)=a_n$.


A non-constant entire function that has constant modulus on the unit circle must be a constant multiple of the power function. It follows that $\det(zI+AB^{-1})=z^n$ and $AB^{-1}$ is nilpotent. As $B$ is invertible and it commutes with $A$, $A$ must also be nilpotent.

When $A,B$ do not commute, the assertion does not necessarily hold. It is easy to construct a counterexample such that $AB^{-1}$ is nilpotent but $A$ isn't. E.g. set $AB^{-1}=\pmatrix{0&1\\ 0&0}$ and $B=\pmatrix{0&1\\ 1&0}$, so that $A=\pmatrix{1&0\\ 0&0}$.