Lecture 4 · Linear Algebra IV · September 23
From Projections to Matrix Structure
PSD, SVD, PCA, Pseudoinverse, Jacobian and Hessian
$$y=Ax,\qquad \Delta p\approx J\,\Delta q$$
- $A\in\R^{m\times n}$
- input $x\in\R^n$ to output $y\in\R^m$
- $J$
- joint change to tip change; $\approx$ needs small $\Delta q$
Which directions matter? What can we recover?
Mathematics for Robotics · ROB-GY 6013 · NYU Tandon · Jing Zhang · Fall 2026
Recall
From Projections to Matrix Structure
Least Squares: Nearest Reachable Output
$$\hat b=A\hat x,\qquad r=b-\hat b,\qquad A\T r=0$$
- $\hat b$
- nearest reachable output
- $r$
- residual, $\hat b\to b$
- $A\T r=0$
- $r\perp$ every column of $A$
Worked example
$A=[\,a\,]\in\R^{2\times1}$, $\hat x\in\R$: $\hat x=\dfrac{a\T b}{a\T a}=\dfrac42=2$, $r=b-2a=(1,-1)$.
Tuples denote columns.
Vote
From Projections to Matrix Structure
Which Candidate Output Is Closest?
$\operatorname{Col}(A)=\operatorname{span}(e_1)$ and $b=(2,1)$. Which candidate output is closest to $b$?
- A$(0,0)$
- B$(2,0)$✓
- C$(3,0)$
Squared distances $d^2=\|b-y\|^2$: $5,\ 1,\ 2$. Ranking by $d$ or by $d^2$ is the same.
$r=b-\hat b=(0,1)$ is perpendicular to $e_1$.
Vote
From Projections to Matrix Structure
Which Inputs Produce This Output?
$A=\begin{bmatrix}1&1\\0&0\end{bmatrix}$. Which inputs give the output $(2,0)$?
- Aonly $(1,1)$
- Bonly $(2,0)$
- Call three✓
$Ax=(x_1+x_2,\,0)$, and all three have $x_1+x_2=2$.
These three are only examples: the whole line $x_1+x_2=2$ works. $A(1,-1)=0$, so sliding along $(1,-1)$ changes the input, not the output.
Vote
From Projections to Matrix Structure
Which Measurement Error Grows When We Invert?
$A=\operatorname{diag}(1,\,0.01)$. Two output errors have equal length. Which grows more when we recover $x=A^{-1}y$?
×50 zoom: read the numbers, not the lengths.
- Ahorizontal $\delta_1$
- Bvertical $\delta_2$✓
- Cequally
$A^{-1}=\operatorname{diag}(1,100)$: $\ 0.008\to0.008$, $\ 0.008\to0.8$.
What $A$ squeezes most, inversion stretches most.
Concept map
From Projections to Matrix Structure
One Structure, Six Tools
1PSD$A\T A\succeq0$
2SVD$A=U\Sigma V\T$
3PCAspread of data
4Pseudoinverse$x^\star=A^+b$
5Jacobian$\Delta p\approx J\Delta q$
6Hessian$H=\nabla^2 f$
Why loop back: near a stationary point, a smooth cost changes like the quadratic form of its Hessian.
Definition
Positive Semidefinite Matrices
A Quadratic Form Gives Each Displacement a Height
$$q(x)=x\T Hx=ax_1^2+2bx_1x_2+cx_2^2$$
- $x\in\R^2$
- the input displacement
- $H=\begin{bmatrix}a&b\\b&c\end{bmatrix}$
- real and symmetric, $H=H\T$
- $Hx\in\R^2$
- a vector
- $q(x)\in\R$
- one number: the height, or cost, of $x$
Worked example
$H=\begin{bmatrix}2&1\\1&3\end{bmatrix}$, $x=(1,-1)$: $Hx=(1,-2)$, so $x\T(Hx)=1+2=3$. Check: $2-2+3=3$.
Vote
Positive Semidefinite Matrices
Which Surface Matches the Formula?
Which surface is the graph of $q(x)=4x_1^2+x_2^2$? Same camera, range and scales in all three.
floor: input space ℝ², axes x₁, x₂ · height: q(x)
- Asurface A✓4x₁² + x₂²
- Bsurface Bx₁² + 4x₂²
- Csurface Cx₁² − x₂²
Along $x_1$: $4x_1^2$, second derivative $8$; along $x_2$: $x_2^2$, second derivative $2$. Larger coefficient, steeper wall.
Definition
Positive Semidefinite Matrices
Positive Definite and Positive Semidefinite
$$\begin{aligned}H\succ0&\iff x\T Hx>0\ \text{for all } x\neq0\\H\succeq0&\iff x\T Hx\ge0\ \text{for all } x\end{aligned}$$
- $H=H\T$
- real $n\times n$; both tests assume it
- $H\succ0$
- positive definite (PD)
- $H\succeq0$
- positive semidefinite (PSD)
Every PD matrix is PSD. The trough is one PSD matrix that is not PD; the zero matrix is another.
Vote
Positive Semidefinite Matrices
Which Matrix Is PSD but Not PD?
Each surface is the graph of $x\T Hx$, one camera, one scale. Which $H$ is PSD but not PD?
floor: input space ℝ², axes x₁, x₂ · height: q(x) = xᵀHx
- A$H=\operatorname{diag}(2,1)$PD
- B$H=\operatorname{diag}(2,0)$✓PSD, not PD
- C$H=\operatorname{diag}(2,-1)$indefinite
At $x=e_2$ the heights are $1$, $0$, $-1$. B is never negative, yet it is $0$ at $e_2\neq0$.
Theorem
Positive Semidefinite Matrices
Eigenvectors Rotate the Form Into Principal Axes
Spectral theorem: real symmetric $H$ has real $\lambda_i$ and orthonormal eigenvectors $v_i$.
$$H=Q\Lambda Q\T,\qquad x\T Hx=z\T\Lambda z=\sum_i\lambda_i z_i^2$$
- $Q=[v_1\cdots v_n]$
- $Q\T Q=I$: rotation or reflection
- $\Lambda$
- diagonal $\lambda_i$
- $z=Q\T x$
- $z_i=v_i\T x$
$H\succeq0\iff$ all $\lambda_i\ge0$
$H\succ0\iff$ all $\lambda_i>0$
Vote
Positive Semidefinite Matrices
What Shape Do These Eigenvalues Make?
A symmetric $2\times2$ matrix $H$ has eigenvalues $\lambda_1=3$ and $\lambda_2=-1$. Which shape is the graph of $x\T Hx$?
floor: input space ℝ², principal coordinates z₁, z₂ · height: xᵀHx
- Abowl
- Bflat trough
- Csaddle✓
$x\T Hx=3z_1^2-z_2^2$: up along $v_1$, down along $v_2$. It takes both signs, so $H$ is indefinite.
Derivation
Positive Semidefinite Matrices
Every Gram Matrix Is PSD
$$x\T A\T Ax=(Ax)\T(Ax)=\|Ax\|^2\ge0$$
- $A\in\R^{m\times n}$
- any shape: tall, wide or square
- $A\T A$
- Gram matrix, $n\times n$: $(A\T A)\T=A\T A$
- $\ge0$
- for every $x\in\R^n$, so $A\T A\succeq0$
Worked example
$A=\begin{bmatrix}1&2\\0&1\\1&0\end{bmatrix}$, $A\T A=\begin{bmatrix}2&2\\2&5\end{bmatrix}$
$x=(1,-1)$: $\|Ax\|^2=\|(-1,-1,1)\|^2=3$
$x\T A\T Ax=2-4+5=3$
Vote
Positive Semidefinite Matrices
Which Gram Matrix Is Positive Definite?
$A_1=\mathrm{diag}(1,2)$ and $A_2=\begin{bmatrix}1&1\\0&0\end{bmatrix}$ map the unit circle as shown. Which $A\T A$ is PD?
- Aonly $A_1\T A_1$✓
- Bonly $A_2\T A_2$
- Cboth
$\|A_2x\|^2=(x_1+x_2)^2=0$ at $x=(1,-1)$. $A\T A\succ0$ exactly when $A$ has full column rank.
$A_1\T A_1=\mathrm{diag}(1,4)$
$A_2\T A_2=\begin{bmatrix}1&1\\1&1\end{bmatrix}$
Picture
Positive Semidefinite Matrices
Flat Directions Are Null Directions
$$\begin{gathered}x\T A\T Ax=\|Ax\|^2=0\iff Ax=0\\ \operatorname{Null}(A\T A)=\operatorname{Null}(A)\end{gathered}$$
- $\iff$
- a squared length is 0 only for the zero vector
- $\operatorname{Null}(A)$
- all $x\in\R^n$ with $Ax=0$
- why
- $A\T Ax=0\Rightarrow x\T A\T Ax=0\Rightarrow Ax=0$; conversely $Ax=0\Rightarrow A\T Ax=0$
Vote
Positive Semidefinite Matrices
Which Eigenvalue Sets the Long Axis?
$4z_1^2+z_2^2=1$ is the level set $x\T Hx=1$ in principal coordinates. Which eigenvalue sets its long axis?
- Athe larger
- Bthe smaller✓
- Cneither
On axis $i$, $\lambda_iz_i^2=1$, so the semiaxis is $1/\sqrt{\lambda_i}$ ($\lambda_i>0$):
larger $\lambda_i$, shorter axis.
A level set, not a circle's image (that comes with the SVD).
input space, z = Qᵀx
Definition
Positive Semidefinite Matrices
The PSD Square Root
$$H^{1/2}=Q\Lambda^{1/2}Q\T,\qquad x\T Hx=\|H^{1/2}x\|^2$$
- $H=Q\Lambda Q\T$
- PSD: $\lambda_i\ge0$, $Q=[v_1\ v_2]$
- $\Lambda^{1/2}$
- $\mathrm{diag}(\sqrt{\lambda_i})$: real as $\lambda_i\ge0$
- $H^{1/2}$
- unique symmetric PSD: $H^{1/2}H^{1/2}=H$
Worked example
$H=\mathrm{diag}(4,1)$: $Q=I$, $H^{1/2}=\mathrm{diag}(2,1)$
$x=(1,2)$: $H^{1/2}x=(2,2)$
$\|H^{1/2}x\|^2=8=x\T Hx$
Looking ahead
Positive Semidefinite Matrices
Which Input Direction Stretches Most?
$$\|Av\|^2=v\T A\T Av,\qquad\|v\|=1$$
- $A$
- $\approx\begin{bmatrix}2.61&0.42\\1.11&1.33\end{bmatrix}$, not symmetric
- $v$
- a unit input direction, turning
- $A\T A$
- its Gram matrix: symmetric PSD
Which $v$ makes $\|Av\|^2$ largest? Which makes it smallest?
Definition
Singular Value Decomposition
Input Directions Paired With Output Directions
$$Av_i=\sigma_i\,u_i,\qquad \|v_i\|=\|u_i\|=1$$
- $A$
- $m\times n$: input $\R^n$ to output $\R^m$
- $v_i\in\R^n$
- input direction; the $v_i$ are orthonormal
- $u_i\in\R^m$
- output direction; the $u_i$ are orthonormal
- $\sigma_i\ge0$
- length gain: $\sigma_i=\|Av_i\|$, $i\le\min(m,n)$
Vote
Singular Value Decomposition
Which Unit Input Comes Out Longest?
$A=\mathrm{diag}(3,1)$. Which unit input has the longest output $Ax$?
- Ahorizontal, $e_1$✓‖Ax‖ = 3
- Bvertical, $e_2$‖Ax‖ = 1
- Cdiagonal, $(e_1+e_2)/\sqrt2$‖Ax‖ = √5 ≈ 2.24
$\|Ax\|^2=9x_1^2+x_2^2$ with $x_1^2+x_2^2=1$: all of $x$ on $e_1$.
Does C’s output still point at 45°?
Definition
Singular Value Decomposition
The Full SVD and Its Shapes
$$A_{m\times n}=U_{m\times m}\,\Sigma_{m\times n}\,V\T_{n\times n}$$
- $U\T U=I_m$
- orthonormal columns $u_i$: output $\R^m$
- $V\T V=I_n$
- orthonormal columns $v_i$: input $\R^n$
- $\Sigma$
- $\sigma_1\ge\sigma_2\ge\dots\ge0$ on the diagonal, else $0$
Every real matrix has a full SVD.
Picture
Singular Value Decomposition
Orthogonal, Diagonal, Orthogonal
$$Ax=U\big(\Sigma\,(V\T x)\big)$$
- $V\T$
- orthogonal: coordinates of $x$ along $v_1,v_2$; here $R(-20^\circ)$
- $\Sigma$
- stretch coordinate $i$ by $\sigma_i$; for $m\ne n$ it also drops or adds zeros
- $U$
- orthogonal: coordinate $i$ goes along $u_i$; here $R(30^\circ)$
- $\det=\pm1$
- an orthogonal factor may reflect; here both rotate
Vote
Singular Value Decomposition
What Are the Shapes for a 3×2 Matrix?
$A$ is $3\times2$, with full SVD $A=U\Sigma V\T$. What are the shapes of $(U,\Sigma,V\T)$?
- A(3×3, 3×2, 2×2)✓product 3×2
- B(3×2, 2×2, 2×3)product 3×3
- C(2×2, 2×3, 3×3)product 2×3
$U$: square, output side $\R^3$. $V$: square, input side $\R^2$. $\Sigma$: the shape of $A$.
Picture
Singular Value Decomposition
Singular Values Are the Ellipse Semiaxes
$$\sigma_1\ge\sigma_2\ge\dots\ge\sigma_p\ge0,\qquad p=\min(m,n)$$
- $\sigma_i$
- singular values: sorted, never negative
- $p$
- how many there are
- $\{Ax:\|x\|=1\}$
- full-rank $2\times2$ $A$: an ellipse with semiaxes $\sigma_i u_i$
Vote
Singular Value Decomposition
What Are the Singular Values of This Collapse?
A $2\times2$ matrix maps the unit circle onto the segment from $-2e_1$ to $2e_1$. What are $(\sigma_1,\sigma_2)$?
- A$(2,1)$would leave height 1
- B$(2,0)$✓
- C$(0,0)$image = one point
$\sigma_1=\|Av_1\|=2$ is half the length $4$: $\pm v_1\mapsto\pm2e_1$. And $Av_2=0$, so $\sigma_2=0$.
Derivation
Singular Value Decomposition
Right Singular Vectors From the Gram Matrix
$$A\T Av_i=\lambda_iv_i,\qquad\sigma_i=\sqrt{\lambda_i}$$
- $\lambda_i$
- $=\|Av_i\|^2\ge0$: eigenvalues of PSD $A\T A$
- $v_i$
- orthonormal eigenvectors: input axes
Worked example
$A\T A\approx$
8.062.572.571.94 (rounded). Exact $A=R(30^\circ)\mathrm{diag}(3,1)R(-20^\circ)$: trace 10, det 9, $\lambda_i=9,1$, $\sigma_i=3,1$.
Derivation
Singular Value Decomposition
Left Singular Vectors: Map, Then Normalize
$$u_i=\frac{Av_i}{\sigma_i}\quad(\sigma_i>0)$$
- $\sigma_i=0$
- $Av_i=0$: pick $u_i$ to finish the basis
$$u_i\T u_j=\frac{v_i\T A\T Av_j}{\sigma_i\sigma_j}=\frac{\sigma_j^2v_i\T v_j}{\sigma_i\sigma_j}=\delta_{ij}$$
- $\delta_{ij}$
- 1 if $i=j$, else 0: orthonormal $u_i$ ($\sigma_i\sigma_j>0$)
Vote
Singular Value Decomposition
Eigenvectors or Singular Vectors?
Which statement about the SVD is true?
- AIt exists only for square $A$every $A$ has one
- BInput and output dimensions may differ✓
- CSingular values can be negative$\sigma_i=\|Av_i\|\ge0$
$v_i\in\R^n$, $u_i\in\R^m$. An eigenvector needs one space: $m=n$.
Eigenvalues may be negative or complex; $\sigma_i$ is a length.
Worked example
Singular Value Decomposition
Worked Example: A Symmetric Positive Definite Matrix
Worked example
$v_{1,2}=(1,\pm1)/\sqrt2$
$A(1,1)=(3,3)$, so $Av_1=3v_1$
$A(1,-1)=(1,-1)$, so $Av_2=1\,v_2$
$\sigma=(3,1)$, $u_i=Av_i/\sigma_i=v_i$
$$A=U\Sigma V\T=(UD)\,\Sigma\,(VD)\T$$
- $U=V$
- can be chosen exactly when $A$ is symmetric PSD
- $D$
- $\operatorname{diag}(\pm1,\pm1)$: flip $u_i$ and $v_i$ together
Transfer · choose a method
Singular Value Decomposition
A Negative Eigenvalue
$v_{1,2}=(1,\pm1)/\sqrt2$. For $x=v_1+2v_2$, find $Ax$, $\sigma_i$, $u_i$.
- A$3v_1-2v_2$✓
- B$3v_1+2v_2$misses reversal
- C$-3v_1+2v_2$wrong reversal
$Av_1=3v_1$, $Av_2=-v_2$: $\sigma=(3,1)$, $u_1=v_1$, $u_2=-v_2$. Thus $Ax=3u_1+2u_2$.
Definition
Singular Value Decomposition
The Compact SVD Keeps Only Rank r
$$A=U_r\Sigma_rV_r\T,\quad U_r\T U_r=V_r\T V_r=I_r$$
- $r$
- $\operatorname{rank}(A)$: how many $\sigma_i>0$
- $U_r,V_r$
- first $r$ columns: $m\times r$, $n\times r$
- $\Sigma_r$
- $r\times r$ diagonal, all $>0$
- $U_rU_r\T$
- $m\times m$, $\ne I_m$ if $r<m$
Thin (economy): $\min(m,n)$ columns, zeros kept.
Picture
Singular Value Decomposition
A Sum of Rank-One Maps
$$A=\sum_{i=1}^{r}\sigma_i\,u_iv_i\T\quad\Rightarrow\quad Ax=\sum_{i=1}^{r}\sigma_i\,(v_i\T x)\,u_i$$
- $u_iv_i\T$
- $m\times n$, rank one: reads along $v_i$, writes along $u_i$
- $v_i\T x$
- a signed number, the coordinate of $x$ along $v_i$
- $r$
- the number of $\sigma_i>0$
Vote
Singular Value Decomposition
Which Input Does Truncation Erase?
Keep one term of $A=3u_1v_1\T+u_2v_2\T$:
$A_1=3u_1v_1\T$. Which input does $A_1$ send to $0$?
- A$v_1$$\mapsto 3u_1$
- B$v_2$✓
- C$v_1+v_2$$\mapsto 3u_1$
$A_1x=3\,(v_1\T x)\,u_1$ reads only the $v_1$ coordinate, and $v_1\T v_2=0$: $\mathrm{Null}(A_1)=\mathrm{span}(v_2)$, a whole line.
Picture
Singular Value Decomposition
The Four Subspaces From U and V
Full SVD: $U$ is $m\times m$, $V$ is $n\times n$. Example: the all-ones $3\times2$ matrix, rank $r=1$.
$\mathrm{Row}(A)=\mathrm{span}(v_1,\dots,v_r)$, dim $r$
$\mathrm{Null}(A)=\mathrm{span}(v_{r+1},\dots,v_n)$, dim $n-r$
$\mathrm{Col}(A)=\mathrm{span}(u_1,\dots,u_r)$, dim $r$
$\mathrm{Null}(A\T)=\mathrm{span}(u_{r+1},\dots,u_m)$, dim $m-r$
Vote
Singular Value Decomposition
Rank and Nullity From Singular Values
A $3\times3$ matrix has singular values $5,\,2,\,0$. Which pair is (rank, nullity)?
- A$(3,0)$a zero gain adds no rank
- B$(2,1)$✓
- C$(1,2)$2 is small, not zero
rank $=\#\{\sigma_i>0\}=2$; nullity $=n-\text{rank}=1$, $\mathrm{Null}(A)=\mathrm{span}(v_3)$.
Theorem
Singular Value Decomposition
The Best Rank-k Approximation
$$A_k=\sum_{i=1}^{k}\sigma_iu_iv_i\T\in\arg\min_{\operatorname{rank}B\le k}\|A-B\|_F$$
- $\|M\|_F^2$
- $\sum_{i,j}M_{ij}^2$
- $\|A-A_k\|_F^2$
- $\sum_{i>k}\sigma_i^2$, the error
- $k$
- $0\le k\le r$; $A_r=A$
- $B$
- any matrix with $\operatorname{rank}\le k$
- Eckart–Young
- no proof; may not be unique if $\sigma_k=\sigma_{k+1}>0$
Next: each row of $A$ is one data sample.
Definition
Principal Component Analysis
Data as a Matrix: One Row per Sample
$$X=\begin{bmatrix}x_1\T\\ \vdots\\ x_N\T\end{bmatrix}\in\R^{N\times d}$$
- $x_j\in\R^d$
- sample $j$: one point in feature space
- $N$
- rows = samples; here $N=8$
- $d$
- columns = features; here $d=2$
Sixteen numbers, but a thin cloud. Could one number per sample nearly do?
Vote
Principal Component Analysis
Which Line Best Summarizes the Cloud?
Which line through the mean gives the smallest sum of squared perpendicular distances?
- Athe horizontal line
- Bthe long-axis line✓
- Cthe short-axis line
Orange: perpendicular reconstruction distances, not the vertical regression residuals of Lecture 3. Long axis: $8\times0.3^2=0.72$.
Definition
Principal Component Analysis
Centering Moves the Mean to the Origin
$$\mu=\frac1N\sum_{j=1}^{N}x_j,\qquad X_c=X-\mathbf 1\mu\T$$
- $\mu\in\R^d$
- mean sample, in feature space
- $\mathbf 1\in\R^N$
- all ones; $\mathbf 1\mu\T$ is $N\times d$, each row $\mu\T$
- $X_c$
- $N\times d$, row $j$ is $(x_j-\mu)\T$; columns sum to $0$
Worked example
Row sums $(24,16)$: $\mu=(3,2)$; $x_1\approx(-0.18,0.51)$, $x_1-\mu\approx(-3.18,-1.49)$
Vote
Principal Component Analysis
What Does an Uncentered SVD Find?
$\|Xv\|^2=\sum_j(x_j\T v)^2$ weighs raw vectors: $\|Xe_1\|^2=700.18$, $\|Xe_2\|^2=7$.
Centered, the vectors are nearly vertical, and so is $v_1$ of $X_c$.
Uncentered $X$: what does its first right singular vector $v_1$ mostly reflect?
- Athe cloud’s offset from the origin✓
- Bthe largest variation around the mean, guaranteed
- Cthe number of samples $N$
Definition
Principal Component Analysis
Sample Covariance and Directional Variance
$$C=\frac{X_c\T X_c}{N-1},\qquad \frac{1}{N-1}\sum_{j}(x_{c,j}\T v)^2=v\T Cv$$
- $x_{c,j}\T$
- row $j$ of $X_c$
- $v\in\R^d$
- unit direction
- left side
- variance of the $N$ projections (mean $0$): sum of squares over $N-1$
- $C$
- $d\times d$, symmetric, PSD; $N>1$
Worked example
$v=e_1$: $v\T Cv=C_{11}=31.68/7\approx4.53$, the variance of feature 1.
Derivation
Principal Component Analysis
The SVD of Centered Data Gives PCA
$$X_c=U\Sigma V\T,\qquad Cv_i=\frac{\sigma_i^2}{N-1}\,v_i$$
- why
- $X_c\T X_c=V\Sigma\T\Sigma V\T$
- $v_i\in\R^d$
- feature space: principal directions; $v_1$ maximizes $v\T Cv$ over unit $v$
- $u_i\in\R^N$
- sample space: $u_i=X_cv_i/\sigma_i$ if $\sigma_i>0$; one entry per sample
- $\sigma_i^2$
- $=\|X_cv_i\|^2$; variance along $v_i$ is $\sigma_i^2/(N-1)$
Vote
Principal Component Analysis
How Much Variance Does One Component Keep?
A new small example: centered data have singular values $\sigma_1=3$, $\sigma_2=1$. What share of the total variance does the first component keep?
- A75%3/(3+1): σ not squared
- B90%✓9/(9+1)
- C50%counts components
Variance along $v_i$ is $\sigma_i^2/(N-1)$: square first, then share. $N-1$ cancels.
Definition
Principal Component Analysis
Coordinates, Then Reconstruction
$$Z=X_cV_k,\quad\hat X=ZV_k\T+\mathbf1\mu\T$$
- $V_k$
- first $k$ columns of $V$, $d\times k$, orthonormal
- $Z$
- $N\times k$ scores, one row per sample
- $\hat X$
- $N\times d$; $ZV_k\T=X_cV_kV_k\T$: best rank-$k$ approximation of $X_c$
Worked example
$x_8\approx(5.88,4.01)$: $z_8=(x_8-\mu)\T v_1\approx3.5$, $\hat x_8=\mu+3.5v_1\approx(6.03,3.75)$, error $0.3$
Transfer · center, encode, reconstruct
Principal Component Analysis
Center, Encode, Reconstruct
$\mu=(1,-1)$, $x=(3,-1)$, $v_1=(1,1)/\sqrt2$. Find $z$ and $\hat x$ in original coordinates; diagram: centered.
- A$z=\sqrt2,\ \hat x=(2,0)$✓
- B$z=2,\ \hat x=(3,1)$$(1,1)$ is not unit
- C$z=1,\ \hat x=(2,-1)$off the line
$x_c=x-\mu=(2,0)$, $z=\sqrt2$;
$\hat x=\mu+zv_1=(2,0)$, $x-\hat x=(1,-1)\perp v_1$.
In practice
Principal Component Analysis
Units, Scale and What Variance Means
$$\text{kept}_k=\frac{\sum_{i\le k}\sigma_i^2}{\sum_i\sigma_i^2}$$
- $\sigma_i$
- singular values of $X_c$
- $\text{kept}_k$
- share in $k$ components; undefined if $X_c=0$
- Same samples, new units, new $v_1$.
- Center first. Standardizing is a modeling choice, not an automatic cure.
- Large variance need not mean task relevance.
Derivation
Pseudoinverse and Conditioning
Reversing the SVD One Coordinate at a Time
$$\begin{matrix}a_{11}x_1+a_{12}x_2=b_1\\a_{21}x_1+a_{22}x_2=b_2\end{matrix}\iff\begin{matrix}\sigma_1c_1=d_1\\\sigma_2c_2=d_2\end{matrix}$$
- $c=V\T x$
- $x$ along $v_1,v_2$
- $d=U\T b$
- $b$ along $u_1,u_2$
- $\sigma_i>0$
- one per row: $c_i=d_i/\sigma_i$
- $\sigma_i=0\ne d_i$
- $0=d_i$: no solution
- $\sigma_i=0=d_i$
- $c_i$ free: take $0$
Vote
Pseudoinverse and Conditioning
Which Input Produces This Output?
$A=\begin{bmatrix}3&0\\0&1\end{bmatrix}$, $b=(6,2)$. Which $x$ gives $Ax=b$?
- A$x=(18,2)$Ax = (54, 2)
- B$x=(2,2)$✓Ax = (6, 2)
- C$x=(2,6)$Ax = (6, 6)
Divide by each gain: $x_1=6/3$, $x_2=2/1$.
Definition
Pseudoinverse and Conditioning
The Pseudoinverse
$$A^+=V_r\Sigma_r^{-1}U_r\T=\sum_{i=1}^{r}\frac{1}{\sigma_i}v_iu_i\T$$
- $A\in\R^{m\times n}$
- $A^+\in\R^{n\times m}$; rank $r$
- $\sigma_i>0$
- inverted; a zero gain is not: what is lost stays lost
- $r=0$
- $A^+=0$
Worked example
$A=\begin{bmatrix}1&0\\0&0\\0&2\end{bmatrix}$, $\sigma=(2,1)$: $A^+=\begin{bmatrix}1&0&0\\0&0&\frac12\end{bmatrix}$
Vote
Pseudoinverse and Conditioning
What Does the Pseudoinverse Return?
$A=\begin{bmatrix}2&0\\0&0\end{bmatrix}$, $b=(4,3)$. What is $A^+b$?
- A$(2,0)$✓Ax = (4, 0)
- B$(2,3)$same residual, longer $\|x\|$
- Cnone: no exact solutionA⁺ always exists
$A^+=\begin{bmatrix}\frac12&0\\0&0\end{bmatrix}$ leaves the zero gain alone. $A^+b$ exists even when $Ax=b$ has no solution.
Picture
Pseudoinverse and Conditioning
Two Projectors: Output Side and Input Side
$$AA^+=U_rU_r\T,\qquad A^+A=V_rV_r\T$$
- $AA^+$
- $m\times m$, projects onto $\operatorname{Col}(A)$
- $A^+A$
- $n\times n$, projects onto $\operatorname{Row}(A)$
- $\ne I$
- unless $r=m$, resp. $r=n$
Here $A=\begin{bmatrix}2&2\\1&1\end{bmatrix}$, rank 1.
output space ℝᵐ, m = 2
input space ℝⁿ, n = 2
Definition
Pseudoinverse and Conditioning
Minimum-Norm Least Squares
First minimize the residual $\|b-Ax\|$; then take the smallest norm among tied minimizers.
$$x=x^\star+z:\quad\|x\|^2=\|x^\star\|^2+\|z\|^2$$
- $x$
- any minimizer; $z\in{}$Null($A$)
- $x^\star=A^+b$
- in Row($A$), so $x^\star\perp z$
- $\|x\|^2$
- squared norm: least only at $z=0$
Worked example
$A=[1\ \ 2]$, $b=5$: $A^+=(1,2)/5$, $x^\star=(1,2)$, $\|x^\star\|^2=5$
Vote
Pseudoinverse and Conditioning
Which Solution Has the Smallest Norm?
All three solve $x_1+x_2=2$. Which has the smallest norm $\|x\|$?
- A$(2,0)$‖x‖² = 4
- B$(1,1)$✓‖x‖² = 2
- C$(0,2)$‖x‖² = 4
The first circle to touch the line is tangent to it, so the radius there is perpendicular to it: $x^\star\perp(1,-1)$, the null direction.
Picture
Pseudoinverse and Conditioning
Small Gains Amplify Noise
$$\delta x=\sum_{\sigma_i>0}\frac{u_i\T\delta b}{\sigma_i}v_i$$
- $\delta x\in\R^n$
- input error (mm)
- $\delta b\in\R^m$
- output error (mm)
- $A$ fixed
- $x^\star+\delta x=A^+(b+\delta b)$: only $b$ moves
Worked example
$A=\mathrm{diag}(2,0.25)$, $\|\delta b\|=0.1$ mm.
Along $u_1$: $0.1/2=0.05$ mm along $v_1$.
Along $u_2$: $0.1/0.25=0.4$ mm along $v_2$: 8 times.
Vote
Pseudoinverse and Conditioning
Which Perturbation Moves the Input More?
Both output errors have length $0.01$. Which gives the larger input error $\|\delta x\|$?
- A$\delta b=(0.01,\,0)$$\|\delta x\|=0.01$
- B$\delta b=(0,\,0.01)$✓$\|\delta x\|=1$
- Cthe same for bothgains differ
Along $u_i$, $\|\delta x\|=\|\delta b\|/\sigma_i$: $0.01/1$ against $0.01/0.01$. Equal $\|\delta b\|$, unequal $\|\delta x\|$.
Definition
Pseudoinverse and Conditioning
Conditioning and Rank
$$\|A\|_2=\sigma_{\max},\quad\kappa_2(A)=\frac{\sigma_{\max}}{\sigma_{\min}},\quad r_\tau=\#\{i:\sigma_i>\tau\}$$
- $\|A\|_2,r_\tau$
- any $A$, $\tau\ge0$
- $\kappa_2$
- full rank; else $\infty$ by convention
- $1/\sigma_{\min}$
- absolute; $\kappa_2$ relative
- scope
- fixed invertible $A$; $Ax=b\ne0$, only $b$ moves
Conditioning is the problem’s, stability the algorithm’s.
Vote
Pseudoinverse and Conditioning
Which Matrix Is Worse Conditioned?
Image ellipses of $A$ and $B$ at one scale. Which is worse conditioned?
- A$A=\mathrm{diag}(10,1)$✓$\kappa_2=10$
- B$B=\mathrm{diag}(2,1)$$\kappa_2=2$
- Cequally conditionedsame $\sigma_{\min}$ only
$\kappa_2$ is the axis ratio, not the size. Same $\sigma_{\min}$: same absolute gain, not same relative sensitivity.
Definition
Pseudoinverse and Conditioning
Damped Least Squares
Minimize $\|Ax-b\|^2+\lambda^2\|x\|^2$.
$c_i=v_i\T x$, $d_i=u_i\T b$, $\lambda>0$.
$$\phi_i(c_i)=(\sigma_i c_i-d_i)^2+\lambda^2c_i^2$$
- $\phi_i$
- fit + penalty
Use $h_i=\sigma_i^2+\lambda^2>0$. Complete square:
$\phi_i=h_i(c_i-\sigma_i d_i/h_i)^2+\lambda^2d_i^2/h_i$.
$c_i^\star=\sigma_i d_i/h_i$; $x_\lambda=\sum_{i=1}^{r}c_i^\star v_i$.
Unique; gain $\le1/(2\lambda)$.
Vote
Pseudoinverse and Conditioning
What Happens as Damping Grows?
Fix $A,b$. As $\lambda$ grows $0\to3$, what do $\|x_\lambda\|$ and $\|r_\lambda\|$ do?
- A$\|x_\lambda\|$ nonincreasing, $\|r_\lambda\|$ nondecreasing✓
- B$\|x_\lambda\|$ increases, $\|r_\lambda\|$ always decreasesnorm falls
- C$b$ stays exactly attainedresidual grows
No gain $\sigma_i/(\sigma_i^2+\lambda^2)$ grows with $\lambda$. Not always strictly: take $b=0$.
In practice
Pseudoinverse and Conditioning
Choosing a Solver
| Solver | Needs | Gives |
| thin QR, Lecture 3 | full column rank | $R\hat x=Q\T b$ |
| SVD | any $A$ | $A^+b$, minimum norm |
| damped | $\lambda>0$ | $x_\lambda$ (new objective), gains $\le1/(2\lambda)$ |
$$\kappa_2(A\T A)=\kappa_2(A)^2$$
- $A$, $r=n$
- $\kappa_2=\sigma_1/\sigma_n$
- $A\T A$
- gains $\sigma_i^2$
In code, solve systems, never invert. QR exists for every $A$.
Picture
Jacobians and Robot Motion
Forward Kinematics Is Nonlinear
$$p=f(q),\qquad q\in\R^n,\ \ p\in\R^m$$
- $q$
- joint vector: $n$ angles in radians here; a prismatic joint would contribute a length
- $p$
- tip position only: $m$ task coordinates, no orientation
- $f$
- forward kinematics: sines and cosines of $q$, not a matrix
Vote
Jacobians and Robot Motion
Does the Same Joint Change Move the Tip the Same Way?
Both shoulders turn $+5^\circ$, elbows fixed. The tip changes $\Delta p$ are…
- Aalways identical≈0.172 vs ≈0.060 long
- Bgenerally pose-dependent✓
- Cdetermined only by joint countsame 2 joints
The shoulder swings the tip on a circle of radius $r$: $|\Delta p|\approx r\,\Delta q_1$ with $\Delta q_1=5^\circ\approx0.0873$ rad, not $5$.
Recall
Jacobians and Robot Motion
The Derivative as a Local Gain
$$f(q+\Delta q)\approx f(q)+f'(q)\,\Delta q$$
- $f'(q)$
- local gain: output change per radian, at this $q$
- $\Delta q$
- step in radians; for small steps the model error shrinks like $\Delta q^2$
Worked example
$q=30^\circ$: $f=0.5$, $f'=\cos30^\circ\approx0.866$. Step $\Delta q=0.2$ rad: model $\approx0.673$, actual $\approx0.662$.
Definition
Jacobians and Robot Motion
The Jacobian Matrix
$$J_{ij}(q)=\frac{\partial f_i}{\partial q_j}(q),\qquad J(q)\in\R^{m\times n}$$
- row $i$
- output $p_i=f_i(q)$, $i=1,\dots,m$
- column $j$
- joint $q_j$, $j=1,\dots,n$; the other joints held fixed
$$\Delta p\approx J(q)\,\Delta q$$
- $\Delta q\in\R^n$
- a small joint change, in radians; $\Delta p\in\R^m$
Vote
Jacobians and Robot Motion
What Shape Is This Jacobian?
An arm has 7 joints. The task is only its 3D tip position. What shape is $J$?
- A$7\times3$ℝ³ → ℝ⁷
- B$3\times7$✓ℝ⁷ → ℝ³
- C$7\times7$ℝ⁷ → ℝ⁷
$J$ is $m\times n$: one row per task coordinate, one column per joint, so $J\Delta q$ takes $\Delta q\in\R^7$ to $\Delta p\in\R^3$.
Picture
Jacobians and Robot Motion
Columns Are Joint Effects
$$J=\begin{bmatrix}j_1&\cdots&j_n\end{bmatrix},\ \ J\Delta q=\sum_{j=1}^{n}j_j\,\Delta q_j$$
- $j_j\in\R^m$
- column $j$: tip length per radian of joint $j$ alone
- $\Delta q_j$
- how far joint $j$ turns; the contributions add
- $j_j(q)$
- changes with the pose $q$
Drawn: $\dot p=J\dot q$ at $\dot q=(1,1)$ rad/s, $q=(30^\circ,60^\circ)$: velocities, not paths.
Vote
Jacobians and Robot Motion
Which Way Does the Tip Move?
$$J=\begin{bmatrix}0&-1\\2&0\end{bmatrix}$$
- $J$
- given; task axes $x$ right, $y$ up
Only joint 1 turns, by a small $\varepsilon>0$: $\Delta q=(\varepsilon,0)$. The tip mainly moves…
- ArightΔq’s own axis
- Bup✓
- Cleftcolumn 2
Column 1, not row 1 $(0,-1)$: $\Delta p\approx\varepsilon j_1=(0,2\varepsilon)$
Derivation
Jacobians and Robot Motion
Worked Model: The Two-Link Arm
$$p=\begin{bmatrix}l_1\cos q_1+l_2\cos q_{12}\\l_1\sin q_1+l_2\sin q_{12}\end{bmatrix}$$
- $q_{12}$
- $q_1+q_2$
- $l_1,l_2>0$
- lengths; radians
$$j_1=\begin{bmatrix}-l_1\sin q_1-l_2\sin q_{12}\\l_1\cos q_1+l_2\cos q_{12}\end{bmatrix}$$
- $j_1$
- $\partial p/\partial q_1$
$$j_2=\begin{bmatrix}-l_2\sin q_{12}\\l_2\cos q_{12}\end{bmatrix}$$
- $j_2$
- $\partial p/\partial q_2$
Vote
Jacobians and Robot Motion
Which Tip Velocities Are Available?
Straight arm, $q=(0,0)$: $J=\begin{bmatrix}0&0\\2&1\end{bmatrix}$. Which nonzero tip velocities $J\dot q$ exist?
- Aonly horizontal, along the arm
- Bonly vertical, across the arm✓
- Cany direction in the plane
Rank $1<2$: a singular configuration; $\det J=l_1l_2\sin q_2=0\iff q_2=k\pi$.
A finite bend still moves the tip inward; a least-squares step still exists.
Picture
Jacobians and Robot Motion
The SVD of the Jacobian
$$J=U\Sigma V\T,\qquad Jv_i=\sigma_i u_i$$
- $v_i$
- unit joint velocity: both joints move together
- $u_i$
- unit tip direction in task space
- $\sigma_i$
- local gain at this $q$: $1.62$ and $0.62$
$$\dot p=J(q)\,\dot q$$
- $\dot q,\ \dot p$
- joint and tip velocities; exact by the chain rule
- $\Delta p\approx J\Delta q$
- finite steps: first order only
Vote
Jacobians and Robot Motion
Which Direction Needs Less Joint Speed?
J(30°, 90°) ≈−1.37 −0.87
0.37 −0.50
The tip must move at the same speed $c$, along $u_1$ or $u_2$. Which needs the smaller joint speed $\|\dot q\|$?
- Aalong $u_1$, the long axis✓
- Balong $u_2$, the short axis
- Cthe same for both
$J(\alpha v_i)=\alpha\sigma_iu_i$ has speed $c$ at $\alpha=c/\sigma_i$, when $\sigma_i>0$: more gain, less joint speed.
Worked example
Jacobians and Robot Motion
Inverse Local Step
J(30°,90°) ≈−1.37 −0.87
0.37 −0.50
$$\dot q^\star=J^+\dot p_d$$
- $\dot p_d$
- target
- $J^+$
- best fit, min $\|\dot q\|$
- $r$
- $\dot p_d-J\dot q^\star$
Example
Full rank: $(-1,0)\mapsto(0.50,0.37)$ approx..
Rank 1: $\dot p_d=(.5,1.5)$, $a=(1,.5)$.
$s=\dot q_1+2\dot q_2$; $s^\star=(a\T\dot p_d)/(a\T a)=1$.
Min norm: $\dot q^\star=(1,2)/5$.
$J\dot q^\star=(1,0.5)$; $r=(-0.5,1)$.
Vote
Jacobians and Robot Motion
Which Joint Velocity Leaves the Tip Still?
The straight arm again. Which joint velocity gives $J\dot q=0$?
- A$\dot q=(1,0)$Jq̇ = (0, 2)
- B$\dot q=(1,-2)$✓Jq̇ = (0, 0)
- C$\dot q=(1,2)$Jq̇ = (0, 4)
$1\cdot(0,2)+(-2)\cdot(0,1)=0$: the two column effects cancel exactly.
Exact now, not later: held for time $t$, $q=t(1,-2)$ puts the tip at $(2\cos t,\,0)$, drifting inward.
Picture
Jacobians and Robot Motion
Redundancy and Null Motion
$$\dot q=J^+\dot p_{\rm d}+z,\qquad Jz=0$$
- $J$
- $2\times3$: two tip coordinates, three joints, rank 2
- $z$
- null motion, nullity $n-\mathrm{rank}\,J=1$: $z$ contributes exactly zero tip velocity
Each finite step: first order only
$q\leftarrow q+h\,\hat z(q)$, with $\hat z$ a unit vector in $\mathrm{Null}\,J(q)$
then correct: $q\leftarrow q+J^+\big(p^\star-p(q)\big)$
Vote
Jacobians and Robot Motion
What Does Damping Do Near a Singularity?
With $\lambda=0.1$ the damped step minimises $\|J\dot q-\dot p_{\rm d}\|^2+\lambda^2\|\dot q\|^2$. What does damping do?
- Ahits every desired $\dot p_{\rm d}$ exactly
- Baccepts task error to reduce joint speed✓
- Cchanges the arm’s link lengths
The weak direction is mostly given up: its gain $\sigma_2/(\sigma_2^2+\lambda^2)$ stays below $1/(2\lambda)$.
In practice
Jacobians and Robot Motion
Damped Steps
$$\dot q_\lambda=J\T(JJ\T+\lambda^2I)^{-1}\dot p_{\rm d},\quad\lambda>0$$
- $J$
- $m\times n$ at this $q$
- $JJ\T+\lambda^2I$
- $m\times m$, positive definite
- why
- $(J\T J+\lambda^2I)J\T=J\T(JJ\T+\lambda^2I)$
| steps | largest model error | final target error |
| 1 | 0.24 | 0.20 |
| 4 | 0.024 | 0.036 |
| 8* | 0.0064 | 0.018 |
*computed. Smaller steps reduce model error faster than target error; limits separate.
Definition
Hessians and Local Curvature
From Vector Outputs to a Scalar Objective
$$f:\R^n\to\R,\qquad \nabla f(x)\in\R^{n},\qquad H(x)=\nabla^2 f(x)\in\R^{n\times n}$$
- $f(x)$
- one number, the objective at parameters $x$
- $\nabla f(x)$
- $n\times1$, the local slope, pointing uphill
- $H(x)$
- $n\times n$, how $\nabla f$ changes as $x$ moves; same letter as the quadratic forms, on purpose
- $J(q)$
- vector output $p(q)\in\R^m$: $m\times n$
Vote
Hessians and Local Curvature
Which Curve Has a Local Minimum at 0?
All three have $f'(0)=0$. Which one has a local minimum at $t=0$?
parameter t ∈ ℝ, height f(t)
- A$f(t)=t^2$✓f″(0) = 2
- B$f(t)=-t^2$f″(0) = −2
- C$f(t)=t^3$f″(0) = 0
A flat tangent is not enough. The sign of $f''(0)$ separates A from B; C crosses its flat tangent, so it is neither.
Definition
Hessians and Local Curvature
Hessian Entries
$$H_{ij}(x)=\partial_{x_j}(\partial_{x_i}f)(x),\qquad i,j=1,\dots,n$$
- $H_{ij}$
- row $i$: slope; column $j$: input
- $f\in C^2$
- continuous second partials near $x$
- then
- $H_{ij}=H_{ji}$: $H=H\T$, symmetric $n\times n$
Model
Hessians and Local Curvature
The Second-Order Approximation
$$f(x+\Delta x)\approx f(x)+\nabla f(x)\T\Delta x+\frac12\Delta x\T H(x)\Delta x$$
- $x$
- fixed expansion point; $f\in C^2$
- $\Delta x$
- small step
- $\nabla f$
- $n\times1$, tilt: tangent plane
- $H$
- $n\times n$, bend: quadratic model
Worked example
$f=e^{x_1}-1-x_1+\frac12(x_2-x_1)^2$, $x=(0,1)$: $f(x)=\frac12$, $\nabla f=(-1,1)$, $H=\begin{bmatrix}2&-1\\-1&1\end{bmatrix}$
Vote
Hessians and Local Curvature
What Is the Hessian of This Bowl?
$f(x_1,x_2)=2x_1^2+\tfrac12x_2^2$. Which matrix is its Hessian?
- A200$\frac12$$B$, the coefficients
- B4001✓
- C1004axes swapped
Differentiate twice: $4x_1$ then $4$; $x_2$ then $1$. No $x_1x_2$ term, so mixed $0$.
$a\,x_i^2$ gives $H_{ii}=2a$. Name the coefficients $B$: $f=x\T Bx=\tfrac12x\T Hx$, so $H=2B=\mathrm{diag}(4,1)$.
Definition
Hessians and Local Curvature
Curvature Along a Direction
$$g(t)=f(x+tv),\qquad g''(0)=v\T H(x)\,v$$
- $v$
- direction, unit: $\|v\|=1$, so directions compare fairly
- $g$
- height of $f$ along the line through $x$
- $g''(0)$
- second derivative along that line, not the surface's geometric curvature
- why
- $g'(t)=\nabla f(x+tv)\T v$; differentiate once more
- here
- $f=\tfrac12x\T Hx$, $H=\begin{bmatrix}3&1\\1&2\end{bmatrix}$, $x=0$
Vote
Hessians and Local Curvature
Which Direction Curves Up Most?
Along which unit $v$ is $g''(0)=v\T Hv$ largest?
- A$v=e_1$✓= 4
- B$v=e_2$= 1
- C$v=\tfrac{1}{\sqrt2}(1,1)$, at $45^\circ$= 2.5
C gives $\tfrac12(4+1)$, an average. For unit $v$: $4v_1^2+v_2^2\le4$, with equality only at $v=\pm e_1$.
Second-derivative test
Hessians and Local Curvature
Classifying a Stationary Point
$$f(x^\star+\Delta x)\approx f(x^\star)+\tfrac12\Delta x\T H(x^\star)\Delta x$$
Local tests only. $f\in C^2$ on a convex open set: convex $\iff H(x)\succeq0$ at every $x$.
- $x^\star,\Delta x$
- stationary point ($\nabla f=0$), small step
- $f$
- $C^2$ near $x^\star$: $H$ symmetric $n\times n$
- $\lambda_i$
- eigenvalues of $H(x^\star)$: their signs decide
Vote
Hessians and Local Curvature
Does a PSD Hessian Decide?
$$f_\pm(x,y)=x^2\pm y^4$$
- $(x,y)$
- any point; both are $C^2$
- at $(0,0)$
- $\nabla f_\pm(0,0)=0$, $H_\pm(0,0)=\mathrm{diag}(2,0)$
Can this Hessian alone classify both points?
- AYes: both are minimaf₋ falls along y
- BYes: both are saddlesf₊ rises along y
- CNo: higher-order terms matter✓
$f_+$: strict minimum with $H$ only PSD. PD is sufficient, not necessary.
parameter space ℝ²
Derivation
Hessians and Local Curvature
The Least-Squares Hessian
$$f(x)=\tfrac12\|Ax-b\|^2,\qquad \nabla f(x)=A\T(Ax-b),\qquad H=A\T A$$
- $H$
- Hessian
1224 $=A$, $b=(1,0)$: best output, shortest input, curvature?
Project onto $Ax=(1,2)s$.
$s=1/5$, $\hat b=(1,2)/5$, $r=(4,-2)/5$
$x_1+2x_2=1/5$; shortest $x=(1,2)/25$
$\lambda(H)=25,0$
Flat direction $(2,-1)$; $\min f=2/5$.
surfaces: b = 0
A = 100111 full column rank
A = 1224 rank 1
Vote
Hessians and Local Curvature
What Shape Is This Least-Squares Objective?
$f=\tfrac12\|Ax-b\|^2$. Choose a method; find $A\hat x,r,A^+b$, a flat direction and the graph shape.
- AA bowl with one lowest pointAᵀA singular
- BA trough, bottom: $x_1+x_2=2$✓
- CA saddleAᵀA ⪰ 0
$Ax=(2,0)$, $r=(0,1)$: $\min f=1/2$.
$A^+b=(1,1)$; flat direction $(1,-1)$.
Connection
Hessians and Local Curvature
Closing the Loop: Hessian, Gram Matrix, SVD
$$H=A\T A=V\Sigma\T\Sigma V\T,\quad H_\lambda=A\T A+\lambda^2 I\succ0$$
- $V,\Sigma\T\Sigma$
- SVD of $A$; diagonal $\sigma_i^2$, then zeros
- $H_\lambda$
- Hessian of $\tfrac12\|Ax-b\|^2+\tfrac{\lambda^2}2\|x\|^2$, $\lambda>0$
Damped LS as earlier, no halves: Hessian $2H_\lambda$, same minimiser.
Next lecture: systematic derivatives.
Concept map
Connecting the Concepts
One Matrix, Five Jobs
Structure
$A\T A\succeq0,\ \ A=U\Sigma V\T$
stretch directions and gains
Compression
$Z=X_cV_k$
k scores per sample
Recovery
$x^\star=A^+b$
best fit, then smallest input
Motion
$\Delta p\approx J\Delta q$
tip change from a joint change
Curvature
$\Delta f\approx g\T\Delta x+\tfrac12\Delta x\T H\Delta x$
$g=\nabla f$; for $\tfrac12\|Ax-b\|^2$, $H=A\T A$
Vote
Connecting the Concepts
Exit Question: Rank, Step and Curvature
Linear model: $J=$ 2000, desired $\Delta p=(2,1)$.
Which set is right?
- Arank 2, minimum-norm step $(1,1)$, $J\T J$ PD
- Brank 1, minimum-norm LS step $(1,0)$, $J\T J$ PSD but not PD✓JᵀJ=diag(4,0)
- Crank 1, minimum-norm step $(2,0)$, target exactly reachable
Why a best step if $r\ne0$? Why $\Delta q_2=0$?