The role of **eigenvectors **and** eigenvalues **is important in both engineering and science. They're used to solve ordinary differential equations. They're used in the well-known dimensionality reduction algorithm, Principal Component Analysis (PCA). They're also used in face recognition techniques, semidefinite matrices, and many more real-world applications as well as theoretical concepts.

Suppose,

where,

This equation shows that the matrix multiplication between the matrix

Here,

An easy solution to this equation would be to simply put

This is called the **characteristic equation **of

Some of the fascinating properties of eigenvectors and eigenvalues are given below:

For a diagonal or triangular matrix, the eigenvalues are the diagonal entries of the matrix

The determinant of the matrix

$\textbf{A}$ is equal to the product of all of its eigenvalues.The number of non-zero eigenvalues represents the rank of the matrix

$\textbf{A}$ .The sum of eigenvalues of a matrix

$\textbf{A}$ is equal to the trace of that matrix**A**.If the matrix

$\textbf{A}$ is a non-singular matrix, then$1/\lambda$ is the eigenvalue of$\textbf{A}^{-1}$ with the associated eigenvector.

Here, we show how to calculate eigenvectors and eigenvalues of a matrix using the NumPy library of Python:

import numpy as npA = np.array([[5, 0],[0, 1],])λ, v = np.linalg.eig(A)print("Eigenvalues")print("-"*30)print(λ)print("-"*30)print("Eigenvectors")print("-"*30)print(v)print("-"*30)

**Line 3–6**: In these lines, we define a square matrix to compute its eigenvalues and eigenvectors. This matrix must be a square matrix otherwise, it will throw an exception.**Line 8:**Here, we use the`np.linalg.eig()`

function to calculate the eigenvalues and eigenvectors. It returns a tuple with the first element being the eigenvalues and the second one being the eigenvectors.

Note:In the code above, one of the properties of eigenvalues and eigenvectors is shown. It would be a fun activity to try them out.

There are a number of applications that require us to calculate eigenvectors and eigenvalues. Especially in the scientific community, the properties mentioned above give them great importance.

Copyright ©2024 Educative, Inc. All rights reserved

TRENDING TOPICS