The nearest point from $B$ on the line passing through $A$ and the origin is $v= \frac {\langle a,b \rangle} {\langle a,a \rangle} a$.
The projection of $v$ onto $W$ is the vector in $W$ closest to $v.$
Let $V$ be an inner product space and $v,w \in V$
→ Define $proj_w(v)=proj_{\langle w \rangle} (v)$ , here $w$ is a vector and not a subspace.
→ An orthonormal basis for $\langle w \rangle$ is $\frac w {||w||}$.
Let $V$ be an inner product space and $W$ be a subspace.
Then the projection of vectors in $V$ to $W$ is a linear transformation($P_W$) from $V$ to $V$ with image $W$.