Help understanding the characteristic polynomial Let
$$A = \begin{bmatrix}
1 &2  &1 \\ 
2 & 2 &3 \\ 
1 & 1 &1 
\end{bmatrix}$$
I'm calculating the characteristic polynomial by the following:
$$P(x) = -x^3 + Tr(A)x^2 + \frac{1}{2}(a_{ij}a_{ji} -  a_{ii}a_{jj})x + \det(A)$$
Now when I calculate using matlab (using the charpoly(A) function) I get the following results:
Ans = 1    -4    -3    -1

This makes sense since, for second result ($-4$) you can calculate $2 + 3 + 4$ and for result $-1$ you can do by taking the determinant of this matrix, which is (1) 
But I do not and cannot seem to figure out how they are calculating the $-3$ (in this case)? I know it has something to do with the $\frac{1}{2}(a_{ij}a_{ji} - a_{ii}a_{jj})$ but what would these elements be in this matrix in order to calculate the third result for this? 

See Wolfram Mathworld for your formula. It notes that Einstein summation is used in the coefficient for $x$, so you have to sum over both $i$ and $j$ to get the actual answer.
The matlab answer gives the negative of $P_3(x)$ (as these have the same roots anyway): 1 stands for $x^3$, the -4 for the negative trace $1+2+1$, and the final $-1$ is just minus the determinant. So if you apply the formula with $-x^3$ at the start, we want the $x$-coefficient to be $3$, not $-3$.
So compute the missing coefficient as the double sum ${1 \over 2}\sum_{i=1}^3\sum_{j=1}^3 (a_{ij}a_{ji} - a_{ii}a_{jj})$.  
