HomeVideos

Visualize Spectral Decomposition | SEE Matrix, Chapter 2

Now Playing

Visualize Spectral Decomposition | SEE Matrix, Chapter 2

Transcript

382 segments

0:02

if i were to summarize the first chapter

0:04

into two sentences there would be we

0:07

establish a framework to visualize

0:09

matrices went through the famous ones

0:11

visually they're pretty cool

0:13

the second sentence there are two

0:15

special matrices we need to remember the

0:17

diagonal and the orthogonal matrix

0:20

they are special because the

0:21

transformation on vectors they produce

0:23

have a simple visual interpretation

0:26

diagonal matrix scale or stretch each

0:29

axis

0:31

whereas the orthogonal matrix produces a

0:34

rotation

0:38

but in the harsh war of matrix most

0:41

transformations do not have an easy

0:43

visual interpretation and can hardly be

0:46

described by words

0:48

the symmetric matrix is one example

0:52

the goal of this video is by the end you

0:55

can look at any symmetric matrix and

0:57

trivially say

0:59

well its transformation may be visually

1:02

complicated but using spectral

1:04

decomposition it will just be a sequence

1:06

of three simple transformations and i

1:09

know exactly what they are

1:11

and just like any enlightenment of

1:13

knowledge a journey is required to truly

1:16

understand the theorem we need to unlock

1:18

some tasks of understanding verse

1:21

the first task what is a symmetric

1:23

matrix as you guess some form of

1:26

symmetry exists within

1:28

more specifically symmetric around the

1:30

diagonal line the numbers on each side

1:33

are equal

1:36

when the matrix is not square

1:38

aka rectangular matrix

1:41

is unfortunately never symmetrical

1:43

[Music]

1:44

the term transpose by itself does not

1:47

refer to a matrix but rather transpose

1:50

is an action you perform on the matrix

1:53

which is to take the rows of a matrix

1:55

and make them the columns instead

1:58

often times we call the resulting matrix

2:00

a transpose or transpose of a

2:04

you can likewise transpose a rectangular

2:06

matrix but notice the dimension of the

2:09

left matrix change

2:11

it went from 3x2 to 2x3 now

2:15

the action of transposing a matrix may

2:17

seem random

2:19

but it relates closely to our

2:20

protagonist today if you try to

2:22

transpose a symmetric matrix you get

2:25

exactly the same matrix back

2:27

which is why an alternative definition

2:29

of symmetric matrix is s equals to s

2:32

transpose

2:35

but what's not so obvious is that when

2:38

you transpose an orthogonal matrix

2:41

you actually get its inverse

2:44

and this is a very interesting property

2:46

that orthogonal matrix have

2:49

remember orthogonal matrix produces a

2:52

rotation

2:53

the inverse of matrix means

2:55

untransformation

2:56

the untransformation of rotation means

2:58

rotation in the reverse direction the

3:01

transpose of orthogonal matrix is also

3:03

the inverse

3:05

the transpose of orthogonal matrix is

3:07

rotation in the reverse direction

3:12

for example if i tell you orthogonal

3:14

matrix q rotates around the z axis by 25

3:17

degree

3:18

you can simply transpose that matrix

3:20

which would rotate around the z axis by

3:23

-25 degrees

3:27

what is matrix decomposition but let's

3:30

ensure we understand matrix composition

3:33

first

3:33

whenever we multiply matrices we're

3:36

essentially composing their distinct

3:38

transformations together into one

3:40

transformation

3:42

for example i can multiply the three

3:44

matrices on the right

3:47

[Music]

3:49

together one matrix on the left

3:55

and visually it looks like this

4:01

[Music]

4:11

matrix decomposition is essentially

4:14

going the reverse direction suppose you

4:16

have the transformation of one matrix

4:19

decomposing means you re-express that as

4:21

a sequence of much simpler

4:23

transformation

4:25

composition of matrices is simple we

4:28

just follow the rules of matrix algebra

4:30

and multiply them together

4:32

on the contrary decomposition is

4:34

difficult if someone just throws me a

4:37

random matrix and ask decompose this

4:40

into three simpler matrices i have no

4:42

idea where to even start would the first

4:44

matrix be a scaling

4:46

a shearing

4:48

or a rotation

4:49

i don't know

4:51

but hopefully

4:52

spectral decomposition can be the beacon

4:54

of light

4:58

if you have never heard of eigenvector

5:01

or eigenvalues then the de facto place

5:03

to learn them belongs to the essence of

5:05

linear algebra by what truly is a

5:07

legendary channel some words down in the

5:09

comment section really represents my

5:11

heart

5:12

today forgive me to present a personal

5:15

and subjective interpretation on this

5:17

concept you see after visualizing so

5:20

many different matrices their

5:21

transformation really feel like

5:24

distortions

5:25

vectors are moving to different places

5:27

