Chapter 15: Quick Eigenvalue TrickΒΆ
The Magic FormulaΒΆ
For any 2Γ2 matrix, eigenvalues can be computed instantly!
\[
\lambda = m \pm \sqrt{m^2 - p}
\]
Where:
m = (a+d)/2 = mean of diagonal (half of trace)
p = ad - bc = determinant
No quadratic formula needed!
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
sns.set_style('whitegrid')
plt.rcParams['figure.figsize'] = (12, 8)
The Three Key FactsΒΆ
Fact 1: Sum of Eigenvalues = TraceΒΆ
\[
\lambda_1 + \lambda_2 = a + d
\]
So the mean is: m = (Ξ»β + Ξ»β)/2 = (a+d)/2
Fact 2: Product of Eigenvalues = DeterminantΒΆ
\[
\lambda_1 \cdot \lambda_2 = \det(A) = ad - bc
\]
Call this: p = Ξ»β Β· Ξ»β
Fact 3: From Mean and Product to ValuesΒΆ
If two numbers have mean m and product p:
\[
\text{The numbers are: } m \pm \sqrt{m^2 - p}
\]
def demonstrate_quick_formula():
"""Show the quick eigenvalue formula."""
A = np.array([[3, 1], [4, 1]])
print("Quick Eigenvalue Formula\n")
print(f"Matrix A =\n{A}\n")
a, b, c, d = A[0,0], A[0,1], A[1,0], A[1,1]
# Quick formula
m = (a + d) / 2
p = a * d - b * c
disc = m**2 - p
print("Step 1: m = (a+d)/2 = ({:.0f}+{:.0f})/2 = {:.1f}".format(a, d, m))
print("Step 2: p = ad-bc = {:.0f}Β·{:.0f} - {:.0f}Β·{:.0f} = {:.0f}".format(a, d, b, c, p))
print("Step 3: mΒ²-p = {:.2f}Β² - {:.0f} = {:.2f}".format(m, p, disc))
print(" β(mΒ²-p) = {:.3f}\n".format(np.sqrt(disc)))
lambda1 = m + np.sqrt(disc)
lambda2 = m - np.sqrt(disc)
print("Result: Ξ» = {:.1f} Β± {:.3f}".format(m, np.sqrt(disc)))
print(" Ξ»β = {:.3f}".format(lambda1))
print(" Ξ»β = {:.3f}\n".format(lambda2))
eigenvalues_np = np.linalg.eigvals(A)
print(f"NumPy verification: {eigenvalues_np}")
print("Match: β")
demonstrate_quick_formula()
Mental Math ExamplesΒΆ
Example 1: Diagonal MatrixΒΆ
\[\begin{split}
A = \begin{bmatrix} 5 & 0 \\\\ 0 & 3 \end{bmatrix}
\end{split}\]
m = (5+3)/2 = 4
p = 5Β·3 = 15
mΒ²-p = 16-15 = 1
Ξ» = 4 Β± 1 = 5, 3
Example 2: SymmetricΒΆ
\[\begin{split}
A = \begin{bmatrix} 6 & 2 \\\\ 2 & 3 \end{bmatrix}
\end{split}\]
m = 4.5
p = 14
mΒ²-p = 6.25
Ξ» = 4.5 Β± 2.5 = 7, 2
SummaryΒΆ
The FormulaΒΆ
\[
\boxed{\lambda = m \pm \sqrt{m^2 - p}}
\]
Where:
m = (a+d)/2 (mean of diagonal)
p = ad - bc (determinant)
When to UseΒΆ
β Perfect for 2Γ2 matrices β Mental math β Quick checks
β Not for 3Γ3 or larger
Memorize: βm plus or minus the square root of m squared minus pβ π΅
Next: Abstract vector spaces!