Kaijing Ma

Paper Notes

Deep Learning

Paper Notes

Ian Goodfellow, Yoshua Bengio, Aaron Courville

MIT Press, 2016 · Chapter 2 Linear Algebra only, printed pp. 29 to 50; official online edition

Official complete Chapter 2 HTML

Scope, objects and the problem of lost information

A chapter about maps and their constraints

This unit covers Chapter 2, Linear Algebra, printed pages 29 to 50 of the official 2016 online edition. All sections from 2.1 through 2.12 were read. The whole book is not covered. Chapter 1 has a separate note. Later chapters and the external references cited by this chapter are outside this unit.

The organizing question of this note is what a linear map preserves, removes or amplifies. Shape determines which operations exist. Rank determines what can be recovered. Orthogonality controls geometry. Spectral decompositions expose direction dependent scaling. PCA then chooses which directions to retain under one explicit reconstruction objective.

Definitions and equation references identify chapter evidence. The proofs, counterexamples, numerical tables and cost accounting below are original note derivations unless a source figure is named. They are not experimental measurements or a translation of the chapter. The chapter contains a mathematical PCA example, rather than an empirical benchmark or ablation study.

Objects, indices and orientation

Notation guide based on Section 2.1, pp.29 to 32. The map interpretation is the note’s organizing view.
ObjectShape and interpretationRelevant distinction
Scalara ∈ ℝA single coordinate
Column vectorx ∈ ℝⁿxᵀ is a row
MatrixA ∈ ℝᵐˣⁿm output coordinates and n input coordinates
TensorMultiple indexed axesThe chapter uses tensor for an array with a general number of axes

The source uses x_S for selected entries and x_−S for the complementary entries. A_i,: is a row and A_:,j is a column. These conventions avoid confusing a coordinate selection with a matrix product. A transpose exchanges indices and dimensions. It does not calculate an inverse.

Book Figure 2.1 · p.31。 The complete original diagram exchanges the rows and columns of a 3 by 2 matrix. Its symbolic entries make the index reversal visible. No numerical computation or speed comparison is shown. Ian Goodfellow, Yoshua Bengio and Aaron Courville, MIT Press, 2016, Figure 2.1, p. 31. Book Figure 2.1, p. 31. CC BY-NC-ND 4.0. Complete original figure rendered without changes to diagram content or labels. Surrounding page material excluded.
A ∈ ℝᵐˣⁿ ⇒ Aᵀ ∈ ℝⁿˣᵐ; (Aᵀ)ᵢⱼ=Aⱼᵢ. A: ℝⁿ → ℝᵐ, x ↦ Ax.
1 / 12Chapter 2 Linear Algebra only, printed pp. 29 to 50; official online edition

Multiplication is composition, while broadcasting is a convention

Compatible dimensions carry mathematical meaning

Sections 2.1 and 2.2, pp.32 to 34, distinguish ordinary multiplication, elementwise multiplication and broadcasting. If B maps an input into an intermediate space and A maps that space into an output, AB applies B first. The summed index links the two spaces. A Hadamard product instead multiplies matching coordinates without that intermediate sum.

A ∈ ℝᵐˣⁿ, B ∈ ℝⁿˣᵖ ⇒ AB ∈ ℝᵐˣᵖ; (AB)ᵢⱼ=Σₖ₌₁ⁿ AᵢₖBₖⱼ. (A⊙B)ᵢⱼ=AᵢⱼBᵢⱼ for equal shapes.

Independent example: A=[[1,2],[0,1]] and B=[[2,0],[1,3]]. The products below differ even though all three operations are defined. Associativity still permits regrouping A(BC)=(AB)C. It does not permit reordering factors. Transposition reverses their order, which follows by exchanging the two free indices in the entrywise sum.

Exact arithmetic for a note constructed example. No entries are measured chapter results.
OperationExact resultWhat it represents
AB[[4,6],[1,3]]B followed by A
BA[[2,4],[1,5]]A followed by B
A⊙B[[2,0],[0,3]]Coordinate products
(AB)ᵀ=BᵀAᵀ; xᵀy=yᵀx for real vectors. A(B+C)=AB+AC; A(BC)=(AB)C.