scaled by different factors a skewed to

5:29

different directions

5:31

if we just pick a random matrix and

5:34

follow the movements of a few vector

5:36

we see that the linear transformation

5:39

knocks out the vector away from their

5:41

original direction

5:42

and it seems like every vector always

5:44

gets skewed away from their original

5:46

line no matter which vector we pick

5:49

every vector

5:51

or is it

5:54

actually for this particular matrix

5:56

there are two vectors hiding within

5:59

they are able to stay on their original

6:02

direction in the midst of linear

6:04

transformation

6:05

those are the eigenvectors

6:09

while every other vector deviates from

6:12

their initial direction the eigenvectors

6:14

stay on their original line despite the

6:17

distortion from the matrix

6:20

if one vector is an eigenvector all the

6:23

vectors along its linear span are also

6:25

the eigenvectors

6:27

this is a property of matrix being a

6:29

linear transformation

6:30

but we just pick one eigenvector

6:33

normally of a unit length to represent

6:35

the set of all eigenvectors along its

6:37

line

6:39

also note eigenvector is relatively

6:42

defined in respect to a matrix different

6:44

matrix and have different eigenvectors

6:47

the eigenvectors for matrix a

6:49

is probably not eigenvectors for matrix

6:51

b

6:52

and it's entirely possible for a 2x2

6:54

matrix to have less than two

6:56

eigenvectors

7:00

once we have the eigenvectors computed

7:02

normally by some software we often

7:04

denote them with vector symbol e1 e2

7:08

and then we can ask what is the

7:09

eigenvalue for each vector

7:11

you should think eigenvalue and

7:13

eigenvector always come in pairs the

7:15

eigenvalue which is a number tells how

7:18

much its corresponding eigenvector is

7:21

scaled during the matrix transformation

7:24

for example the dark blue eigenvector

7:26

has an eigenvalue of 2.7 during the

7:29

transformation it got stretched longer

7:31

by a factor of 2.7

7:34

if we watch the animation again and this

7:36

time pay attention to the light blue

7:37

eigenvector it got scale shorter because

7:41

eigenvalue is only 0.6

7:43

after seeing the visualization of

7:45

eigenvector in action

7:47

its formal definition becomes much more

7:49

straightforward which is saying the

7:52

eigenvectors are such that when

7:54

receiving a linear transformation from a

7:56

matrix this stay on their original line

7:59

only scaled by a factor of its

8:01

corresponding eigenvalue

8:05

a very strong property which symmetric

8:07

matrices have is that its eigenvector

8:10

are orthogonal and when we describe

8:13

vectors being orthogonal we mean they're

8:15

perpendicular

8:17

although this statement doesn't seem

8:18

that strong with an initial glance but

8:20

let's take a moment to appreciate just

8:22

how probabilistically unlikely that a

8:25

matrix eigenvector are actually

8:27

orthogonal

8:28

firstly we know that for m by n matrix

8:31

it's entirely possible it does not even

8:33

have an eigenvectors two by two matrix

8:36

can have less than two eigenvectors

8:38

even when it does have a full set of

8:40

eigenvectors what's the chance that the

8:42

two vectors just happen to be

8:43

perpendicular exactly 90 degree to each

8:46

other pretty unlikely right

8:51

but when the matrix is symmetric we can

8:54

guarantee to have its eigenvectors being

8:56

perpendicular

8:57

now you may ask oh yeah i know the

8:59

vectors are 90 degrees now what about it

9:03

well what else is perpendicular the

9:05

standard bases the x and y axis

9:09

this means there always exists an

9:11

orthogonal matrix which rotates the

9:14

bases to align with the eigenvectors

9:17

and the inverse of that matrix which

9:19

would rotate the eigenvector to align

9:21

with the basis

9:23

if the eigenvectors are not

9:25

perpendicular in the first place such a

9:28

rotation transformation would have been

9:30

impossible

9:32

now we have officially unlocked all

9:34

tasks of understanding

9:36

and ready to see spectral decomposition

9:39

the theorem is saying whenever you have

9:41

a symmetric matrix you can always

9:44

unconditionally decompose it into a

9:46

sequence of three simple matrices

9:49

q transpose

9:51

lambda

9:52

q

9:53

but q is an orthogonal matrix lambda is

9:56

a diagonal matrix q transpose is also an

10:00

orthogonal matrix

10:01

by this time when you hear the term

10:03

orthogonal diagonal as a decomposition

10:05

of a more complicated transformation

10:07

this should really be a reaction

10:14

precisely the column vector of matrix q

10:17

are the normalized eigenvectors of s

10:21

the matrix lambda is diagonal and the

10:23

numbers of the diagonal are the

10:25

eigenvalues of the eigenvectors

10:28

arranging from left to right we simply

10:31

transpose matrix q to get q transpose

10:34

and this decomposition can generalize

10:36

