Professor Strang’s — Introduction to Linear Algebra — is an incredible journey into the hart of Linear Algebra. Over the next few articles I aim to illuminate some of the sections in the light of Python. Enjoy!

In this article I want to look into a special class of matrices, _projection matrices. _First looking at some fairly intuitive projection matrices that project lines in 3D onto the orthonormal basis they are defined in. Secondly we will look at how you can project any arbitrary vector onto a line. We will then finish off by generalising to how we can define a projection matrix for any plane.

All the way along we will translate these ideas into the language of python using vanilla numpy and plotly for the visuals.

A note before you start. You should have an understanding of basic matrix operations before reading this article, for example inner and outer products.

Projection matrices

Given some n dimensional vector, v = (a1, a2, …, an) we can consider projections of this vector onto various subspaces in Rn. We describe these projections with, you guessed it, projection matrices.

Let’s restrict ourselves to three dimensions. Then we can describe the projection matrices that project a vector v onto the z axis and xy plane respectively.

Projection matrices. When acting on a 3 dimensional column vector they pick out the components in the z and xy plane respectively.

Lets say we have some vector v then we can project this matrix onto the z axis like so

We can see that the projection matrix picks out the components of v that point in the plane/line we wish to project onto. Strang describes the purpose of a projection matrix as follows.

#python #mathematics #matrix #linear-algebra #data-science

Linear Algebra from Strang.
3.30 GEEK