A bias needs an axis convention

For examples stored as rows, the chapter defines A+b by C_ij=A_ij+b_j. A feature bias is repeated across rows. An explicit version is A+1_m bᵀ, where b has n entries. Other array libraries may align or expand axes differently. The compact notation alone does not establish a software library’s broadcasting behavior.

C=A+1ₘbᵀ; Cᵢⱼ=Aᵢⱼ+bⱼ, A ∈ ℝᵐˣⁿ, b ∈ ℝⁿ. Dense AB: mnp multiplications and mp(n−1) additions for n≥1.

The operation count is independent note accounting for the direct dense algorithm. It excludes memory traffic, parallelism and numerical format. A better parenthesization can change intermediate sizes and arithmetic cost without changing an exact real valued result. Floating point regrouping can also change rounding.

2 / 12Chapter 2 Linear Algebra only, printed pp. 29 to 50; official online edition

Rank separates reachability from uniqueness

An inverse is a two sided recovery claim

Sections 2.3 and 2.4, pp.34 to 37, express a linear system as Ax=b. Each row is a constraint. Each column is a direction whose coefficient appears in x. The target b is reachable exactly when it belongs to the column space. Distinct coefficients can produce the same target when A has a nonzero null vector.

Ax=Σⱼ xⱼA_:,ⱼ. Ax=b is consistent ⇔ b∈col(A). If Ax₀=b, all solutions are x=x₀+z with z∈null(A).

The final statement follows in both directions. Adding a null vector preserves Ax. Subtracting any two solutions yields a null vector. It therefore explains why a real linear system cannot have exactly two or three distinct solutions: a nonzero null direction gives a full affine line of solutions.

Rank formulation of the chapter’s span argument. Shape inequalities alone are insufficient.
Property for A ∈ ℝᵐˣⁿNecessary and sufficient rank conditionInterpretation
Every b has a solutionrank(A)=m, hence m≤nSurjective map
At most one solution for each brank(A)=n, hence n≤mInjective map
Exactly one solution for every bm=n=rank(A)An ordinary inverse exists
A particular b has multiple solutionsb∈col(A) and rank(A)<nAn affine family of solutions

Exact recovery does not imply stable recovery

A=[[1,1],[2,2]]. col(A)=span{(1,2)ᵀ}; null(A)=span{(1,−1)ᵀ}.

In this independent example, b=(3,6)ᵀ has solutions x=(t,3−t)ᵀ for any real t. The target (3,7)ᵀ is inconsistent. Two columns and two rows do not guarantee invertibility. The identity matrix I_n preserves all vectors; an ordinary square inverse satisfies A⁻¹A=AA⁻¹=I_n.

The source cautions that explicitly forming an inverse is usually a poor numerical route to a solve. Independent clarification: solving with a factorization avoids constructing an unnecessary dense inverse, but does not remove an ill conditioned problem. An inverse formula states what the solution is. It does not supply an accuracy guarantee at finite precision.

3 / 12Chapter 2 Linear Algebra only, printed pp. 29 to 50; official online edition

Norms define the error geometry

Size, angle and a deliberate choice of penalty

Section 2.5, pp.37 to 38, treats norms as size functions with definiteness, absolute homogeneity and the triangle inequality. These conditions matter when a loss is interpreted as distance. Squared Euclidean length is useful but is not itself a norm. Counting nonzero entries also fails the homogeneity requirement.

‖x‖ₚ=(Σᵢ|xᵢ|ᵖ)¹/ᵖ, p≥1; ‖x‖∞=maxᵢ|xᵢ|. ‖A‖F²=ΣᵢⱼAᵢⱼ². xᵀy=‖x‖₂‖y‖₂cosθ for nonzero x,y.
Independent arithmetic. A norm scales by 2 here. The last two quantities violate that scaling in different ways.
Quantityx=(3,−4)ᵀAfter scaling x by 2
‖x‖₁714
‖x‖₂510
‖x‖∞48
‖x‖₂²25100
Nonzero count22
∇ₓ(½‖x‖₂²)=x. ∇ₓ‖x‖₂=x/‖x‖₂ for x≠0. ∂|t|={sign(t)} if t≠0, and ∂|t|=[−1,1] if t=0.

