• pamparana
In summary, the conversation discusses the creation of a projection matrix, which is used to find the orthogonal projection of a vector onto a vector space. The matrix is created by taking the 3x3 part of an affine map matrix and multiplying it by its inverse. This results in a matrix that fulfills the properties of a projection matrix, and can be used repeatedly to find the orthogonal projection of a vector.

#### pamparana

Hello,

I am looking at some code which creates a projection matrix and I can verify that it is indeed correct as P^2 = P.

The way they do is as follows:

There is a 4x4 matrix which is an affine map between two coordinate systems (takes one from image space to world space). It is a transformation in 3D and the last row is [0 0 0 1] to accommodate for translation.

The procedure is as follows:

They take the 3x3 part of the matrix (so removing the translation bit) and also an appropriate transformation matrix is created. So for example if we only want to have the projection along the "z" plane, it would be:

I = [0 0 0; 0 0 0; 0 0 1]

The final projection matrix is gicen by:

A * I * inverse(A) where A is the 3x3 part.

I can verify that the resulting matrix indeed fulfills the properties of a projection matrix but am unable to get an intuitive feel of why this is so...

I would be very grateful if someone here can shed some light on this...

Thanks,

Luca

Let's take the problem as this:You have a vector space that is spanned by columns of matrix ##A##; call it ##c(A)##.

Also, you have a vector ##b## that may or may not be in ##c(A)## and you want to find its orthogonal projection on ##c(A)##.

Then, let ##\hat{x}## be the solution such that ##A\hat{x}## is the orthogonal projection of ##b## on ##c(A)##.

So we have vector ##(A\hat{x}-b)## orthogonal to ##c(A)## such that the inner product ##<A\hat{x}-b,v> = 0##, where ##v\in c(A)##.Since columns of ##A## are elements of ##c(A)##, thus...
\begin{align*} A^T(A\hat{x}-b)&=0\\ A^TA\hat{x}&=A^Tb \end{align*}If ##A^TA## has an inverse, then...
\begin{align*} \hat{x}&=(A^TA)^{-1}A^Tb\\ A\hat{x}&=A(A^TA)^{-1}A^Tb \end{align*}And the projection matrix,
\begin{align*} P&=A(A^TA)^{-1}A^T\\ &=AA^{-1}_{left} \end{align*}Again, provided that the inverse exists, you can prove that for any positive integer n, ##P^n=P##.

Last edited:

## 1. What is a projection matrix?

A projection matrix is a square matrix that is used to transform a vector or set of vectors into a subspace (or lower-dimensional space) while preserving certain properties, such as the angle between vectors.

## 2. What are some applications of projection matrices?

Projection matrices have various applications in fields such as computer graphics, image processing, and data analysis. They are commonly used for transformations, rotations, and projections of objects in 3D space.

## 3. How is a projection matrix different from an identity matrix?

An identity matrix is a square matrix with 1's on the main diagonal and 0's everywhere else. It is used to represent a transformation that does not change the vectors it operates on. A projection matrix, on the other hand, can change the vectors it operates on by projecting them onto a subspace.

## 4. Can a projection matrix be inverted?

Yes, a projection matrix can be inverted if it is a full-rank matrix (meaning it has a non-zero determinant). The inverse of a projection matrix will "undo" the projection and return the vectors to their original space.

## 5. How are projection matrices used in machine learning?

In machine learning, projection matrices are often used to reduce the dimensionality of a dataset. This can help simplify the data and make it easier to analyze, while still preserving important information. Projection matrices can also be used for feature selection and data compression in machine learning algorithms.