Solution (source code)

= Solution

Write $P=I-Q$ with $Q=aa^T+bb^T$. The <orthonormality> conditions $a^Ta=b^Tb=1$ and $a^Tb=b^Ta=0$ give
$$
Q^2=a(a^Ta)a^T+a(a^Tb)b^T+b(b^Ta)a^T+b(b^Tb)b^T=aa^T+bb^T=Q.
$$
Consequently $P^2=I-2Q+Q^2=I-Q=P$. It is the <orthogonal projection matrix> onto the <orthogonal complement> of the <linear span> of $a,b$.