LINEAR-ALGEBRA Β· Interactive Practice | Unit 30 Β· Video 1
| Formula | Name | Description |
|---|---|---|
| Basis expansion | Any image is a weighted sum of basis vectors | |
| Coefficient (orthonormal basis) | Projection of image onto basis vector | |
| Image as vector | grayscale image flattened into a single column | |
| Lossy reconstruction | Keep only large coefficients , discard the rest |
Unroll a grayscale grid row by row and the picture becomes one point β a vector in .
π‘ The same idea scales: a photo is a single point in .
Each basis vector is itself an image β from a single spike to a uniform field to a fast oscillation.
π‘ JPEG's basis is cosine waves at rising frequencies (the Discrete Cosine Transform); modern codecs use wavelets β choosing the basis is the whole game.
Keep only the largest few of 64 frequency coefficients and the reconstruction barely changes.
π‘ It works because real images are mostly smooth: they project heavily onto the low-frequency basis vectors and barely onto the high-frequency ones.
Question 1
A grayscale photograph has resolution . As a single vector, in which space does it live?
β Correct! Every pixel contributes one coordinate.
β Not quite. The dimension equals the total number of pixels, not the width or height alone.
Solution:
To turn an image into a vector, we stack all the pixel values into one long column. For a grayscale image, that's pixel values, so the image is a single point in .
(A color image would triple this, since each pixel has R, G, and B channels.)
Question 2
You photograph a perfectly uniform dark gray blackboard. Compare two bases:
In which basis does the image have a shorter description (fewer non-zero coefficients)?
β Correct! A uniform image is a scalar multiple of the all-ones vector, so almost every coefficient is zero.
β Not quite. Having every coefficient equal is not the same as having most coefficients zero. We want shortness, not uniformity.
Solution:
In the pixel basis, every coefficient is the gray value . That's 262,144 equal, non-zero numbers β no short description.
In a structured basis that contains the all-ones vector , the uniform image is simply Almost all coefficients are zero. The whole image is captured by a single number .
Same vector, same information β just a much shorter description.
Question 3
True or False: When JPEG performs lossy compression, it removes information at random to make the file smaller.
β Correct! Lossy compression is a precise, structured discard of high-frequency coefficients β not random damage.
β Not quite. The whole point of compression-by-change-of-basis is that the discard is targeted.
Solution: False.
JPEG does not discard information randomly. It changes basis (using the Discrete Cosine Transform) so that the image is expressed as a sum of low- to high-frequency components. The coefficients on high-frequency basis vectors are then aggressively quantized or zeroed out.
This is principled, not random:
So JPEG selectively discards the parts our eyes barely notice β that's why a 10Γ compressed photo can still look fine.
Question 4
Modern video codecs encode the difference between consecutive frames, rather than each frame on its own. What does this strategy have in common with JPEG?
β Correct! That's the deep idea: compression is choosing coordinates.
β Not quite. JPEG is lossy, and the DCT is spatial, not temporal. Look for the general principle the two share.
Solution:
The unifying principle is: change coordinates until most numbers are zero.
Different axis, same philosophy: the right basis turns hard problems into trivial ones.
Solved: 0 / 4