# What is the difference between the projection onto the column space and projection onto row space?

If I see a question that asks "find the projection a vector $b$ onto a matrix $A$" I would either solve by using $A^TA\hat x =A^Tb$ and then the projection would equal $A\hat x$,

and if the matrix $A$ was orthogonal then I would use $proj_bA = \frac{b \cdot q_1}{q_1 \cdot q_1}q_1 + ... + \frac{b \cdot q_k}{q_k \cdot q_k}q_k$ where $q_k$ represents the $k^{th}$ vector in matrix $A$.

My question is what if a question says find the projection of some vector $b$ onto the column/row space of matrix $A$?
What does this mean and what would I need to do differently to calculate it?

• Projecting onto the row-space of $A$ is the same as projecting onto the column-space of $A^T$. – Ben Grossmann May 6 '16 at 20:28
• Solving $A^TA \hat x = A^Tb$ is "projective $b$ onto the column-space of the matrix $A$". Strictly speaking, it is non-sense to say that you're "projecting a vector onto a matrix". – Ben Grossmann May 6 '16 at 20:29
• @Omnomnomnom so if I have to project onto the row space I would use $AA^T\hat x=Ab$? – idknuttin May 6 '16 at 20:38
• Yep.${}{}{}{}{}{}$ – Ben Grossmann May 6 '16 at 20:52

if the columns of matrix $A$ are linearly independent, the projection of a vector, $b$, onto the column space of A can be computed as

$$P=A(A^TA)^{-1}A^T$$

From here.

Wiki seems to say the same. It also says here that

The column space of $A$ is equal to the row space of $A^T$.

I'm guessing that

if the rows of matrix $A$ are linearly independent, the projection of a vector, $b$, onto the row space of A can be computed as

$$P=A^T(AA^T)^{-1}A$$