An eigenvalue is a special number that shows how much a matrix stretches or shrinks a vector when multiplied by it. It tells us the factor by which the vector changes length.
Click to reveal answer
beginner
What is an eigenvector?
An eigenvector is a vector that does not change direction when a matrix multiplies it. It may get longer or shorter, but it points the same way.
Click to reveal answer
beginner
How do you compute eigenvalues and eigenvectors using scipy?
You use the function scipy.linalg.eig(matrix). It returns two arrays: one for eigenvalues and one for eigenvectors.
Click to reveal answer
intermediate
Why are eigenvalues and eigenvectors important in data science?
They help us understand data patterns, reduce data size, and find directions of maximum variance, like in Principal Component Analysis (PCA).
Click to reveal answer
intermediate
What does it mean if an eigenvalue is zero?
A zero eigenvalue means the matrix squashes some vectors completely to zero, showing that the matrix is not invertible and loses some information.
Click to reveal answer
Which function in scipy computes eigenvalues and eigenvectors?
Ascipy.linalg.solve
Bscipy.linalg.inv
Cscipy.linalg.det
Dscipy.linalg.eig
✗ Incorrect
scipy.linalg.eig is the function used to compute eigenvalues and eigenvectors.
What does an eigenvector do when multiplied by its matrix?
AChanges length but not direction
BRemains unchanged
CChanges both length and direction
DChanges direction but not length
✗ Incorrect
An eigenvector keeps its direction but its length can change when multiplied by the matrix.
If a matrix has an eigenvalue of zero, what does it imply?
AThe matrix is diagonal
BThe matrix is invertible
CThe matrix is singular (not invertible)
DThe matrix is identity
✗ Incorrect
A zero eigenvalue means the matrix is singular and cannot be inverted.
Which of these is a use of eigenvalues and eigenvectors in data science?
ASorting data alphabetically
BReducing data dimensions with PCA
CCalculating averages
DCounting missing values
✗ Incorrect
Eigenvalues and eigenvectors are used in PCA to reduce data dimensions.
What do the outputs of scipy.linalg.eig represent?
AEigenvalues and eigenvectors
BMatrix inverse and determinant
CMatrix rank and trace
DSingular values and vectors
✗ Incorrect
scipy.linalg.eig returns eigenvalues and eigenvectors of a matrix.
Explain in your own words what eigenvalues and eigenvectors are and why they matter.
Think about how a matrix changes vectors and what stays the same.
You got /3 concepts.
Describe how you would use scipy to find eigenvalues and eigenvectors of a matrix.
Focus on the function name and what it returns.
You got /3 concepts.
Practice
(1/5)
1. What do eigenvalues represent in the context of a matrix transformation?
easy
A. The sum of all matrix elements
B. The directions that change completely under the matrix
C. How much eigenvectors stretch or shrink when the matrix is applied
D. The inverse of the matrix
Solution
Step 1: Understand eigenvalues meaning
Eigenvalues measure the factor by which eigenvectors are stretched or shrunk when multiplied by the matrix.
Step 2: Compare options with definition
How much eigenvectors stretch or shrink when the matrix is applied correctly describes this stretching/shrinking effect. Other options describe unrelated concepts.
Final Answer:
How much eigenvectors stretch or shrink when the matrix is applied -> Option C
Quick Check:
Eigenvalues = stretch/shrink factor [OK]
Hint: Eigenvalues tell how vectors scale under the matrix [OK]
Common Mistakes:
Confusing eigenvalues with eigenvectors
Thinking eigenvalues are directions
Mixing eigenvalues with matrix sum
2. Which of the following is the correct way to import the function to compute eigenvalues and eigenvectors using scipy?
easy
A. from scipy.linalg import eig
B. import scipy.eigen as eig
C. from scipy.linalg import eigenvalues
D. import scipy.linalg.eig as eigen
Solution
Step 1: Recall scipy function for eigenvalues
The function to compute eigenvalues and eigenvectors is named 'eig' and is in scipy.linalg.
Step 2: Check import syntax
from scipy.linalg import eig correctly imports 'eig' from 'scipy.linalg'. Other options use incorrect module names or syntax.
Final Answer:
from scipy.linalg import eig -> Option A
Quick Check:
Correct import = from scipy.linalg import eig [OK]
Hint: Use 'from scipy.linalg import eig' to get eigenvalues [OK]
Common Mistakes:
Using wrong module names like scipy.eigen
Trying to import non-existent functions
Incorrect import syntax
3. What is the output of the following code?
import numpy as np
from scipy.linalg import eig
A = np.array([[2, 0], [0, 3]])
values, vectors = eig(A)
print(values)
medium
A. [2.+0.j 3.+0.j]
B. [0.+2.j 0.+3.j]
C. [5.+0.j 0.+0.j]
D. [2 3]
Solution
Step 1: Understand matrix and eig function
Matrix A is diagonal with values 2 and 3 on the diagonal. Eigenvalues of a diagonal matrix are the diagonal elements.
Step 2: Predict output of eig
scipy.linalg.eig returns eigenvalues as complex numbers, so output will be [2.+0.j 3.+0.j].
Final Answer:
[2.+0.j 3.+0.j] -> Option A
Quick Check:
Diagonal matrix eigenvalues = diagonal elements [OK]