The gradient of squared length shrinks to zero near the origin. The absolute value has a nontrivial subgradient interval at zero. This difference helps explain sparse solutions, but an L1 penalty does not always recover a desired support. Correlated features, loss curvature and penalty strength also matter.

A scalar example isolates the mechanism

arg min_t [½(t−a)²+λ|t|]=sign(a)·max(|a|−λ,0), λ≥0. arg min_t [½(t−a)²+(λ/2)t²]=a/(1+λ).

This independent calculation uses the positive, negative and zero cases of the subgradient condition. With a=0.3 and λ=0.5, the first minimizer is 0 and the second is 0.2. The example explains thresholding in this separable quadratic problem. It is not a proof that arbitrary neural network training reaches sparse global optima.

4 / 12Chapter 2 Linear Algebra only, printed pp. 29 to 50; official online edition

Structured matrices preserve different things

Diagonal, symmetric and orthogonal are distinct properties

Section 2.6, pp.38 to 40, introduces diagonal and symmetric matrices, unit vectors and orthogonality. Diagonal structure restricts how coordinates mix. Symmetry equates a matrix with its transpose. Orthogonality requires a square matrix with orthonormal rows and columns, not merely perpendicular vectors of arbitrary lengths.

diag(v)x=v⊙x. diag(v)⁻¹=diag(1/v₁,…,1/vₙ) when every vᵢ≠0. QᵀQ=QQᵀ=I ⇒ Q⁻¹=Qᵀ.

A diagonal multiplication uses n scalar products rather than n² for a direct dense n by n map. This is an arithmetic count, not a measured speedup. A rectangular diagonal map can append zeros or discard coordinates. It has no ordinary two sided inverse. The less costly representation also excludes many possible interactions.

‖Qx‖₂²=xᵀQᵀQx=‖x‖₂². (Qx)ᵀ(Qy)=xᵀy. Q=[[0,−1],[1,0]] preserves lengths and rotates by 90°.

An orthogonal map preserves lengths, angles and pairwise distances. It can still change coordinates substantially. A symmetric matrix need not preserve any of those quantities: diag(2,1) is symmetric and stretches one axis. A diagonal matrix can have zero entries and lose information.

An orthonormal basis for a subspace is rectangular

D ∈ ℝᵈˣᵏ, DᵀD=Iₖ, k<d. P=DDᵀ ⇒ Pᵀ=P, P²=P, rank(P)=k; generally P≠I_d.

The columns of D preserve the length of a code c because ‖Dc‖₂=‖c‖₂. Its transpose compresses an arbitrary x and removes the component perpendicular to col(D). The reconstruction P is a projector, not an inverse of that compression on all of ℝᵈ. This distinction becomes the central constraint in PCA.

5 / 12Chapter 2 Linear Algebra only, printed pp. 29 to 50; official online edition

Eigenvectors explain a map only under stated conditions

Invariant directions and the symmetric case

Section 2.7, pp.40 to 42, defines a nonzero eigenvector by Av=λv. If a square matrix has a full independent eigenbasis, it admits A=VΛV⁻¹. This condition is substantive. A real matrix can need complex eigenvectors, and a defective matrix can lack a full eigenbasis even over the complex numbers.

A=Aᵀ ∈ ℝⁿˣⁿ ⇒ A=QΛQᵀ, QᵀQ=I, Λ=diag(λ₁,…,λₙ), λᵢ∈ℝ. Avᵢ=λᵢvᵢ.
Book Figure 2.3 · p.41。 The left panel shows unit input directions. The right panel shows their images under a map with two orthonormal eigenvectors. The directions retain their lines while the associated eigenvalues set their scaling. This is a geometric illustration, with no benchmark data or exact numerical eigenvalues inferred here. Ian Goodfellow, Yoshua Bengio and Aaron Courville, MIT Press, 2016, Figure 2.3, p. 41. Book Figure 2.3, p. 41. CC BY-NC-ND 4.0. Complete original figure rendered without changes to diagram content or labels. Surrounding page material excluded.

