Edited

Let $\displaystyle \theta$ be the angle between vectors $\displaystyle \vec{a}$ and $\displaystyle \vec{b}$.

We find the projection of $\displaystyle \vec{b}$ onto $\displaystyle \vec{a}$ by first drawing an altitude (perpendicular to $\displaystyle \vec{a}$) from the head of $\displaystyle \vec{b}$ to $\displaystyle \vec{a}$. We have a right triangle, and by good old SOH CAH TOA, $\displaystyle proj_{\vec{a}}\vec{b} = \left| \vec{b} \right|\cos(\theta)$, because $\displaystyle \vec{b}$ is the hypotenuse.

We also have that $\displaystyle \cos(\theta) = \frac{\vec{a} \cdot \vec{b}}{\left|\vec{a}\right| \left|\vec{b}\right|}$.

When I substitute that into the equation for the projection of $\displaystyle proj_{\vec{a}}\vec{b}$, I get

$\displaystyle proj_{\vec{a}}\vec{b} = \left| \vec{b} \right| \cos(\theta) =\frac{\vec{a} \cdot \vec{b}}{\left|\vec{a}\right|}$

right?

But that yields a number, not a vector.

What am I (still) doing wrong?