# 7.4 Singular Value Decomposition

4 (SVD of 2x2 matrix). Compute the full SVD, not just the singular values. Do it fully by hand showing all the steps.

X Use numpy.linalg.svd (or the wrapper I showed in class) to compute the SVD of the following matrices. Give the rank of the matrix in each case. Display A, U, Σ, VT all in a row as in the examples I showed, though yours may be handwritten of course, with the numbers rounded to 3 digits.

a

[[-3  3 -5]
[ 4  2  5]
[-1  0 -3]]


b

[[-2  1 -2]
[ 0  1  0]
[-2 -1 -2]]


c

[[ 3 -8  5  8]
[ 6 -8  5 -8]]


d

[[-2  9 -6  4]]


e

[[-8]
[ 9]
[-8]
[ 0]]


f

[[-2]
[-4]
[ 4]
[-8]]


20 (Show that PA has the singular values as A if P is mxm orthogonal.)

# 7.5 Applications of the SVD

Create an an illustration like the one below, except for a photo of your own choosing that is likely to be different from the choice of any other student (and that is suitable for public display).

The illustration shows the individual rank-1 matrices in the left column for the indicated values of i. The right column shows the sums of the first i rank-1 terms for the same values of i.

Make small modifcations of this code to do this. Although there may be parts of the code that you don't fully understand, I'm hoping you can reverse-engineer it to the extent necessary.

Briefly comment on what you see.

(Note to self for next time: because the modes Ui VTi are signed, it would be better to use a color map for them like 'bwr' that is "diverging", with the center pinned at 0.)