A quadratic form is a weighted average of eigenvalues

x=Qz, ‖x‖₂=1 ⇒ Σᵢzᵢ²=1 and xᵀAx=Σᵢλᵢzᵢ². minᵢλᵢ ≤ xᵀAx ≤ maxᵢλᵢ.

This note derivation explains the Rayleigh extremum stated in the chapter. The nonnegative weights z_i² sum to one. Equality is reached in an extreme eigenspace. For a real symmetric matrix, positive definiteness means every eigenvalue is positive, while positive semidefiniteness allows zeros. These are equivalent to xᵀAx>0 for every nonzero x and xᵀAx≥0 for every x, respectively.

The symmetry qualification is essential. The nonsymmetric matrix [[1,10],[0,1]] has positive eigenvalues, but x=(1,−1)ᵀ gives xᵀAx=−8. Positive eigenvalues alone therefore do not establish positive quadratic curvature for an arbitrary matrix. This is a counterexample added by the note.

An eigenvector can change sign even when its eigenvalue is distinct. Repeated eigenvalues permit orthonormal rotations within their eigenspaces. Sorting eigenvalues therefore does not make the matrix of eigenvectors literally unique. Stable interpretation often belongs to a subspace or projector rather than the signs of individual coordinates.

6 / 12Chapter 2 Linear Algebra only, printed pp. 29 to 50; official online edition

SVD separates input directions from output directions

A decomposition that includes rectangular maps

Section 2.8, pp.42 to 43, gives the singular value decomposition for every real matrix. U and V are square orthogonal matrices in the full convention. Σ is a rectangular diagonal matrix with nonnegative singular values. V describes input coordinates, U describes output coordinates, and the singular values connect them. They need not be the same directions.

A ∈ ℝᵐˣⁿ; A=UΣVᵀ, U ∈ ℝᵐˣᵐ, V ∈ ℝⁿˣⁿ, Σ ∈ ℝᵐˣⁿ. Avᵢ=σᵢuᵢ for σᵢ>0. σ₁≥σ₂≥…≥σ_min(m,n)≥0.
AᵀA=V(ΣᵀΣ)Vᵀ; AAᵀ=U(ΣΣᵀ)Uᵀ. Nonzero eigenvalues of both products are σᵢ². rank(A)=#{i:σᵢ>0}.

The second pair of identities follows directly by cancelling UᵀU or VᵀV. It also explains why AᵀA is positive semidefinite: xᵀAᵀAx=‖Ax‖₂². Zero singular directions in input space are precisely the information that A removes. Zero output directions describe values that A can never reach.

A small rectangular map makes the geometry explicit

A=[[3,0,0],[0,1,0]]. U=I₂, V=I₃, Σ=A. AᵀA=diag(9,1,0); AAᵀ=diag(9,1).
Independent exact SVD example. A zero input direction has no paired nonzero output singular value.
Input directionOutputSingular scalingMeaning
(1,0,0)ᵀ(3,0)ᵀ3First coordinate expands
(0,1,0)ᵀ(0,1)ᵀ1Second coordinate is retained
(0,0,1)ᵀ(0,0)ᵀ0Third coordinate is lost

For a symmetric indefinite matrix, eigenvalues can be negative while singular values remain nonnegative. For a nonsymmetric matrix, eigenvalue magnitude does not fully characterize amplification. The largest singular value is the maximum of ‖Ax‖₂ over unit x. Eigenvectors answer an invariance question; singular vectors answer a stretching question.

‖A‖₂=max_(‖x‖₂=1) ‖Ax‖₂=σ₁; ‖A‖F²=Σᵢσᵢ². For symmetric A: singular values are |λᵢ|, with ordering adjusted.
7 / 12Chapter 2 Linear Algebra only, printed pp. 29 to 50; official online edition

The pseudoinverse chooses a minimum norm least squares solution

One statement covers every rank and shape

