Recipe
Compute a matrix's pseudoinverse
Use when: you need A^{+} for a matrix A that may be singular, rectangular, or otherwise not invertible
Goal: the pseudoinverse A^{+}=V\Sigma^{+}U^{\mathsf T}, matching A^{-1} exactly whenever A genuinely is invertible
Taught in The pseudoinverse
Quick recipe
-
1
Write A=U\Sigma V^{\mathsf T}, with \Sigma's diagonal holding the singular values in decreasing order.
Example
A=\begin{bmatrix}2&2\\2&2\end{bmatrix} is symmetric, so its SVD coincides with its eigendecomposition. Its eigenvalues are 4 and 0 (trace 4, determinant 0), with normalized eigenvectors (1,1)/\sqrt2 and (1,-1)/\sqrt2. \Sigma=\begin{bmatrix}4&0\\0&0\end{bmatrix}, \quad U=V=\frac{1}{\sqrt2}\begin{bmatrix}1&1\\1&-1\end{bmatrix}
⚡ Shortcut
If A is already known to be square and invertible, skip the SVD entirely: A^{+}=A^{-1}, the ordinary inverse, exactly.
Why: the pseudoinverse is built directly from the SVD's three pieces, so the whole construction has to start by finding them.
-
2
Read off \Sigma's diagonal and note which entries are strictly positive; call that count the rank r.
Example
Here \Sigma=\text{diag}(4,0): the first singular value is nonzero, the second is exactly 0, so r=1.
- every singular value is nonzero — A is invertible (if square), and A^{+} will equal A^{-1} exactly.
- at least one singular value is zero — A is singular or rank-deficient, and A^{+} genuinely differs from any two-sided inverse.
Why: \Sigma^{+} inverts only the nonzero singular values, so this check decides which entries actually get inverted in the next step.
-
3
Replace each nonzero singular value with its reciprocal, keep every zero exactly as zero, and match \Sigma^{+}'s shape to \Sigma^{\mathsf T}'s own shape.
Example
\Sigma=\text{diag}(4,0) is 2\times2, so \Sigma^{+} is also 2\times2: invert the 4 to 1/4, leave the 0 as 0. \Sigma^{+}=\begin{bmatrix}1/4&0\\0&0\end{bmatrix}
Why: this is the one place the pseudoinverse departs from an ordinary inverse; a zero singular value would make an ordinary inverse blow up, but \Sigma^{+} passes it through as zero.
-
4
Carry out the matrix product in exactly that order: V first, then \Sigma^{+}, then U transposed.
Example
A^{+}=\frac1{\sqrt2}\begin{bmatrix}1&1\\1&-1\end{bmatrix}\begin{bmatrix}1/4&0\\0&0\end{bmatrix}\frac1{\sqrt2}\begin{bmatrix}1&1\\1&-1\end{bmatrix}=\begin{bmatrix}1/8&1/8\\1/8&1/8\end{bmatrix}Why: reassembling in this exact order is what turns the three separate pieces back into one genuine matrix acting on the original space.
-
5
If A was invertible, confirm A^{+} equals A^{-1} exactly; if A was singular, confirm AA^{+}A=A instead.
Example
AA^{+}=\begin{bmatrix}2&2\\2&2\end{bmatrix}\begin{bmatrix}1/8&1/8\\1/8&1/8\end{bmatrix}=\begin{bmatrix}1/2&1/2\\1/2&1/2\end{bmatrix}, and multiplying that by A again gives back \begin{bmatrix}2&2\\2&2\end{bmatrix}=A.
Why: this confirms the construction satisfies the one property every genuine pseudoinverse must have, even though AA^{+} itself is visibly not the identity.
Common mistakes
- Inverting a zero singular value instead of leaving it as zero; this produces a bogus, undefined entry.
- Forgetting to match \Sigma^{+}'s shape to \Sigma^{\mathsf T} when A, and therefore \Sigma, is not square.
- Assuming AA^{+} or A^{+}A equals the identity for a singular or rectangular A; neither one generally does.
- Multiplying U, \Sigma^{+}, V in the wrong order; it must be V\Sigma^{+}U^{\mathsf T}, never U\Sigma^{+}V^{\mathsf T}.