Visualize Different Matrices part1 | SEE Matrix, Chapter 1
304 segments
What exactly is a matrix?
Some say it's just a box of numbers, a
collection of vectors,
mathematical object, linear
transformation,
a function.
Perhaps, no one knows the answer.
But, we do know how to multiply a matrix
and a vector. For example, multiplying
this matrix with vector 1 2, what we get
is a vector 5 2.
And it turns out there's actually a
natural way to visualize this.
Firstly, we represent a vector as a
physical arrow sitting in the
two-dimensional space. And as a vector
gets multiplied by the matrix, the tip
of the arrow moves from the coordinate 1
2 to the coordinate 5 2.
So, that was a visualization for one
vector. How about we try to do this with
more vectors?
Once again, we can represent the vectors
as six physical arrows and observe their
movements as they get multiplied by the
matrix.
But, the original goal was to visualize
a matrix, so we should think what
happens to all vectors as each every one
of them gets multiplied.
Our computer tries its best to add many,
many arrows on the screen to create the
illusion of every vector
and the multiplication.
Well, that was a visualization of matrix
I asked for, but it's just a horrible
visualization. There are too many
vectors moving at the same time, too
much information for my tiny brain to
process, and we need to improve this.
So, to improve the quality, we're going
to apply two tricks. Firstly, let's
squint our eyes and focus on a smaller
region of vectors.
The second trick we do is to represent a
vector as a dot instead. Consider our
old friend vector 1 2. Now it's a dot
sitting over there. The matrix
multiplication would move this dot
to the coordinate 5 2.
And we can replace all the vectors
within our focus region with many, many
dots instead.
And then we observe the matrix
multiplication.
This is much better.
We have essentially built an engine
which creates a visualization for any 2
by 2 matrix.
The very natural thing to do next is to
just plug in a bunch of different
matrices in there and watch the
transformation of the dots on the
screen.
And very soon interesting patterns start
to emerge.
The goal for the next part of the video
is to illustrate the famous matrices
whose transformation are so visually
geometrical that we can even use English
to describe them.
And welcome to the matrix got talent
show. The first matrix on stage is the
identity matrix, which is a square
matrix that has a ones on the diagonal
and zeros everywhere else.
So, tell me about your transformation on
vectors.
Wait.
There There was no transformation?
Nothing at all? Huh.
That's kind of boring start.
But this actually makes sense. If you
multiply any vector with the identity
matrix, you get the same vector back.
So, there will be no movements of the
dots at all.
If we try to label every matrix with a
tag. What would be the tag for identity
matrix? Well, I say it would be no
transformation or does nothing, boring.
The next one is a scalar matrix. The
numbers on the diagonal line are the
same and zeros everywhere else.
So, it's not saying that there is only
one matrix that is the scalar matrix,
but any matrix that satisfies this form
is regarded as a scalar matrix.
Let's try this matrix here.
Wow. That was pretty cool.
Our rectangle got bigger.
And the notable thing is there wasn't
any sense of distortion, but rather like
every single dot moved uniformly.
Let's try one more.
Oh.
This one seems to be moving our dots
even more aggressively outwards.
So, zooming now.
And we still see the contour of the
rectangle and the ratio of width versus
height still remains the same. How about
when the numbers on the diagonal line is
less than one?
We see our dots moving inwards and the
border of the dots still forms a
rectangle.
It seems this kind of matrix has ability
to scale things uniformly.
For K greater than one, the matrix is
stretching all the vectors outwards. For
K less than one, the vectors are
stretched inwards. For K equal to one,
nothing moves because this is the
identity matrix.
What interesting thing can we do about
this?
If you really ponder upon idea of a
shape on 2D space,
then it's really just an infinite number
of dots sitting closely together.
And guess what? If matrix can move dots,
then matrix can transform shape.
And here, we apply the scalar matrix to
the triangle.
To take this idea one step further, a
picture is basically a bunch of pixels
or colored dots.
Then, we can transform pictures well.
Let's apply a scalar matrix to the Mario
here.
Oh, question.
Three dimension?
That is a good question.
A vector in R3 can be represented as
three-dimensional arrow or likewise
three-dimensional dot.
And if you ponder on this again, a
three-dimensional object is just like an
infinite number of dots sitting very
close together, which means we can use a
3 by 3 scalar matrix to transform
three-dimensional objects.
The next one is not famous enough to
have its own name.
But, the idea is you take the identity
matrix and modify exactly one number on
the diagonal line.
And let's call this the off one matrix.
Dots were moving along the Y axis, while
the X coordinate is unchanged. How about
a different one?
Dots are moving along the X axis, while
the Y coordinate is unchanged.
If we keep playing with the visual
engine we have, the pattern starts to
become clear.
For whichever entry on the diagonal line
that is not one, but K, it scales
everything along the axis by a factor of
K. While the other axis is not changed.
And this really has to do with our way
of representing vector as dot.
We let the first entry be X and the
second entry be Y.
of one matrix behaves very predictably
in three dimension. It's a scaling of
just the X axis,
just the Y axis,
or
just the Z axis.
Hey, you're back. Do you want to get
scale along the Y axis?
I've got a question.
Negative entries.
We did forget to talk about that.
Let's take a look at the simplest case
first. When you change one or more
number on the diagonal to be negative
one for the identity matrix,
seems there's a reflection by the Y axis
and nothing is scale out of proportion.
This one?
A reflection by the X axis.
So, why is this matrix producing some
form of reflection behavior? What's the
intuition here? Let's use the Y
reflection matrix as an example.
If we consider the matrix vector
multiplication, we first know that the
magnitude of vector did not change. So,
nothing is scale,
but the sign of the first entry is
flipped.
Visually, this means arrows from the
first quadrant move to the second
quadrant.
And dots from the third quadrant move to
the fourth quadrant.
And the exact logic of reasoning also
holds for the X reflection matrix, in
which the sign of the Y coordinate is
being flipped.
But what about when both entries are
negative? Is it a reflection by the X
and Y axis?
And you will be exactly right. The sign
of both the X and the Y coordinates are
flipped. Dots from every quadrant would
be going to the opposite quadrant.
And this translates to a reflection
around the origin.
And as always, it's cool to let matrix
transform images.
In three dimension, there is one more
entry that can be flipped, the Z
coordinate.
We will not go into the details of
different cases here, but the overall
spirit of reflections still holds.
Next, enters the diagonal matrix, which
is another square matrix that can have
any numbers on the diagonal line, but
zeros everywhere else.
And the understanding of this matrix
actually ties closely to the reflection
matrix and off one matrix we visualized
earlier.
Before me presenting you with a
visualization, we can even try to guess
what it might look like. But firstly,
allow me to say something very
important.
Matrix to matrix multiplication is
really not multiplication at all. When
someone say, "I want to multiply matrix
B and A to get matrix C."
Okay. What that person really saying is
I just want one matrix, which is matrix
C, which can compose the overall
transformation if first apply A and then
B, but in just one transformation.
For example, we can multiply or compose
these two off-one matrices on the left
to get a diagonal matrix on the right.
And we already know exactly what kind of
visual transformation those two matrices
would have since we have labeled them
earlier.
So, what do you think the diagonal
matrix would do?
Exactly like what you guessed, the
vectors all move along the Y axis by a
factor of two and also along the X axis
by a factor of three.
How about this diagonal matrix here? You
can pause the video and show it's just a
composition of the three matrices on the
right, which we know a lot about
already.
And therefore, we can conclude that the
diagonal matrix must be the overall
transformation of sequentially applying
the three matrices on the right.
Let's use this image as an example.
Firstly, we scale the X axis by 2.5.
Secondly, the Y axis by 0.6.
And thirdly, a reflection.
And this diagonal matrix, which is a
composition of the three matrices on the
right, will just encapsulate the three
transformations but in one go.
Whenever there's a diagonal matrix, you
can always decompose it into a sequence
of the off-one matrix. In case you have
negative numbers on the diagonal, you
can also explicitly factor it out to
include a reflection matrix at the end.
For this 3 by 3 diagonal matrix, we know
it would just be a composition of three
different offline matrices
and we can directly read the numbers
from its diagonal line. So, it will
scale the x-axis by three, y-axis by
two, and z by 0.5.
The next one is a zero matrix, which is
square and everything is zero.
So, regardless of which vector you
multiply with a zero matrix, it becomes
the zero vector.
And visually, it would mean no matter
where the vector starts,
it would move towards and end up in the
origin.
Ask follow-up questions or revisit key timestamps.
This video explores how to visualize matrices through linear transformations by representing vectors as points in space. It breaks down various types of matrices, including the identity, scalar, off-one, diagonal, and zero matrices, showing how each one uniquely affects coordinates and geometric shapes, effectively serving as an engine for composing complex transformations.
Videos recently processed by our community