Section 2.9, pp.43 to 44, constructs the Moore Penrose pseudoinverse from the SVD. Each nonzero singular value is reciprocated and zeros remain zero. The resulting A⁺ has shape n by m. It agrees with the ordinary inverse when A is square and invertible. It does not restore a component that A erased.

A=UΣVᵀ ⇒ A⁺=VΣ⁺Uᵀ; (Σ⁺)ᵢᵢ=1/σᵢ for σᵢ>0, otherwise 0. x*=A⁺b = arg min_(x∈arg min_z ‖Az−b‖₂) ‖x‖₂.

Independent derivation: in coordinates y=Vᵀx and β=Uᵀb, the squared residual is a sum of (σ_i y_i−β_i)² over nonzero singular directions, plus the unreachable output terms. Each determined coordinate is β_i/σ_i. Coordinates in null(A) do not reduce the residual, so setting them to zero minimizes the norm. This proof covers inconsistent and rank deficient systems together.

AA⁺b = projection of b onto col(A). All least squares minimizers: x=A⁺b+(I−A⁺A)w, w∈ℝⁿ. Aᵀ(Ax*−b)=0.

A rank deficient example has both kinds of ambiguity

A=[[1,1],[0,0]], b=(2,1)ᵀ. A⁺=[[½,0],[½,0]], x*=(1,1)ᵀ, Ax*=(2,0)ᵀ.
Independent exact least squares calculation. The second target coordinate is outside col(A), so the minimum residual is nonzero.
Candidate x‖Ax−b‖₂²‖x‖₂²Interpretation
(1,1)ᵀ12Minimum residual and minimum norm
(2,0)ᵀ14Same residual, larger norm
(3,−1)ᵀ110Same residual, larger norm
(0,0)ᵀ50Smaller norm does not compensate for worse residual

The chapter also gives a limit using (AᵀA+αI)⁻¹Aᵀ as α decreases to zero. At a finite positive α, a singular direction has gain σ/(σ²+α), rather than 1/σ. This is a regularized estimator, not the exact pseudoinverse. Small nonzero singular values amplify noise in the unregularized solve, while a numerical rank threshold changes which directions are retained.

For invertible A, κ₂(A)=σmax/σmin. A=diag(1,10⁻⁶): Δb=(0,10⁻⁶)ᵀ ⇒ Δx=(0,1)ᵀ.

This conditioning example is note derived. A small right hand side perturbation can cause a much larger absolute change in the solution. SVD reveals the mechanism, but a decomposition does not repair missing or poorly measured information. Regularization introduces a bias and stability choice that needs an application specific rationale.

8 / 12Chapter 2 Linear Algebra only, printed pp. 29 to 50; official online edition

Trace measures total energy, while determinant measures volume

Cyclic order can change, arbitrary order cannot

Sections 2.10 and 2.11, pp.44 to 45, introduce trace and determinant. Trace is the sum of diagonal entries of a square matrix. The identity Tr(AB)=Tr(BA) follows from exchanging two finite summations. It remains true when AB and BA have different square sizes. More factors can be cycled only when the resulting products are defined.

A∈ℝᵐˣⁿ, B∈ℝⁿˣᵐ: Tr(AB)=ΣᵢⱼAᵢⱼBⱼᵢ=Tr(BA). Tr(ABC)=Tr(BCA)=Tr(CAB). ‖A‖F²=Tr(AᵀA)=Tr(AAᵀ).

Independent counterexample: A=[[1,0],[0,0]], B=[[0,1],[0,0]] and C=[[0,0],[1,0]] give Tr(ABC)=1 but Tr(ACB)=0. A trace does not make noncommuting matrix factors freely interchangeable. This distinction is used in the PCA objective reduction.

Volume preservation is weaker than distance preservation

For square A: det(A)=Πᵢλᵢ; |det(A)|=Πᵢσᵢ. |det(A)| is the volume scaling factor. det(A)=0 ⇔ rank(A)<n.
Independent arithmetic separates signed volume, absolute volume and metric geometry.
Map in ℝ²det(A)Singular valuesGeometric effect
diag(2,½)12, ½Area preserved, lengths generally changed
diag(−1,1)−11, 1Area and lengths preserved, orientation reversed
diag(1,0)01, 0Area collapses to a line

