Visualize Different Matrices part2 | SEE Matrix, Chapter 1
297 segments
Continued from part one, we have the
shear matrix,
which is a matrix that produces a shear
transformation.
But, what is a shear transformation?
Turns out, it's not the easiest to
describe verbally, so you have to see it
for yourself.
The matrix 1101 is a shear matrix.
And this is what it does.
What we see is all the vectors above the
origin were moving towards the right.
And all the vectors below the origin
were moving towards the left. And the
way they move was actually parallel to
the x-axis.
So, overall, the rectangle was slanted
into parallelogram.
In 2D, there are four directions we can
apply a shear transformation.
Two different ways we can shear in
parallel to the x-axis,
and two ways in the y-axis.
It's also notable to mention a property
shear matrix have,
which the transformation preserve the
area of the object, despite changing the
shape.
Which forms a distinction with the
scalar matrix from earlier, which
preserve the shape, but changes the
area.
A three-dimensional shear is kind of
hard to describe. Personally, I'd like
to imagine there's a plane slicing
through the origin, and there's a
direction associated with this plane.
All vector are moving parallel to the
plane, while slanting towards the
direction.
Mhm, maybe that was not the best angle
to observe a shear transformation in 3D.
So, let me change the orientation of my
camera a little bit.
And for every combination of this plane
and direction,
it would have its own corresponding
shear transformation matrix.
Next, the orthogonal matrix. This one is
very important for chapter two and
three. It's a square matrix. Every
column vector is a unit vector, and
they're all orthogonal to each other.
Let's dissect the definition a little
bit.
So, what is a column vector? Basically,
if we vertically slice through the
matrix into columns, each column is a
vector. This is the reason why some
people say matrix is a collection of
vectors.
For a column vector to be a unit vector,
it means the magnitude is one. In our
case, the length of the arrow is one.
For a counterexample, the red arrows on
the screen are not unit vectors because
they're too long.
How about orthogonal?
So, the formal definition for orthogonal
is when you take the dot product between
two vectors, the number you get is zero.
And when the dot product is zero,
visually, it actually translates to the
two vectors being perpendicular to each
other.
This one is orthogonal matrix. We can
quickly verify the two column vectors
are unit and orthogonal.
What kind of transformation does it
have?
Wow.
A perfect rotation.
No scaling, no stretching, no shearing,
no reflection, but a pristine rotation.
You might say, "Come on, it's just
rotation. There's nothing special." But
it turns out finding the correct
direction to rotate is a gateway to
unlock all complexity with linear
transformation.
And it just happens the transformation
an orthogonal matrix produce is always a
rotation to some degree.
Inductively, a 3 by 3 orthogonal matrix
produces a rotation in three dimension,
and you can also rotate around the Z
axis now.
Actually, now's a really good time for
me to once again emphasize the idea that
matrix to matrix multiplication is
nothing but a composition of sequential
transformations.
Suppose I tell you orthogonal matrix A
produce a rotation around the x-axis by
60°.
And matrix B produce rotation around the
z-axis by 45°.
If I multiply those two matrices
together to get a matrix C,
what do you think C is going to do?
Well, let's see. Firstly, around X
and immediately around Z.
Since our matrix C is a composition of
the two, like you guessed it, it
encapsulates the two sequential
transformation but in just one rotation.
If you had noticed, I really tried to
punctuate the word sequential just now
because suppose we reverse the sequence
of the two rotation, namely Z first then
X.
We actually get something different than
the original composition.
Look at the position of the orange cube.
It's different.
This is actually an example to prove
matrix composition or matrix
multiplication is not commutative.
Which is saying matrix B times A is not
always equal to A times B.
Projection matrix.
Actually, before defining a projection
matrix, we need to understand what is a
subspace.
And just like all other definitions in
linear algebra, the definition for
subspace is pretty abstract. At the
moment, allow me to just provide you
with some examples. In 2D, a line
crossing through the origin is a
subspace of R2.
And this line is infinitely long.
In 3D, a plane crossing through the
origin is a subspace of R3.
I'm only showing you a small region of
the subspace here, but in reality, you
should imagine the subspace actually
spread to infinity.
For every subspace that exist, our
computer can calculate its corresponding
projection matrix, which would move
every vector outside the subspace onto
the subspace.
Let's take a look at the projection
matrix of this blue line here.
After the projection transformation,
every single dot has been compressed
onto the line.
How about the projection matrix of this
plane in 3D?
Yet another very similar vibe of
compression.
The reason why this is called projection
is because every vector always moved to
its closest point on the subspace.
For example, the vector 2 1 is currently
outside the blue line, and its closest
point would be here.
Applying the projection matrix would
move our vector 2 1 exactly over there.
And this is true for every single vector
outside the subspace.
As targets of projection matrix, they
all move towards their closest landing
spot.
And the fun fact, if some alien
civilization destroy our solar galaxy by
compressing us into a lower dimension,
this kind of transformation is similar
to a projection matrix.
The very last, but not the least, we
talk about the idea of inverse.
So far, we have seen a lot of different
matrices, and therefore many different
transformations. All those
transformations were moving our vectors
to new coordinates.
But what if I don't like a particular
transformation I had? Maybe it distorted
my image a little bit. I just want every
vector to go back where they originally
came from.
Is there one matrix that can untransform
the previous transformation for me?
Unfortunately, the short answer would be
no.
There isn't one matrix that does the
universal untransformation.
But for every matrix you're interested
in, our computer can calculate its
inverse, which is another matrix that is
capable of that particular
untransformation.
For example, the matrix which scale,
its inverse matrix unscale.
The matrix which reflects, its inverse
reflects back.
The matrix which rotates, its inverse
rotates back.
The matrix which shears,
its inverse unshears.
Or this matrix here, not sure what it
did, but its inverse matrix restores all
vector back to the original.
Notice, when you apply a matrix and then
you apply its inverse, it's like nothing
happened.
Just like the identity matrix. This is
the reason when you multiply a matrix
and its inverse, you always get the
identity matrix. When you compose the
two transformations together, you get a
transformation of no transformation.
However, some matrix cannot be inverted.
The zero matrix and projection matrix
from earlier cannot be untransformed.
It actually kind of makes sense visually
because a vector has been squashed from
a higher dimension down to a lower
dimension. There is a loss of
information.
After a long journey, we have went
through all those cool matrices. So,
what exactly is a matrix?
Does matrix intrinsically carry a visual
value?
Frankly, not at all.
Everything I did was only a very
artificial attempt to make sense of
matrices. You could say matrix
visualization is just another human
construct.
This moment, I'd like to reference a
quote from my favorite author. He was
asked whether his readers could
interpret the symbolism in his novel the
way he intended to convey. He answered,
"The books belong to the readers now,
which is a great thing because the books
are more powerful in the hands of my
readers."
I think this is true for matrix as well.
The interpretation of matrix belongs to
whoever is using it.
For a student who studies circuit,
matrix is just a tool to solve system of
equation. Personally, I still have some
PTSD from Gaussian elimination.
For probability student, matrix is a
best representation of a Markovian
process.
For data scientist, a matrix is just a
manifestation of a table, which
facilitates data analysis.
And for the deep learning folks, matrix
is just another Python function, which
takes a vector as input and returns a
vector as output.
And this list really goes on.
Perhaps,
there isn't the definition of matrix,
but only interpretations of matrices.
Then, what is so good of the visual
interpretation?
Firstly, I think it provides us with
intuition about matrix transformation on
vector.
And secondly, computer graphic is a
direct extension of this.
Thirdly, the one I like to elaborate on
personally, which is a very important
topic of matrix decomposition.
There are matrices out there whose
transformation so perplexing I cannot
easily articulate.
And there are matrices taking vector
from higher space to a lower space.
Is there a possibility we can re-express
those complicated transformation into a
sequence of simple transformation such
as rotation or scaling?
And that's where we're heading towards
next chapter two. What Professor Gilbert
Strang calls the king of all matrices.
And let you and me go spectate the
spectacular spectral decomposition.
See you there.
Ask follow-up questions or revisit key timestamps.
This video provides a conceptual and visual exploration of various types of linear transformation matrices, including shear, orthogonal, and projection matrices. It explains their geometric effects on vectors, emphasizes that matrix multiplication represents sequential composition—which is non-commutative—and introduces the concept of inverse matrices and their limitations regarding information loss. Finally, the video discusses how the interpretation of a matrix depends on the user's field, highlighting the value of geometric intuition as a precursor to understanding complex topics like matrix decomposition.
Videos recently processed by our community