<s>[INST] The orthogonal projection of the vector b is not equal to $AA^+b$ Given matrix $A:= \begin{pmatrix}1&2\\3&6\end{pmatrix}$
I am trying to solve this task:

... compute $P:=AA^+$. Finally, evaluate $Pb$ with
$b:=\begin{pmatrix}2\\4\end{pmatrix}$, and show that $Pb$ is indeed
the orthogonal projection of the vector b onto the subspace by the
column vectors of the matrix A.

$A^+=\frac{1}{50}
\begin{pmatrix}1&3\\2&6\end{pmatrix}$
$P=AA^+$
$P=
\begin{pmatrix}1&2\\3&6\end{pmatrix}
\frac{1}{50}
\begin{pmatrix}1&3\\2&6\end{pmatrix}$
$P=
\frac{1}{10}
\begin{pmatrix}1&3\\3&9\end{pmatrix}$
$Pb=
\frac{1}{10}
\begin{pmatrix}1&3\\3&9\end{pmatrix}
\begin{pmatrix}2\\4\end{pmatrix}
=\frac{7}{5}\begin{pmatrix}1\\3\end{pmatrix}$
$proj_A(b)=\frac{u_1b}{u_1u_1}u_1+\frac{u_2b}{u_2u_2}u_2$
$proj_A(b)=\frac{\begin{pmatrix}1\\3\end{pmatrix}\begin{pmatrix}2\\4\end{pmatrix}}{\begin{pmatrix}1\\3\end{pmatrix}\begin{pmatrix}1\\3\end{pmatrix}}\begin{pmatrix}1\\3\end{pmatrix}+\frac{\begin{pmatrix}2\\6\end{pmatrix}\begin{pmatrix}2\\4\end{pmatrix}}{\begin{pmatrix}2\\6\end{pmatrix}\begin{pmatrix}2\\6\end{pmatrix}}\begin{pmatrix}2\\6\end{pmatrix}$
$proj_A(b)=\frac{14}{10}\begin{pmatrix}1\\3\end{pmatrix}+\frac{28}{40}\begin{pmatrix}2\\6\end{pmatrix}$
$proj_A(b)=\frac{14}{10}\begin{pmatrix}1\\3\end{pmatrix}+\frac{14}{10}\begin{pmatrix}1\\3\end{pmatrix}$
$proj_A(b)=\frac{28}{10}\begin{pmatrix}1\\3\end{pmatrix}=\frac{14}{5}\begin{pmatrix}1\\3\end{pmatrix}$
$Pb$ is not equal $proj_A(b)$. What is wrong here? Why are not they equal?
 [/INST] Your solution for $P$ and $Pb$ is correct.
You can simply verify that $Pb$ is in the column space of $A$ and that $b-Pb$ is orthogonal to this column space, which is now the span of $\pmatrix{1\\3}$.
The other method works only if $u_1,u_2$ are orthogonal, and in that case it produces the projection to the plane spanned by $u_1$ and $u_2$, which only makes sense in 3 or more dimensional spaces.
Here the columns of $A$ are not orthogonal, rather they are parallel, so the subspace we project on is one dimensional, a line.
</s>