Trace and determinant summarize different aspects of a map. For a symmetric scatter matrix, trace adds directional energies. A determinant multiplies directional scale factors and becomes zero if any direction collapses. Neither statistic identifies each direction or its relevance to a prediction target.

9 / 12Chapter 2 Linear Algebra only, printed pp. 29 to 50; official online edition

PCA first solves the code for a fixed decoder

The objective specifies what information counts

Section 2.12, pp.45 to 50, derives linear reconstruction under squared Euclidean error. This note uses N examples, d features and k code coordinates, with k<d. The source calls these dimensions m, n and l. The decoder D has shape d by k and orthonormal columns. It is not a square orthogonal matrix.

g(c)=Dc, D∈ℝᵈˣᵏ, DᵀD=Iₖ. c*(x)=arg min_c ‖x−Dc‖₂². X∈ℝᴺˣᵈ has x⁽ⁱ⁾ᵀ in row i.

The source’s equations 2.54 to 2.67 expand and differentiate this objective. An equivalent independent derivation completes a square. Dᵀx is the component inside the decoder subspace. The orthogonal residual cannot be changed by c, so there is one optimal code for a fixed D.

‖x−Dc‖₂² = ‖c−Dᵀx‖₂² + xᵀ(I−DDᵀ)x. Therefore c*=Dᵀx and r(x)=DDᵀx.
x−DDᵀx ⟂ col(D); ‖x‖₂²=‖Dᵀx‖₂²+‖x−DDᵀx‖₂². ∇c‖x−Dc‖₂²=2c−2Dᵀx; Hessian=2Iₖ.

The Hessian establishes a strict minimum in code space. It does not make the joint search over all decoder matrices unconstrained or convex. With a full column rank decoder without the orthonormal constraint, the code instead satisfies c*=(DᵀD)⁻¹Dᵀx. The convenient encoder Dᵀ therefore depends on the constraint, not just on linear decoding.

Global reconstruction is a subspace choice

C=XD; X̂=CDᵀ=XDDᵀ. J(D)=‖X−XDDᵀ‖F², subject to DᵀD=Iₖ.

Here C contains one code per row and X̂=CDᵀ is the decoded data. The shared decoder must fit all examples, so minimizing each code separately does not complete PCA. The remaining problem chooses the k dimensional subspace.

10 / 12Chapter 2 Linear Algebra only, printed pp. 29 to 50; official online edition

PCA then retains the largest spectral energies

From reconstruction to a trace maximization

The chapter proves the case k=1 through equations 2.68 to 2.84 and states the extension to multiple components. The following independent proof covers general k directly. With S=XᵀX and P=DDᵀ, symmetry and idempotence give ‖X−XP‖F²=Tr(S)−Tr(DᵀSD). The discarded constant measures total squared input magnitude.

J(D)=Tr((I−P)S(I−P))=Tr(S)−Tr(SP)=Tr(S)−Tr(DᵀSD), P²=P=Pᵀ.
S=Q diag(λ₁,…,λ_d)Qᵀ, λ₁≥…≥λ_d≥0; Z=QᵀD, ZᵀZ=Iₖ. Tr(DᵀSD)=Σⱼ λⱼwⱼ, wⱼ=Σₐ₌₁ᵏZⱼₐ².

The weights obey 0≤w_j≤1 and sum to k. The upper bound follows because ZZᵀ is an orthogonal projector and its diagonal entries lie between zero and one. Under these constraints the weighted sum cannot exceed the sum of the largest k eigenvalues. Placing the columns of D in their eigenspaces attains the bound. This argument identifies a global optimum without a claim about a particular iterative training algorithm.

D*=Q_:,1:k; min_D J(D)=Σⱼ₌ₖ₊₁ᵈ λⱼ=Σⱼ₌ₖ₊₁ᵈ σⱼ(X)². Retained energy fraction=(Σⱼ₌₁ᵏλⱼ)/(Σⱼ₌₁ᵈλⱼ), when Tr(S)>0. σⱼ(X)=0 for j>min(N,d).

