Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Eigenvalues and Eigenvectors | Linear Algebra
Mathematics for Data Analysis and Modeling
course content

Course Content

Mathematics for Data Analysis and Modeling

Mathematics for Data Analysis and Modeling

1. Basic Mathematical Concepts and Definitions
2. Linear Algebra
3. Mathematical Analysis

bookEigenvalues and Eigenvectors

Eigenvectors and eigenvalues are concepts related to linear transformations and matrices. An eigenvector v is a non-zero vector that results in a scaled version of itself when multiplied by a given matrix. The eigenvalue λ associated with an eigenvector represents the scalar value by which the eigenvector is scaled.

If we have some matrix A and provide linear transformation A * v, where v- eigenvector of matrix A, we will get the vector with the same direction but with different length:

Calculating eigenvalues and eigenvectors

To find eigenvectors and corresponding eigenvalues of a matrix, we can use np.linalg.eig() method:

123456789101112
import numpy as np # Define a square matrix matrix = np.array([[2, 1, 3], [1, 3, 0], [3, 0, 4]]) # Calculate eigenvectors and eigenvalues eigenvalues, eigenvectors = np.linalg.eig(matrix) # Print the eigenvalues and eigenvectors for i in range(len(eigenvalues)): print(f'Eigenvalue {i+1}: {eigenvalues[i]:.3f}') print(f'Eigenvector {i+1}: {np.round(eigenvectors[:, i], 3)}\n')
copy

In this example, we create a 3x3 matrix matrix. We then use the np.linalg.eig() method from NumPy to calculate the eigenvalues and eigenvectors. The function returns two arrays: eigenvalues contain the eigenvalues, and eigenvectors contain the corresponding eigenvectors.

Practical applications

Eigenvalues ​​and vectors are often used to solve various applied problems. One of these problems is the problem of dimensionality reduction for which the PCA algorithm is used: this algorithm is based on using eigenvalues ​​of the feature covariance matrix.

Note

Dimensionality reduction is a fundamental problem in data analysis and machine learning, aiming to reduce the number of features or variables in a dataset while preserving as much relevant information as possible.

Assume that `v = [2, 4, 6]` is a eigenvector of matrix `A` that correspond so eigenvalue `λ=2`. Calculate the result of matrix multiplication `A * v`.

Assume that v = [2, 4, 6] is a eigenvector of matrix A that correspond so eigenvalue λ=2. Calculate the result of matrix multiplication A * v.

Select the correct answer

Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 2. Chapter 9
We're sorry to hear that something went wrong. What happened?
some-alt