# question about the matrix of linear transformation

I am learning the matrix of linear transformation but have trouble understanding it when reading the notes. The part I am stuck at is as follows:

To see how important the choice of basis is, let's use the standard basis for the linear transformation that projects the plane onto a line at a $$45^\circ$$ angle. If we choose $$\boldsymbol{\mathrm v_1} = \boldsymbol{\mathrm w_1} = \begin{bmatrix}1 \\ 0\end{bmatrix}$$ and $$\boldsymbol{\mathrm v_2} = \boldsymbol{\mathrm w_2} = \begin{bmatrix}0 \\ 1\end{bmatrix}$$, we get the projection matrix $$P = \dfrac{\boldsymbol{\mathrm{aa}}^T}{\boldsymbol{\mathrm a}^T\boldsymbol{\mathrm a}} = \begin{bmatrix} 1/2 & 1/2 \\ 1/2 & 1/2 \end{bmatrix}$$. We can check by graphing that this is the correct matrix, but calculating $$P$$ directly is more difficult for this basis than it was with a basis of eigenvectors.

My question is:

How to get the projection matrix $$P$$?

• The notes say "but calculating $P$ directly is more difficult for this basis than it was with a basis of eigenvectors". Are you asking about how get the matrix using eigenvectors, or how to get the matrix directly? – Ben Grossmann Jan 20 '20 at 8:39
• both if it is possible. I can't figure out why P is \begin{bmatrix}1/2&1/2\\1/2&1/2\end{bmatrix}. – king Jan 20 '20 at 10:13

Let $$a$$ and $$b$$ be two vectors in $$R^m$$.
Note that the projection of vector $$b$$ onto vector $$a$$ is $$\frac{b^{T}a}{a^{T}a}a$$
Rewrite the same as $$a\frac{a^{T}b}{a^{T}a}=\frac{aa^{T}}{a^{T}a}b=Pb$$ [Note that $$\frac{b^{T}a}{a^{T}a}$$ is a scaler and that $$P=\frac{aa^{T}}{a^{T}a}$$ is a rank 1 matrix which projects $$b$$ onto $$a$$ ]
Now as per your question, choose $$a$$ to be any vector on the line $$y=x$$, for example $$a=(1,1)^{T}$$ and get $$P$$ from $$P=\frac{aa^{T}}{a^{T}a}$$