For k=1 this reduces to the Rayleigh problem dᵀSd with ‖d‖₂=1. For general k, every orthonormal basis of the same optimal subspace has the same reconstruction. A rotation D→DR with RᵀR=I_k changes the code coordinates while preserving DDᵀ. If λ_k=λ_(k+1), even the choice of the retained boundary subspace can be nonunique.

The singular values provide an exact error budget

An SVD X=UΣVᵀ supplies the same D from the leading right singular vectors. Keeping a component removes its squared singular value from the residual. This is reconstruction energy on the given data. It does not establish class information, causality, robustness or performance on unseen samples. With all data zero, the residual is zero for every admissible D and the energy fraction is undefined.

11 / 12Chapter 2 Linear Algebra only, printed pp. 29 to 50; official online edition

Centering, a complete numerical example and practical limits

Origin based reconstruction and variance are different objectives

The source derivation uses X directly and does not introduce mean subtraction. Its decoder reconstructs through the origin. The common centered covariance interpretation needs an extra operation. With μ equal to the sample mean and X_c=X−1_Nμᵀ, an affine reconstruction is μ+DDᵀ(x−μ). Then the eigenvectors of X_cᵀX_c also diagonalize the sample covariance X_cᵀX_c/(N−1), for N>1.

XᵀX=X_cᵀX_c+Nμμᵀ. Cov_sample=X_cᵀX_c/(N−1). x̂_affine=μ+DDᵀ(x−μ).

Independent example: four observations are (3,10), (−3,10), (0,11) and (0,9). Their mean is (0,10). The centered observations are (3,0), (−3,0), (0,1) and (0,−1). The table gives all quantities needed to compare a single retained direction. The two residuals optimize different decoder families, so they are not a matched algorithm benchmark.

Exact arithmetic for the note constructed dataset. The final percentage is rounded. These are not original chapter experiment results.
QuantityCentered affine PCAUncentered origin PCA
Scatter matrixdiag(18,2)diag(18,402)
Leading direction(1,0)ᵀ(0,1)ᵀ
Total squared magnitude20420
Retained squared magnitude18402
Minimum squared reconstruction error218
Retained fraction18/20 = 90%402/420 ≈ 95.7143%

Centered PCA preserves the horizontal variation and reconstructs the last two observations at (0,10), with squared errors 1 and 1. Uncentered PCA preserves the large vertical offset and reconstructs the first two at (0,10), with squared errors 9 and 9. A larger retained fraction can describe the mean rather than the variation that matters for a task.

Costs and checks have explicit boundaries

Direct dense encoding and decoding: O(dk) work per example. Stored decoder and codes: dk+Nk numbers, versus Nd data numbers, excluding a mean and metadata. Compression requires k(N+d)<Nd under this accounting.

The storage comparison counts the shared decoder as well as all codes. It excludes precision changes, means and metadata. A dense SVD that computes the nonzero singular triplets can have arithmetic cost O(min(Nd²,N²d)); partial or iterative methods have different costs and convergence conditions. Forming XᵀX also squares the nonzero singular value ratio, which can worsen numerical conditioning. These are analytical observations, not measured runtime or memory results in the book.

The mathematical checks are dimension consistency, DᵀD≈I, reconstruction residual, and agreement between retained energy plus residual and total energy. Application questions remain separate. Rescaling a feature changes the objective. An outlier can dominate squared error. A small variance direction can still contain the label. PCA therefore needs a stated centering and scaling policy, an error target and an evaluation beyond training reconstruction when used for prediction.

Coverage ends at the final paragraph of Chapter 2, printed page 50. The note has no replicated experiments, new data collection or resource allocation. The original figures retain their labels and source pages. Added proofs and worked examples establish only the stated mathematical claims. Completion of this assistant prepared unit does not establish completion of any user reading pass.

12 / 12Chapter 2 Linear Algebra only, printed pp. 29 to 50; official online edition

Original figures and source data come from the cited book chapter. Explanations and derivations are reading notes. Added examples are identified separately. Source versions, pages and figure labels appear beside the material.