Solution (source code)

= Solution

Set
$$
v_1=Pv,\qquad v_0=(I-P)v.
$$
Then $v=v_0+v_1$, and <idempotent>[idempotence] gives
$$
Pv_0=P(I-P)v=(P-P^2)v=0,\qquad
Pv_1=P^2v=Pv=v_1.
$$
Moreover,
$$
(v_0,v_1)
=((I-P)v,Pv)
=(v,(I-P)P v)=0,
$$
because both $P$ and $I-P$ are Hermitian. This is the orthogonal decomposition into the kernel and image of the projection.