Workspace IndexMath › Day 22

Eigenvalues/Eigenvectors TODO

Math · Day 22 / 52 · September — Linear Algebra (Day 18-26)

Concept

For a square matrix A, a nonzero vector v satisfying Av = λv is called an eigenvector, and the scalar λ is its eigenvalue — meaning the linear transformation doesn't change direction along v, only scales its magnitude by a factor of λ. Eigenvalues are found as the roots of the characteristic equation det(A - λI) = 0; if the eigenvectors form a basis for the space, A can be diagonalized as A = PDP^(-1), which simplifies computing powers of A to simply raising the diagonal entries to that power. A real symmetric matrix always has real eigenvalues and a basis of mutually orthogonal eigenvectors (the spectral theorem), and matrices commonly encountered in practice, like covariance matrices, fall into this category. The magnitude of the eigenvalues governs growth and decay under repeated application of the transformation, so whether the spectral radius is less than 1 determines whether an iterative process converges.

The stationary distribution of a Markov chain, dimensionality reduction via PCA, the convergence condition of iterative numerical solvers, and structural analysis of graphs all reduce to eigenvalue problems.

Code & Formula

# 고유값/고유벡터 — Av = λv 를 수치로 검증하고, 대각화 A=PDP^-1 로 A^n 계산을 단순화한다.

import numpy as np

A = np.array([[4.0, 1.0], [2.0, 3.0]])

eigvals, eigvecs = np.linalg.eig(A)
print("A =\n", A)
print(f"\n고유값: {eigvals}")
print("고유벡터(열 벡터):\n", eigvecs)

# 검증: 각 고유쌍에 대해 Av == λv
for i in range(len(eigvals)):
    lam, v = eigvals[i], eigvecs[:, i]
    lhs, rhs = A @ v, lam * v
    print(f"\nλ_{i}={lam:.4f}: Av={lhs}, λv={rhs}, 일치? {np.allclose(lhs, rhs)}")

# 대각화: A = P D P^-1  →  A^n = P D^n P^-1 (대각원소만 거듭제곱하면 됨)
P = eigvecs
D = np.diag(eigvals)
P_inv = np.linalg.inv(P)

n = 5
A_power_direct = np.linalg.matrix_power(A, n)
A_power_via_diag = (P @ np.diag(eigvals ** n) @ P_inv).real

print(f"\nA^{n} 직접 계산:\n{A_power_direct}")
print(f"A^{n} 대각화로 계산 (P D^{n} P^-1):\n{np.round(A_power_via_diag, 6)}")
print(f"일치? {np.allclose(A_power_direct, A_power_via_diag)}")

Exercise

Take a small transition matrix, repeatedly apply it, and observe the distribution converging — then check whether that limit matches the normalized eigenvector corresponding to eigenvalue 1.

Practical Connection

Eigendecomposing a covariance matrix built from multiple markets' prices or asset returns reveals that a small number of common factors explain most of the variation, which is used directly when aggregating the risk of correlated positions.

If you study this on a given day, add a note link and a ✅ to this line in the source curriculum (docs/knowledge/math-50-curriculum.md) and this spot will lead straight to the note body. You can also write directly on this page — but regenerating overwrites it, so it's safer to keep anything you want to save as markdown under docs/algorithms/.


한국어

고유값/고유벡터 TODO

Math · Day 22 / 52 · 9월 — 선형대수 (Day 18–26)

개념

정방행렬 A에 대해 Av = λv를 만족하는 영이 아닌 벡터 v를 고유벡터, 스칼라 λ를 고유값이라 하며, 이는 그 선형변환이 해당 방향으로는 방향을 바꾸지 않고 크기만 λ배로 늘리거나 줄인다는 뜻이다. 고유값은 특성방정식 det(A - λI) = 0의 근으로 구하고, 고유벡터가 공간의 기저를 이루면 A는 대각화되어 A = PDP^(-1) 꼴이 되며 이때 A의 거듭제곱 계산이 대각 원소의 거듭제곱으로 단순해진다. 실대칭행렬은 항상 실수 고유값과 서로 직교하는 고유벡터 기저를 가지며(스펙트럼 정리), 공분산행렬처럼 실무에서 자주 다루는 행렬이 여기에 속한다. 고유값의 절댓값은 변환을 반복 적용할 때의 성장과 감쇠를 지배하므로, 스펙트럼 반지름이 1보다 작은지가 반복 과정의 수렴 여부를 결정한다.

마르코프 체인의 정상분포, PCA에 의한 차원 축소, 반복 수치해법의 수렴 조건, 그래프의 구조 분석이 모두 고유값 문제로 환원된다.

코드 · 수식

# 고유값/고유벡터 — Av = λv 를 수치로 검증하고, 대각화 A=PDP^-1 로 A^n 계산을 단순화한다.

import numpy as np

A = np.array([[4.0, 1.0], [2.0, 3.0]])

eigvals, eigvecs = np.linalg.eig(A)
print("A =\n", A)
print(f"\n고유값: {eigvals}")
print("고유벡터(열 벡터):\n", eigvecs)

# 검증: 각 고유쌍에 대해 Av == λv
for i in range(len(eigvals)):
    lam, v = eigvals[i], eigvecs[:, i]
    lhs, rhs = A @ v, lam * v
    print(f"\nλ_{i}={lam:.4f}: Av={lhs}, λv={rhs}, 일치? {np.allclose(lhs, rhs)}")

# 대각화: A = P D P^-1  →  A^n = P D^n P^-1 (대각원소만 거듭제곱하면 됨)
P = eigvecs
D = np.diag(eigvals)
P_inv = np.linalg.inv(P)

n = 5
A_power_direct = np.linalg.matrix_power(A, n)
A_power_via_diag = (P @ np.diag(eigvals ** n) @ P_inv).real

print(f"\nA^{n} 직접 계산:\n{A_power_direct}")
print(f"A^{n} 대각화로 계산 (P D^{n} P^-1):\n{np.round(A_power_via_diag, 6)}")
print(f"일치? {np.allclose(A_power_direct, A_power_via_diag)}")

연습

작은 전이행렬 하나를 잡아 거듭제곱을 반복하며 분포가 수렴하는 과정을 관찰하고, 그 수렴점이 고유값 1에 대응하는 고유벡터를 정규화한 것과 일치하는지 확인하라.

실무 · Verex 연결

여러 마켓의 가격이나 자산 수익률로 만든 공분산행렬을 고유분해하면 소수의 공통 요인이 변동의 대부분을 설명한다는 사실이 드러나고, 이는 상관된 포지션의 리스크를 합산할 때 직접 쓰인다.

공부한 날 원본 커리큘럼(docs/knowledge/math-50-curriculum.md)의 이 줄에 노트 링크와 ✅ 를 붙이면, 이 자리는 노트 본문으로 바로 이어집니다. 노트 없이 이 페이지에 바로 적어도 됩니다 — 다만 다시 생성하면 덮어쓰이므로, 남길 글은 docs/algorithms/ 의 마크다운으로 쓰는 편이 안전합니다.

← 21. 리스크·포트폴리오 행렬(공분산·상관)23. PCA·SVD →