Math foundation
Linear algebra you will actually use
Four ideas you will meet again and again in graphics and DSP.
Linear algebra can feel like a collection of disconnected rules until you see the same geometric ideas reappear in code. For graphics and signal-processing work, these four operations are especially useful — and knowing *why* each one is there makes the notation readable.
1 · Basis and coordinates. A vector is a thing; its coordinates are a description of that thing in a chosen basis. Almost every "mysterious" transformation becomes obvious the moment you ask: what basis is this written in?
# 1) basis change is just multiplying by a matrix of the NEW basis vectors
# same point, two descriptions:
B = np.array([[np.cos(0.6), -np.sin(0.6)], # rotated basis
[np.sin(0.6), np.cos(0.6)]])
p_world = np.array([1.0, 0.0])
p_local = np.linalg.inv(B) @ p_world # describe p in B's basis
# 2) projection: split a vector into "along b" + "across b"
b = np.array([2.0, 1.0])
along = (p_world @ b) / (b @ b) * b # the part parallel to b
across = p_world - along # the remainder
# 3) least squares: solve A x = y when there is no exact answer
# (this is what "fitting a line/plane/model" actually is)
x_hat, *_ = np.linalg.lstsq(A, y, rcond=None)
# 4) SVD: orthogonal transform . nonnegative stretch . orthogonal transform.
# Orthogonal transforms may include reflections. Use SVD to compress,
# denoise, or find dominant directions in data.
U, S, Vt = np.linalg.svd(A)2 · Projection. Splitting a vector into a part along a direction and a part across it. This is how dot products, shadows, lighting, least-squares fitting and PCA all work — the same operation wearing different names.
3 · Least squares. When a system has no exact solution (often because it is over-determined), minimise the squared residual. Geometrically, this projects the target vector onto the column space of `A`; the residual from that closest representable output is perpendicular to the column space. Curve fitting, camera calibration and linear regression all use this idea.
4 · SVD. Every real matrix can be written as `U Σ Vᵀ`: an orthogonal transform, an axis-aligned nonnegative stretch, then another orthogonal transform. In 2D or 3D, an orthogonal transform may include a reflection as well as a rotation. This decomposition lets you compress (discard tiny singular values), denoise and find dominant directions.
Least squares is geometrically what?
Basis
A chosen set of directions; coordinates are a description in that choice.
Projection
Split a vector into along-a-direction plus across-it.
Least squares
The closest representable output: project the target onto the column space of A.
SVD
A matrix = orthogonal transform · nonnegative stretch · orthogonal transform.
Review cards
Basis
A chosen set of directions; coordinates are a description in that choice.
Projection
Split a vector into along-a-direction plus across-it.
Least squares
The closest representable output: project the target onto the column space of A.
SVD
A matrix = orthogonal transform · nonnegative stretch · orthogonal transform.
Sources for this lesson
Below are the references, editions and original links for further reading and checking.
BookLinear Algebra Done Rightfree
Sheldon Axler
4th edition, Springer(免费在线)
从算子视角重讲线代,脱离矩阵运算进入结构本身。第 4 版已开放免费在线阅读。建议在建立几何直觉之后再读。
CourseLinear Algebra and Its Applications + MIT OCW 18.06free
Gilbert Strang, MIT
MIT OCW 公开课(含 18.06SC 习题讲解)
线代标准教材配完整免费公开课。
Lights up these nodes in the hub:f-la