# Easiest way to get the characteristic polynomial

What would be the easiest way to get the charateristic polynomial roots?!

What I'm actually doing right now is...

Given a matrix $A$, I calculate $\det(A-\lambda I) = 0$ with Laplace Expansion, and then, expand all terms to get usually a third degree equation (depends on the size of my matrix $A$)... Then I try to find one value for $\lambda$ that is root of that expression... Then I make a polynomial division, with the first expression (third degree equation) divided by $(x-a)$ when $a$ is the root that I've found. Then I get a second degree equation and use bhaskara method to get the other two roots. That method works, but it takes a long time and I can have many algebraic mistakes during the proccess, and if my first equation has degree $>3$ I'll be lost.

What is the proccess that I should adopt after the Laplace Expansion at $\det(A-\lambda I) = 0$? How can I simplify what I am doing?!

Thanks!

• There is essentially nothing you can do, unless you can somehow factor the polynomial because you guess how to do it from looking at it hard. Every polynomial is the characteristic polynomial of a matrix (google "companion matrix") so there is nothing special about characteristic polynomials. – Mariano Suárez-Álvarez Oct 20 '16 at 5:44
• @MarianoSuárez-Álvarez So what I am doing is essentialy what needs to be done?! – Bruno Reis Oct 20 '16 at 5:50

In practice, if you want the approximate roots, you can find them using numerical codes like the Jenkins-Traub algortihm (https://github.com/sweeneychris/RpolyPlusPlus). Or you can skip forming the characteristic polynomial entirely and find the eigenvalues using eigs in Matlab, or a standard linear algebra package like Eigen (http://eigen.tuxfamily.org/index.php?title=Main_Page) in C/C++.