OKPEDIA MATLAB EN MATRICE

How to calculate the characteristic polynomial of a matrix in Matlab and Octave

To calculate the characteristic polynomial of a matrix in Matlab and Octave, use the poly() function

poly(x)

The parameter of the function is a square matrix.

The function calculates the characteristic polynomial of the square matrix.

What is the characteristic polynomial? The characteristic polynomial of a square matrix is calculated using the following formula $$ p( \lambda ) = \det(M- \lambda \cdot Id_n) $$ Where M is the square matrix, Id is an identity matrix of the same order and lambda is a variable.

Example

Define a square matrix M

>> M = [1 2 ; 0 3]
M =
1 2
0 3

It is a 2x2 square matrix with two rows and two columns

$$ M = \begin{pmatrix} 1 & 2 \\ 0 & 3 \end{pmatrix} $$

Calculate the characteristic polynomial of the matrix M using the function poly(M)

>> poly(M)
ans =
1 -4 3

The result is an array with the coefficients of the characteristic polynomial of the matrix

$$ 1 \cdot \lambda^2 - 4 \cdot \lambda^1 + 3 \cdot \lambda^0 $$

$$ \lambda^2 - 4 \lambda + 3 $$

They are the same coefficients as in the characteristic equation of the matrix

$$ \lambda^2 - 4 \lambda + 3 = 0 $$

Verify. $$ p( \lambda ) = \det(M- \lambda \cdot Id_n) $$ $$ p( \lambda ) = \det ( M- \lambda \cdot Id_n ) $$ $$ p( \lambda ) = \det [ \ \begin{pmatrix} 1 & 2 \\ 0 & 3 \end{pmatrix} - \lambda \cdot \begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix} \ ] $$ $$ p( \lambda ) = \det [ \ \begin{pmatrix} 1 & 2 \\ 0 & 3 \end{pmatrix} - \begin{pmatrix} \lambda & 0 \\ 0 & \lambda \end{pmatrix} \ ] $$ $$ p( \lambda ) = \det \begin{pmatrix} 1 - \lambda & 2 \\ 0 & 3 - \lambda \end{pmatrix} $$ $$ p( \lambda ) = ( 1 - \lambda ) \cdot (3 - \lambda) - 2 \cdot 0 $$ $$ p( \lambda ) = 3 - \lambda -3 \lambda + \lambda^2 $$ $$ p( \lambda ) = \lambda^2 - 4 \lambda + 3 $$

https://how.okpedia.org/en/matlab/how-to-calculate-the-characteristic-polynomial-of-a-matrix-in-matlab-and-octave


Report an error or share a suggestion to enhance this page


Matrix in Matlab/Octave


FacebookTwitterLinkedinLinkedin