Finding an Idempotent Operator Taken from Conway's A course in functional analysis chapter 2, section 3, problem 1:
Let $\mathcal{H}$ be the two-dimensional real Hilbert space $\mathbb{R}^2$, let $\mathcal{M} = \{(x, 0)\in \mathbb{R}^2: x \in \mathbb{R}\}$ and let $\mathcal{N} = \{(x, x\tan\theta): x \in \mathbb{R}\}$, where $0<\theta<\frac{1}{2}\pi$. find a formula for the idempotnent $E_{\theta}$ with Ran$E_\theta = \mathcal{M}$ and Ker$E_\theta = \mathcal{N}$. Show that $||E_\theta|| = (\sin(\theta)||^{-1}$
My attempt at a solution is below:
An idempotent operator $E_\theta$ is one such that $E_\theta^2 = E_\theta$. I was hoping to let $E(x, y) = (\sqrt{x^2+y^2}, 0)$. It is idempotent and  clearly satisfies the condition on the range, but not the kernel. The norm of this map is also $\frac{1}{\cos(\theta)}$ which is a little bit off the norm the operator is supposed to be.
Any tips would be greatly appreciated.
 A: That chapter in Conway is about linear operators. Obviously the question expects $E_\theta$ to be linear; otherwise the operator is not uniquely defined.
The set of  linear operators on $\mathbb R^2$ is usually identified with the $2\times 2$ matrices. So you want
$$
E_\theta=\begin{bmatrix} a&b\\ c&d\end{bmatrix}.
$$
To be in $\mathcal M$, we want the second component of $E_\theta \begin{bmatrix} x\\ y\end{bmatrix} $ to be zero. That gives us
$$
cx+dy=0,\qquad x,y\in\mathbb R. 
$$
As this should hold for all $x,y$ we are forced to take $c=d=0$. We also want $E_\theta$ to be an idempotent, so we need
$$
\begin{bmatrix} a&b\\0&0\end{bmatrix}=E_\theta=E_\theta^2=\begin{bmatrix} a^2&ab\\0&0\end{bmatrix}.
$$
If $a=0$ we get $E_\theta=0$, which wouldn't have the right kernel nor image. So $a=1$.
With the range of $E_\theta$ and idempotency guaranteed, let's go for the kernel. We want
$$
\begin{bmatrix} 0\\0\end{bmatrix}=\begin{bmatrix} 1&b\\0&0\end{bmatrix}\begin{bmatrix} x\\ x\tan\theta\end{bmatrix}=\begin{bmatrix} x(1+b\tan\theta)\\0\end{bmatrix}.
$$
As this should hold for all $x$, this forces $b=-\frac1{\tan\theta}$. The norm of $E_\theta$ can be calculated by definition, but it is easier to do
$$
\|E_\theta\|^2=\|E_\theta E_\theta^*\|=\biggl\|\begin{bmatrix} 1&-\cot\theta\\0&0\end{bmatrix}\begin{bmatrix} 1&0\\-\cot\theta&0\end{bmatrix}\biggr\|
=\biggl\|\begin{bmatrix} 1+\cot^2\theta&0\\0&0\end{bmatrix}\biggr\|=\frac1{\sin^2\theta}.
$$
