Solution (source code)

= Solution

The scalar $\mathbf r\cdot\hat{\mathbf u}$ is the signed <scalar projection> along the <unit vector> $\hat{\mathbf u}$. Multiplying by that <unit vector> makes $P_{\hat{\mathbf u}}(\mathbf r)$ the <orthogonal projection> of $\mathbf r$ onto its span.

For the other expression, the <vector triple product identity> gives
$$
\boxed{R_{\hat{\mathbf u}}(\mathbf r)
=\mathbf r(\hat{\mathbf u}\cdot\hat{\mathbf u})
-\hat{\mathbf u}(\hat{\mathbf u}\cdot\mathbf r)
=\mathbf r-\hat{\mathbf u}(\mathbf r\cdot\hat{\mathbf u})}.
$$
This is the <orthogonal projection onto a plane> perpendicular to $\hat{\mathbf u}$ through the origin. Its <dot product> with $\hat{\mathbf u}$ is zero, while the difference from $\mathbf r$ is parallel to $\hat{\mathbf u}$.