Solution (source code)

= Solution

The two <orthogonal projections> are complementary, giving
$$
\boxed{P_{\hat{\mathbf u}}(\mathbf r)+R_{\hat{\mathbf u}}(\mathbf r)=\mathbf r}.
$$
They split a <vector> into its components parallel and perpendicular to $\hat{\mathbf u}$.