Skip to content
Related Articles

Related Articles

Improve Article
Matrix Diagonalization
  • Last Updated : 09 Mar, 2021

Prerequisite:
Eigen values and eigen vectors

Let A and B be two matrices of order n. B can be considered similar to A if there exists an invertible matrix P such that  

B = P ^{-1} A P

This is known as Matrix Similarity Transformation.

Diagonalization of a matrix is defined as the process of reducing any matrix A into its diagonal form D. As per the similarity transformation, if the matrx A is related to D, then



D = P ^{-1} A P

and the matrix A is reduced to the diagonal matrix D through another matrix P. (P ≡ modal matrix) 

Modal matrix: It is a (n x n) matrix that consists of eigen-vectors. It is generally used in the process of diagonalization and similarity transformation.

In simpler words, it is the process of taking a square matrix and converting it into a special type of matrix called a diagonal matrix.

Steps Involved

Step 1 - Initialize the diagonal matrix D as:

D = \begin{bmatrix}    \lambda_1 & 0 & 0 \\    0 & \lambda_2 & 0 \\    0 & 0 & \lambda_3 \end{bmatrix}

where λ1, λ2, λ3 -> eigen values
Step 2 - Find the eigen values using the equation given below.

det(A-\lambda I)  = 0  

where, 
A -> given 3x3 square matrix.
I -> identity matrix of size 3x3.
λ -> eigen value.
Step 3 - Compute the corresponding eigen vectors using the equation given below.

At\ \lambda=i\\ [A-iI ]X_i = 0



where,
λi -> eigen value.
Xi -> corresponding eigen vector.
Step 4 - Create the modal matrix P.

P = [X_0 X_1..X_n]

Here, all the eigen vectors till Xi are filled column wise in matrix P. 
Step 5 - Find P-1 and then use equation given below to find diagonal matrix D.

D = P ^{-1} A P

Example Problem

Problem Statement: Assume a 3×3 square matrix A having the following values:

A = \begin{bmatrix}     1 & 0 & -1\\1 & 2 & 1\\2 & 2 & 3 \end{bmatrix}

Find the diagonal matrix D of A using the diagonalization of matrix. [ D = P-1AP ]

Step by step solution:

Step 1 - Initializing D as:

D = \begin{bmatrix}    \lambda_1 & 0 & 0 \\    0 & \lambda_2 & 0 \\    0 & 0 & \lambda_3 \end{bmatrix}

Step 2 - Find the eigen values. (or possible values of λ)

det(A - \lambda I) = 0

\\ \implies det(A-\lambda I) = det(\begin{bmatrix}     1-\lambda & 0 & -1\\1 & 2-\lambda & 1\\2 & 2 & 3-\lambda \end{bmatrix}) = 0 \\ \implies (\lambda^3 - 6\lambda^2 +11\lambda -6) = 0 \\ \implies (\lambda - 1)( \lambda - 2)(\lambda -3) = 0 \\ \implies \lambda = 1,2,3



Step 3 - Find the eigen vectors X1, X2, X3 corresponding to the eigen values λ = 1,2,3. 

At\ \lambda = 1 \\ [A - (1)I]X_1 = 0 \\ \implies \begin{bmatrix}   1-1  & 0 & -1\\1 & 2-1 & 1\\2 & 2 & 3-1 \end{bmatrix} \begin{bmatrix}   x_1\\x_2\\x_3 \end{bmatrix} = \begin{bmatrix} 0 \\ 0 \\ 0 \end{bmatrix} \\ \implies \begin{bmatrix}     0 & 0 & -1\\1 & 1 & 1\\2 & 2 & 2 \end{bmatrix} \begin{bmatrix}     x_1\\x_2\\x_3 \end{bmatrix} = \begin{bmatrix} 0 \\ 0 \\ 0 \end{bmatrix} \\ On\ solving,\ we\ get\ the\ following\ equations: \\ x_3 = 0 (x_1) \\ x_1 + x_2 = 0 \implies x_2 = -x_1  \\ \therefore X_1 = \begin{bmatrix}   x_1\\-x_1\\ 0(x_1) \end{bmatrix} \\ \implies X_1 = \begin{bmatrix}   1\\-1\\0 \end{bmatrix}

Similarly, \\ for\ \lambda = 2 \\ X_2 = \begin{bmatrix}   -2\\1\\2 \end{bmatrix} \\ and \\ for\ \lambda = 3 \\ X_3 = \begin{bmatrix}   1\\-1\\-2 \end{bmatrix}

Step 5 - Creation of modal matrix P. (here, X1, X2, X3 are column vectors)

P = [X_1\ X_2\ X_3] = \begin{bmatrix}     1 & -2 & 1\\ -1 & 1 & -1\\ 0 & 2 & -2 \end{bmatrix}

Step 6 - Finding P-1 and then putting values in diagonalization of a matrix equation. [D = P-1AP]

We do Step 6 to find out which eigen value will replace λ1, λ2 and λ3 in the initial diagonal matrix created in Step 1.

P = \begin{bmatrix}     1 & -2 & 1\\ -1 & 1 & -1\\ 0 & 2 & -2 \end{bmatrix} \\ det(P) = (1)[(-2)(1)-(-1)(2)] - (-2)[(-2)(-1)-(0)(-1)] + (1)[(2)(-1)-(0)(1)] \\ = [ 0 + (4) + (-2)]\\ = 2 \\ Since\ det(P) \neq 0 \implies Matrix\ P\ is\ invertible.

Reference articles: Determinant of a matrix & Inverse of a matrix

We know that

P^{-1} = \frac{adj (P)}{det(P)}

On solving, we get 

P^{-1} =\frac{1}{2}\begin{bmatrix}     0 & -2 & 1\\ -2 & -2 & 0\\ -2 & -2 & -1 \end{bmatrix}

Putting in Diagonalization of Matrix equation, we get

D = P^{-1}AP \\ D = \frac{1}{2}\begin{bmatrix}     0 & -2 & 1\\ -2 & -2 & 0\\ -2 & -2 & -1 \end{bmatrix} \begin{bmatrix}     1 & 0 & -1\\1 & 2 & 1\\2 & 2 & 3 \end{bmatrix} \begin{bmatrix}     1 & -2 & 1\\ -1 & 1 & -1\\ 0 & 2 & -2 \end{bmatrix} \\ D = \begin{bmatrix}     1 & 0 & 0\\ 0 & 2 & 0\\ 0 & 0 & 3 \end{bmatrix}  

machine-learning-img

My Personal Notes arrow_drop_up
Recommended Articles
Page :