[Math] Calculating the characteristic polynomial

eigenvalues-eigenvectorslinear algebrapolynomials

I'm stuck with this problem, so I've got the following matrix:

$$A = \begin{bmatrix}
4& 6 & 10\\
3& 10 & 13\\
-2&-6 &-8
\end{bmatrix}$$

Which gives me the following identity matrix of $AI$:

$$\begin{bmatrix}
4 – \lambda& 6 & 10\\
3& 10 – \lambda & 13\\
-2&-6 & -8 – \lambda
\end{bmatrix}$$

I'm looking for the Polynomial Characteristic Roots of the Determinant. I can
do this on pen and paper, but I want to make this into an algorithm which can work
on any given 3x3 matrix.

I can then calculate the Determinant of this matrix by doing the following:

$$Det(A) = 4 – \lambda \begin{vmatrix}
10 – \lambda&13 \\
-6 & -8 – \lambda
\end{vmatrix} = \begin{bmatrix}
(10 – \lambda \cdot -8 \lambda) – (-6 \cdot 13)
\end{bmatrix}$$

I repeat this process for each of the columns inside the matrix (6, 10)..

Watching this video: Here
the guy factorises each of the (A) + (B) + (C) to this equation:

$$ \lambda (\lambda_{2} – 6\lambda+8) = 0$$

And then finds the polynomials: 1, 2, 4.. Which I understand perfectly.

Now, putting this into code and factorising the equation would prove to be difficult. So, I'm asking whether or not there is a simple way to calculate the determinant (using the method given here) and calculate the polynomials without having to factorise the equation.. My aim is to be left with 3 roots based on the Determinant.

Best Answer

I think a decently efficient way to get the characteristic polynomial of a $3 \times 3$ matrix is to use the following formula: $$ P(x) = -x^3 + [tr(A)]x^2 + [[tr(A)]^2 - tr(A^2)]x + [[tr(A)]^3 + 2tr(A^3) - 3tr(A)tr(A^2)] $$ Where $tr(A)$ is the trace of $A$, and $A,A^2,A^3$ are the matrix powers of $A$.

From there, you could use the cubic formula to get the roots.


there is some computational mistake below

In this case, we'd compute $$ A = \pmatrix{4&6&10\\3&10&13\\-2&-6&-8} \implies tr(A) = 6\\ A^2 = \pmatrix{14&24&38\\16&40&56\\-10&-24&-34} \implies tr(A^2) = 20\\ A^3 = \pmatrix{52&96&148\\72&160&232\\-44&-96&-140} \implies tr(A^3) = 72 $$