Images as Matrices: Low-Rank Approximation, Storage Cost and Reconstruction Error

An image is a matrix

A grayscale image with mm rows and nn columns of pixels is a real m×nm \times n matrix AA, each entry holding one intensity. Stored naively it costs mnmn numbers. The compression question is whether a matrix that came from a photograph, a scan or a satellite image has structure that a smaller collection of numbers can capture.


It usually does. Real images are full of repeated and smoothly varying structure: a clear sky, a wall, a gradient of shading. Repeated and smoothly varying structure can make the rows and columns lie approximately in low-dimensional subspaces. Near-proportional rows or columns are the special case of approximate rank one.

The singular value decomposition and its truncation

Every real m×nm \times n matrix factors as


A=UΣVT=∑i=1rσi uiviT,σ1≥σ2≥⋯≥σr>0,A = U\Sigma V^{\mathsf{T}} = \sum_{i=1}^{r} \sigma_i\, u_i v_i^{\mathsf{T}}, \qquad \sigma_1 \ge \sigma_2 \ge \cdots \ge \sigma_r \gt 0,


with orthonormal ui∈Rmu_i \in \mathbb{R}^m, orthonormal vi∈Rnv_i \in \mathbb{R}^n, and rr the rank. Each term σiuiviT\sigma_i u_i v_i^{\mathsf{T}} is a separable rank-one image: every row is a scaled copy of one fixed row profile, and every column is a scaled copy of one fixed column profile. The sum layers them in order of decreasing weight.


Keeping the first kk terms gives the truncated SVD, or rank-kk approximation:


Ak=∑i=1kσi uiviT.A_k = \sum_{i=1}^{k} \sigma_i\, u_i v_i^{\mathsf{T}} .


The Eckart–Young theorem says this is the best possible choice: among all matrices of rank at most kk, AkA_k minimises ∥A−B∥F\lVert A - B \rVert_F, and it minimises the spectral norm of the error as well. No cleverer rank-kk approximation exists.

What a rank-k image actually costs to store

Storing AkA_k does not mean storing the mnmn entries of the reconstructed image. It means storing the ingredients: kk left singular vectors of length mm, kk right singular vectors of length nn, and kk singular values. Throughout this concept we use that convention:


numbers stored=k(m+n+1).\text{numbers stored} = k(m + n + 1).


The compression ratio compares this with the original cost:


ratio=mnk(m+n+1).\text{ratio} = \frac{mn}{k(m+n+1)} .


Worked example. Take a 512×512512 \times 512 image and keep k=40k = 40. The original holds 512×512=262 144512 \times 512 = 262\,144 numbers. The rank-40 representation holds


40(512+512+1)=40×1025=41 000 numbers,40(512 + 512 + 1) = 40 \times 1025 = 41\,000 \text{ numbers},
ratio=262 14441 000=6.39,41 000262 144=15.6% of the original.\text{ratio} = \frac{262\,144}{41\,000} = 6.39, \qquad \frac{41\,000}{262\,144} = 15.6\% \text{ of the original.}


Two habits are worth forming here. Compute m+n+1m + n + 1 once and reuse it. And keep the ratio and percentage straight: the fraction of original size is the reciprocal of the compression ratio, 1/ratio1/\text{ratio}; as a percentage, it is 100/ratio%100/\text{ratio}\%. Thus, a ratio of 6.39 corresponds to about 100/6.39=15.6%100/6.39 = 15.6\% retained, not 6.39%.

Break-even: when low rank stops saving anything

Storage grows linearly in kk, so the method saves space only while


k(m+n+1)<mn⟺k<mnm+n+1.k(m+n+1) \lt mn \quad\Longleftrightarrow\quad k \lt \frac{mn}{m+n+1} .


For a square N×NN \times N image the bound is roughly N/2N/2. Past that rank you are storing more numbers than the picture contained to begin with.


This matters in practice because it converts “how many components do I need?” into a hard feasibility test: if an image needs a rank near or above the break-even value to look acceptable, low-rank approximation is the wrong tool for it.

Measuring the error

Because the singular vectors are orthonormal, the squared Frobenius norm splits cleanly across the components:


∥A∥F2=∑i=1rσi2,∥A−Ak∥F2=∑i>kσi2.\lVert A \rVert_F^2 = \sum_{i=1}^{r} \sigma_i^2, \qquad \lVert A - A_k \rVert_F^2 = \sum_{i \gt k} \sigma_i^2 .


Two different quantities are built from these sums, and confusing them is the most common error in this topic.


  • The fraction of energy retained is ∑i≤kσi2/∑iσi2\sum_{i \le k}\sigma_i^2 \big/ \sum_i \sigma_i^2.
  • The relative Frobenius error is ∥A−Ak∥F/∥A∥F=∑i>kσi2/∑iσi2\lVert A - A_k\rVert_F / \lVert A \rVert_F = \sqrt{\sum_{i \gt k}\sigma_i^2 \big/ \sum_i \sigma_i^2}.


These are not complements of one another. If the discarded energy fraction is dd, the relative Frobenius error is d\sqrt{d}. Retaining 99% of the energy leaves d=0.01d = 0.01 and a relative error of 0.01=10%\sqrt{0.01} = 10\%, not 1%. The factor between the discarded fraction and the relative error is 1/d1/\sqrt{d}, so it depends on the discarded fraction.

Everything depends on how fast the singular values decay

Whether low-rank compression works at all is decided by the shape of the sequence σ1,σ2,…\sigma_1, \sigma_2, \ldots. Rapid decay, geometric, say, means a handful of terms carry nearly all the energy and a very small kk suffices.


Slow decay, a power law like σi∝i−1/2\sigma_i \propto i^{-1/2}, means energy is spread thinly over hundreds of components, and the rank required for a decent reconstruction can exceed the break-even bound entirely.


Irregular fine texture and uncorrelated sensor noise often spread energy across many singular components; structured textures can still be low rank.


Two practical notes. First, the error above is measured in the Frobenius norm, which weights every pixel equally; the human visual system does not, so the Frobenius-optimal approximation is not necessarily the most convincing one to look at.


Second, the SVD is a global factorisation of the whole image. Many practical codecs, such as baseline JPEG, apply a discrete cosine transform to blocks, while others use different structures, including wavelet transforms.


Those codec-specific transforms are outside this low-rank SVD concept. General least-squares theory and face-recognition applications belong to their own siblings; here the object of study is the low-rank approximation of the image matrix and its cost.

A grayscale image is stored as an m×nm \times n matrix AA with singular value decomposition A=UΣVTA = U\Sigma V^{\mathsf{T}}. To compress the image, the rank-kk truncated SVD AkA_k is formed.

What does AkA_k retain?

Choose an answer

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

A grayscale photograph is stored as a 256×384256 \times 384 matrix. It is compressed by keeping the rank-30 truncated SVD, storing 30 left singular vectors, 30 right singular vectors and 30 singular values.

How many real numbers does the compressed representation store?

Give your answer in real numbers.

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

An image block has exactly five nonzero singular values:

σ1=12,σ2=9,σ3=4,σ4=3,σ5=2.\sigma_1 = 12, \quad \sigma_2 = 9, \quad \sigma_3 = 4, \quad \sigma_4 = 3, \quad \sigma_5 = 2 .

Let A2A_2 be the best rank-2 approximation to this block. Calculate the relative Frobenius error ∥A−A2∥F/∥A∥F\lVert A - A_2 \rVert_F / \lVert A \rVert_F, to three decimal places.

Give your answer as a number.

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors