Find the length of the projection of $v$ onto $u$ without knowing the dot product formula

linear algebravectors

Let's say I have two $2$-D vectors, $v$ and $u$. I want to find the length of the projection,$P$, of $v$ onto $u$ as depicted by the red arrow in the figure below:

enter image description here

Now I know this problem becomes trivial if I use the dot product. However, I'm still sort of struggling to understand the dot product so I want to see if I can arrive to the answer without using it (and maybe the dot product will pop out along the way).

I've been trying to use the Law of Cosines as my starting idea:
$$\vert\vert{u-v}\vert\vert^2 = \vert\vert{u}\vert\vert^2 + \vert\vert{v}\vert\vert^2 -2\vert\vert{u}\vert\vert*\vert\vert{v}\vert\vert\cos{\theta}$$

I also know that:

$$cos{\theta} = \frac{P}{\vert\vert{v}\vert\vert}$$

Therefore:

$$P = \frac{\vert\vert{u}\vert\vert^2 + \vert\vert{v}\vert\vert^2 – \vert\vert{u-v}\vert\vert^2}{2\vert\vert{u}\vert\vert}$$

Best Answer

Illustration

Let the coordinates for $\mathbf{u}$ and $\mathbf{v}$ be $(u_x, u_y)$ and $(v_x, v_y)$ respectively. We can derive the expression for $\operatorname{cos}\theta$ using the coordinates. We need some trigonometric identity along the way.

As we can see in the illustration, the angle between $\mathbf{u}$ and the x-axis is $\alpha$, and the angle between $\mathbf{v}$ and $\mathbf{u}$ is $\theta$. We have

$$ \operatorname{tan}\alpha = \frac{u_y}{u_x},\; \operatorname{tan}(\alpha + \theta) = \frac{v_y}{v_x}. $$

We need to the trig identity to solve for $\operatorname{tan}\theta$

$$ \operatorname{tan}(a - b) = \frac{\operatorname{tan}(a) - \operatorname{tan}(b)}{1+\operatorname{tan}(a) \operatorname{tan}(b)} . $$

To solve for $\operatorname{tan}\theta$ \begin{align} \operatorname{tan}\theta = \operatorname{tan}(\alpha + \theta - \alpha) &= \frac{\frac{v_y}{v_x} - \frac{u_y}{u_x}}{1 + \frac{u_yv_y}{u_xv_x}}\\ &= \frac{u_xv_y - u_yv_x}{u_xv_x + u_yv_y}. \end{align}

From $\operatorname{tan}\theta$, we can easily derive $\operatorname{cos}\theta$,

$$ \operatorname{cos}\theta = \frac{u_xv_x + u_yv_y}{u_x^2v_x^2 + u_x^2v_y^2 + u_y^2v_x^2 + u_y^2v_y^2}.$$

With the formula for the projection

$$ p = ||\mathbf{v}|| \operatorname{cos} \theta,$$

we have

$$ p = \frac{u_xv_x + u_yv_y}{u_x^2v_x^2 + u_x^2v_y^2 + u_y^2v_x^2 + u_y^2v_y^2} (v_x^2 + v_y^2) = \frac{u_xv_x + u_yv_y}{u_x^2 + u_y^2}. $$

So without using the dot-product, we can derive the expression of the projection using the vector coordinates. However, we can easily see that the numerator is the dot product and the denominator the norm of $\mathbf{u}$, i.e.,

$$ p = \frac{\mathbf{u}\cdot\mathbf{v}}{||\mathbf{u}||} $$

So indirectly, we end up with a form which shows that the dot-product indeed works. :)