Math Help - finding the distance between a vector and image

1. finding the distance between a vector and image

I have a vector b
[1
1
1
0]
and a matrix A
[1 0 1
2 -1 1
-1 2 1
0 -1 -1]

it says
1. the sum of the first two columns is equal to the third and conclude that the rank(A) = 2
2. replace A by a matrix B with maximal rank and same image
3. compute the peojection P on Im(A) = Im(B) by u sing the method of least square solution
4. compute the projection b0 = Pb of b on Im(A)
5. compute the distance between b and b0

I get the first two steps but I don't understand how to do the 3rd. I'm pretty sure I can do the last two steps once i get the result from step 3. can anyone clarify on what I'm supposed to do in step 3?

2. I presume you have recently been introduced to finding "least squares" approximations by using the "adjoint" matrix.

If A is a linear operator from vector space U to vector space V, and y is NOT in the image of A, then we cannot solve Ax= y. But we can find x such that Ax is "closest" to y. We argue that Ax will be closest to y when y- Ax is perpendicular to Ax. That means that $_V= 0$ where $< , >_V$ is the inner product in V. Since the "adjoint" of A is the operator, $A^T$, from U back to V such that, for all u in U, v, in V, $_V= _U$ where the second $< , >_U$ is the inner product in U.

Specifically, we have $_U= 0$. But now, x can be any vector in U so we must have $A^T(y- Ax)= 0$. The "Ax" satisfying $A^Ty= A^TAx$ is the projection of y onto the image of A.