for any m by unsymmetric matrices

10:40

now we know exactly what matrix q

10:43

lambda q transpose r down to their

10:46

numerical value that means we can also

10:48

be precise about describing their

10:50

transformation visually let's start with

10:52

the easier one and assume s is 2 by 2.

10:55

matrix lambda is diagonal it means we

10:58

stretch the x-axis by lambda 1 and

11:01

y-axis by lambda 2.

11:03

how about matrix q then it's orthogonal

11:06

matrix so we know it's some form of

11:09

rotation

11:10

but what rotation precisely i sort of

11:13

gave it away earlier back it rotates our

11:15

standard bases to align with

11:17

eigenvectors consider vector 1 0 which

11:21

represents the x-axis multiplying that

11:23

with the matrix q we'll get the first

11:25

eigenvector

11:26

and likewise for vector 0 1

11:29

represents the y axis multiplication

11:31

with q

11:32

we get a second eigenvector

11:35

more generally speaking for higher

11:36

dimension matrix q apply a rotation

11:39

transformation such that the i th

11:41

standard basis moves towards the ith

11:44

eigenvector

11:47

on the other hand q transpose since it's

11:50

the same as q inverse due to a strong

11:52

property of orthogonal matrix it would

11:54

just be a rotation in the reverse

11:56

direction such that the eigenvector move

11:59

towards the eighth standard basis

12:04

now let's visualize in action

12:06

this symmetric matrix can be spectrally

12:08

decomposed into the three matrices on

12:11

the right

12:12

the linear transformation s produces

12:15

looks like this

12:16

but we know it will just be a sequence

12:19

of three simple transformations on the

12:21

right

12:22

firstly we identify the eigenvectors of

12:24

s

12:25

and rotate them onto the standard bases

12:29

secondly we scale the x-axis by 6

12:33

and y-axis

12:35

by

12:36

2. thirdly we rotate backwards from the

12:40

standard bases to the eigenvectors

12:46

likewise we can also apply a spectral

12:48

decomposition on a 3x3 symmetric matrix

12:51

let's look at what happens to the tiny

12:53

color cube under s

12:55

we also know this transformation is

12:58

exactly the same as a three sequential

13:00

transformation on the right

13:02

firstly we identify the three

13:04

perpendicular eigenvectors of matrix s

13:08

and rotate them onto the standard bases

13:11

secondly we scale the x-axis by 4.15

13:16

y-axis by -1.56

13:19

since it's a negative scaling factor

13:21

vectors are going the reverse direction

13:23

by the magnitude

13:24

and then a tiny bit stretching in the

13:26

z-axis by 1.31

13:29

in reality matrix lambda does three

13:31

scalings simultaneously i'm just

13:34

breaking them apart so it's easier to

13:35

see

13:37

and thirdly a rotation backwards from

13:39

the standard bases to the eigenvectors

13:43

and the transformations we just witness

13:45

is exactly the same as s

13:53

and now we can also look at the effects

13:54

of decomposition on image

14:00

[Music]

14:13

often times the topic of spectral

14:15

decomposition is taught in school as a

14:17

list of procedures followed by the

14:18

students which quickly turns into

14:20

tedious finger exercise and boring

14:22

algebra

14:23

while the underlying elegant geometric

14:26

interpretation is dismissed

14:29

what the theorem gives us is another

14:31

chance to express a more complicated

14:33

transformation

14:34

just as a sequence of simple rotation

14:37

scaling rotation back

14:39

in particular the rotation is guided by

14:41

the eigenvector and the scaling are told

14:44

by the eigenvalues

14:46

and i think the connection here

14:48

is quite profoundly beautiful

14:50

and this

14:51

is a visualization of spectral

14:53

decomposition

14:57

the problem is

14:58

just how often do you get a symmetric

15:00

matrix

15:01

if you just go into matrix line and grab

15:03

a matrix in random

15:04

firstly it's probably not square

15:07

if it's square it's probably not

15:09

symmetric

15:10

in reality the theorem is pretty with a

15:13

loss of generality

15:14

but would it be possible we can take the

15:16

similar spirit of decomposition and

15:19

generalize for all matrices doesn't need

15:21

to be symmetric or square but any

15:23

arbitrary matrix of any dimension

15:26

and this leads us to chapter 3 the grand

15:29

finale of linear algebra singular value

15:32

decomposition

15:34

see you there

15:41

[Music]

15:53

you

Interactive Summary

This video provides a geometric explanation of spectral decomposition for symmetric matrices. It explores how symmetric matrices, despite appearing complex, can be broken down into a sequence of three simpler transformations: an orthogonal rotation, a diagonal scaling, and a final reverse rotation. The video illustrates this process using eigenvectors and eigenvalues, emphasizing how these concepts allow us to visualize and understand the underlying mechanics of matrix transformations.

Suggested questions

3 ready-made prompts