๐Ÿ”ฅLimited Offer: Get 50% OFFon AI & Full Stack Courses๐Ÿ”ฅ
Back to Deep Learning Notes
Topic #22

Eigenvectors

An eigenvector is the "special direction" paired with each eigenvalue โ€” a vector that a matrix scales but never rotates off its own line. Together, eigenvalues and eigenvectors describe a matrix's fundamental behavior more compactly than its raw entries do.

Definition โ€” Continuing from Eigenvalues

\[ \mathbf{A}\mathbf{v} = \lambda \mathbf{v} \]

Once you know an eigenvalue \(\lambda\) (see Eigenvalues), you find its eigenvector by solving \((\mathbf{A}-\lambda\mathbf{I})\mathbf{v} = \mathbf{0}\) for \(\mathbf{v}\).

Numerical Example โ€” Continuing the Previous Matrix

For \(\mathbf{A} = \begin{bmatrix}4 & 1\\2 & 3\end{bmatrix}\) with \(\lambda_1 = 5\):

\[ (\mathbf{A}-5\mathbf{I})\mathbf{v} = \begin{bmatrix}-1 & 1\\2 & -2\end{bmatrix}\begin{bmatrix}v_1\\v_2\end{bmatrix} = \begin{bmatrix}0\\0\end{bmatrix} \implies v_1 = v_2 \]

Any vector of the form \([t, t]\) works โ€” the standard convention is to report the normalized eigenvector \(\mathbf{v}_1 = \left[\frac{1}{\sqrt2}, \frac{1}{\sqrt2}\right]\). For \(\lambda_2 = 2\), the same process gives \(\mathbf{v}_2 = \left[\frac{1}{\sqrt2}, -\frac{1}{\sqrt2}\right]\).

Geometric Intuition

v (before) Av = λv (after)

The eigenvector's direction (the dashed line through the origin) is unchanged โ€” only its length scales, by exactly λ.

Code

import numpy as np
A = np.array([[4., 1.], [2., 3.]])
eigenvalues, eigenvectors = np.linalg.eig(A)
print(eigenvalues)      # [5. 2.]
print(eigenvectors)     # columns are the eigenvectors, normalized to unit length

# Verify: A @ v should equal lambda * v
v1 = eigenvectors[:, 0]
print(A @ v1, eigenvalues[0] * v1)   # should match

Where This Shows Up in Deep Learning

PCA's principal components are precisely the eigenvectors of a dataset's covariance matrix, ranked by their eigenvalues (largest eigenvalue = direction of most variance in the data). This is how PCA compresses high-dimensional features into a smaller number of the most informative directions โ€” the mechanics of dimensionality reduction used before deep learning existed, and still used today for visualization and preprocessing.

Common Mistakes

  • Treating an eigenvector as unique โ€” any non-zero scalar multiple of an eigenvector is also a valid eigenvector for the same eigenvalue. Libraries return one, typically normalized to unit length, by convention.
  • Assuming eigenvectors for different eigenvalues are always perpendicular โ€” this is only guaranteed for symmetric matrices (like covariance matrices), not matrices in general.

Interview Relevance

Q: "How does PCA use eigenvectors?" PCA computes the covariance matrix of the (centered) data, then finds its eigenvectors and eigenvalues. The eigenvectors are the principal component directions; the eigenvalues rank how much variance each direction captures. Keeping only the top-\(k\) eigenvectors by eigenvalue gives a \(k\)-dimensional compression that preserves as much variance as possible.

Practice Question

If a matrix has eigenvalue \(\lambda = 1\) for some eigenvector \(\mathbf{v}\), what does that tell you about how the matrix transforms \(\mathbf{v}\) specifically?

Want to go beyond the notes?

Join CodingNow 2.0's Deep Learning course โ€” live mentorship, real projects, and 100% placement support.

Enroll Now โ€” Free Demo Available

Eigenvectors โ€“ FAQs

Quick answers about learning Eigenvectors in Deep Learning.

This free note from CodingNow 2.0 explains Eigenvectors in Deep Learning โ€” concept, syntax and worked code examples you can copy, run and revise before interviews.
Yes. Every Deep Learning topic on CodingNow 2.0, including Eigenvectors, is 100% free with no signup required.
With focused practice, most students grasp Eigenvectors in 1โ€“3 days from these notes; pairing it with CodingNow 2.0's mentor-led course takes you to job-ready depth faster.
Use the code examples in this note, then ask doubts for free on the CodingNow 2.0 Community (/community) โ€” expert instructors answer within 24 hours.
WhatsApp
Call NowEnroll Now