a) Let $\mathbf{P}$ be the $2\times 2$ matrix that projects vectors onto $\mathbf{u} = \begin{pmatrix}2\\ -1 \end{pmatrix}$. That is, $\mathbf{P} {v} = \operatorname{proj}_{u} ({v}) = \text{Projection of $\mathbf{v}$ onto $\mathbf{u}$}.$
Using the geometric meaning of the matrix and the picture, find $\mathbf{P} \begin{pmatrix}2 \\ -1 \end{pmatrix} \text{ and } \mathbf{P} \begin{pmatrix}1 \\ 2 \end{pmatrix} .$
The answer to part a) \begin{align*} \mathbf{P} \begin{pmatrix}2 \\ -1 \end{pmatrix} = \boxed{\begin{pmatrix} 2 \\- 1\end{pmatrix}}, \mathbf{P} \begin{pmatrix}1 \\ 2 \end{pmatrix} = \boxed{\begin{pmatrix} 0 \\ 0\end{pmatrix}}. \end{align*}
b) Now, let $\mathbf{P}$ be the $2\times 2$ matrix that projects vectors onto $\mathbf{u} = \begin{pmatrix}2\\ -1 \end{pmatrix}$. That is, $\mathbf{P} {v} = \operatorname{proj}_{{u}} ({v}) = \text{Projection of $\mathbf{v}$ onto $\mathbf{u}$}.$Use your answers from part (a) to figure out $\mathbf{P}$.
I set $P = \begin{pmatrix} a & b \\ c & d \end{pmatrix}$ and I have $\begin{pmatrix} a & b \\ c & d \end{pmatrix}\begin{pmatrix} x \\ y \end{pmatrix} = \begin{pmatrix} 2 \\ -1 \end{pmatrix}.$ How should I continue?

You can argue as follows. From (a), we have: $$\begin{pmatrix} a & b\\ c & d \end{pmatrix} \begin{pmatrix} 2\\ -1 \end{pmatrix} = \begin{pmatrix} 2\\ -1 \end{pmatrix} $$
$$\begin{pmatrix} a & b\\ c & d \end{pmatrix} \begin{pmatrix} 1\\ 2 \end{pmatrix} = \begin{pmatrix} 0\\ 0 \end{pmatrix} $$
We obtain two linear systems of equations for $a, b, c, d$:
\begin{cases} 2a-b = 2\\ a+2b=0 \end{cases}
\begin{cases} 2c-d=-1\\ c+2d=0 \end{cases}
Now, you just need to solve them.