# Generalized form for a matrix $A$ where $\text{Tr}(A^2) = 0$, $\text{Tr}(A) \ne 0$

Is there a general form for a matrix such that the trace of the matrix is not zero, but the trace of its square is, for any size matrix $n$?

(this was motivated by proving that $\langle A,B\rangle = \text{Tr}(AB)$ is not an inner product for all $M_{n,n}$)

-
If $\lambda_1,\lambda_2,\ldots,\lambda_n$ are the eigenvalues counted with algebraic multiplicity, these are the matrices such that $\lambda_1^2+\lambda_2^2+\cdots+\lambda_n^2=0$ and $\lambda_1+\lambda_2+\cdots+\lambda_n\neq 0$. – Jonas Meyer Apr 17 '11 at 0:27

For a $1\times1$ matrix it is not possible to have $\text{Tr} A \neq 0$ and $\text{Tr} A^2 = 0$. For a matrix of size $2$, the following does the job, $$A_2= \begin{pmatrix} 1 & 1 \\ -1 & 1 \end{pmatrix}.$$ For larger $n$ you can use the block matrix $$A_n = \left(\begin{array}{c|c} A_2 &0\\\hline 0 & 0 \end{array}\right),$$ i.e., the rest is filled up with zeros.
Just to note a connection what Fabian wrote with Jonas' comment to the main question: one can identify 2-by-2 matrices of the form [[a, b], [-b,a]] with the complex numbers $a+bi$. Then the Trace operator on these matrices corresponds to taking the real part of the complex number. So your problem then reduces to finding a complex number $z$ with non-zero real part such that $z^2$ has zero real part. Fabian's example shows that $1+i$ is one such number. – Willie Wong Apr 17 '11 at 1:58