If $A$ is a $n$ x $n$ matrix and $f(\lambda)=det(A-\lambda I_n)$ then the characteristic polynomial is given as
$f(\lambda)=(-1)^n \lambda^{n}+(-1)^{n-1}Tr(A) \lambda^{n-1}+....+det(A)$
For a 3x3 matrix I dont know how they arrived at the following with the $1/2$ term
$-\lambda^{3}+tr(A) \lambda^{2}+ \frac{1}{2}(tr(A)^2-tr(A^2)) \lambda +det(A)$
I thought it was just a matter of substituting n=3....