Finding the idempotent matrix I am faced with the problem:

Let $p$ $=$ $\begin{pmatrix} 1\\2 \end{pmatrix}.$  Find the idempotent matrix M such that $Mv$ is orthogonal to $p$ for any $2 \times 1$ vector $v$.

I understand that that I can use the matrix identity

$[I - uu^T]v$ = component of $v \perp u$, for a unit vector $u$ and any vector $v$

However, I'm really not sure how to apply the identity - especially to a problem like this. Would someone be able to help me both understand the identity better and how to apply it in this scenario? Thanks for your help in advanced!
 A: If you set $u = \frac{1}{|p|}p$, then 
$$(u^Tv)u$$
is the orthogonal projection of $v$ onto the subspace (here a line) spanned by $p$.
Note that $(u^Tv)$ is a scalar and $(u^Tv)u$ can be rewritten as
$$(u^Tv)u = (uu^T)v$$
Now, 
$$v- (uu^T)v = (I-uu^T)v$$
means subtracting the component of $v$ in direction of $p$ to obtain the remaining component of $v$ in the direction orthogonal to $p$. 
(Here you may think, for example, of the decomposition of a force or velocity or any other vector $v$ into two orthogonal components, where the direction $p$ of one component is already given.)
Edit after comment (setting up the matrix):
$$u = \frac{1}{\sqrt{5}} \begin{pmatrix} 1 \\ 2\end{pmatrix} \Rightarrow uu^T = \frac{1}{\sqrt{5}} \begin{pmatrix} 1 \\ 2\end{pmatrix} \cdot  \frac{1}{\sqrt{5}} \begin{pmatrix} 1 & 2\end{pmatrix} = \frac{1}{5} \begin{pmatrix} 1 & 2 \\ 2 & 4\end{pmatrix}$$
So, you get
$$I - uu^T =  \begin{pmatrix} 1 & 0 \\ 0 & 1\end{pmatrix} - \frac{1}{5} \begin{pmatrix} 1 & 2 \\ 2 & 4\end{pmatrix} = \frac{1}{5}\begin{pmatrix} 4 & -2 \\ -2 & 1\end{pmatrix} $$
You can check, that this matrix $P = I - uu^T$ has the property $P^2 = P$, hence is idempotent.
A: Let $$M = I - \frac{1}{p^Tp}pp^T$$
You've got that $$(Mv)^Tp = v^TM^Tp= v^T (I - \frac{1}{p^Tp}pp^T)p) = v^T (p - p) =0$$
also $$M^2 = MM =(I - \frac{1}{p^Tp}pp^T)(I - \frac{1}{p^Tp}pp^T) = I - \frac{1}{p^Tp}pp^T = M$$
A: Your matrix $M$ will be the orthogonal projection onto $\{p\}^\perp = \operatorname{span}\left\{\begin{bmatrix} 2 \\ -1\end{bmatrix}\right\}$.
In the orthonormal basis $B = \left\{\frac1{\sqrt5}\begin{bmatrix} 2 \\ -1\end{bmatrix}, \frac1{\sqrt5}\begin{bmatrix} 1 \\ 2\end{bmatrix}\right\}$ your matrix will look like $M_{(B)} = \begin{bmatrix} 1 & 0 \\ 0 & 0 \end{bmatrix}$.
To get how it looks like in the standard basis $E$, use the orthogonal transformation matrix $I_{(E,B)} = \frac1{\sqrt5}\begin{bmatrix} 2 & 1 \\ -1 & 2 \end{bmatrix}$.
Now we have
\begin{align}
M_{(E)} &= I_{(E,B)}M_{(B)}I_{(B,E)} \\
&= I_{(E,B)}M_{(B)}\left(I_{(E,B)}\right)^t \\
&= \frac1{\sqrt5}\begin{bmatrix} 2 & 1 \\ -1 & 2 \end{bmatrix}\begin{bmatrix} 1 & 0 \\ 0 & 0 \end{bmatrix}\frac1{\sqrt5}\begin{bmatrix} 2 & -1 \\ 1 & 2 \end{bmatrix}\\
&= \frac15\begin{bmatrix} 4 & -2 \\ -2 & 1 \end{bmatrix}
\end{align}
A: For the given vector $p=(1, 2)^T$ clearly the vector $q=(2,-1)^T$  is perpendicular. Now take a piece of paper plot these points, join them both to the origin, extending them both infinitely in both directions. Call the lines $L_p and L_q$.
Now consider a linear transformation of the plane that sends  every vector $v$ to a point in $v'\in L_q$, moving in the direction parallel to $L_p$ (clearly $v'$ is the closest point in $L_q$ for $v$).
This is a linear transformation and its matrix (wrt the standard basis) will give you what you want.
