Calculating the characteristic polynomial

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.

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$.
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$$
• I see where you're going with this. Just a tiny bit confusing.. What would the value of $x$ be in the case of the matrix that I gave? Also where you have $tr(A)$ is that the entire matrix, or, the $2x2% based? This sounds like a good solution, but confused over the$x$– Phorce Jun 12 '14 at 22:30 • I mean$x$here the same way you used$\lambda$in your question.$A$,$A^2$, and$A^3$are all matrices without any variables in them. – Omnomnomnom Jun 12 '14 at 22:34 • Hey, it kind of makes sense. However, if you get some time please can I ask if you could update your answer to give a small example of what:$A,A^2,A^3$would look like? – Phorce Jun 12 '14 at 23:01 • Multiply the matrix$A = \pmatrix{4&6&10\\3&10&13\\-2&-6&-8}$with itself to get$A^2$. Multiply by$A$again to get$A^3$. Is it not clear what I mean here? – Omnomnomnom Jun 12 '14 at 23:10 • I see, so I will multiply matrix$A$by itself to get$A^2$and then take the$tr$of that matrix. Okay! One final question before I try this on pen and paper.. Doing this equation will give me the polynomial, but, will it give me just 1 value.. In some instances, I've seen where the polynomial characteristic has been something like$\lambda -4 -5$? Thanks for the help tho :) – Phorce Jun 12 '14 at 23:13 Use the rule of Sarrus to get the characteristic polynomial and Cardano's method to get the roots... • We can use the Rule of Sarrus to get the polynomial? :o – Phorce Jun 12 '14 at 19:23 • @user1326876 apply on$A-\lambda I\$ to get the determinant, which is the polynominal... – draks ... Jun 12 '14 at 20:46