Unbounded operator such that $P^2=P$
Let $f \ne 0$ be an unbounded linear functional on $X$. Then there is $u \in X$ such that $f(u)=1.$ Now define $P:X \to X$ by
$$P(x):=f(x)u$$
$P$ will do the job.
Let $f \ne 0$ be an unbounded linear functional on $X$. Then there is $u \in X$ such that $f(u)=1.$ Now define $P:X \to X$ by
$$P(x):=f(x)u$$
$P$ will do the job.