# Understanding the orthogonal projection vector derivation

As you can see below, $$z$$ is the projection of $$x$$ onto $$y$$... I am trying to derive the orthogonal projection formula based on things I already know.

Calculating $$cos(\theta)$$ is trivial...

$$cos(\theta) = \frac{\left \| z \right \|}{\left \| x \right \|}$$ $$\left \| z \right \| = \left \| x \right \|cos(\theta )$$

I also know that the dot product can be re-written as...

$$cos(\Theta ) = \frac{xy}{\left \| x \right \| \left \| y \right \|}$$

So by substitution we get...

$$\left \| z \right \| = \frac{xy}{\left \| y \right \|}$$

We can define the direction of $$y$$ as...

$$u = \frac{y}{\left \| y \right \|}$$

So we now have...

$$\left \| z \right \| = u\cdot x$$

Now since $$z$$ and $$y$$ point in the same direction, $$u$$ can be written as...

$$u = \frac{z}{\left \| z \right \|}$$ $$z = \left \| z \right \|\cdot u$$

Therefore, we have...

$$z = (u \cdot x) u$$

What I find strange is the following two equations...

$$\left \| z \right \| = u\cdot x$$ $$z = (u \cdot x) u$$

What this is telling me is that, multiply $$x$$ by the y-direction, $$u$$, and you get the length of $$z$$, in other words, $$\left \| z \right \|$$. Multiply $$x$$ by the y-direction, $$u$$, again, and you get the vector $$z$$ with direction.

I can't seem to wrap my head around why this is true. Is there a more intuitive explanation as to why multiplying $$x$$ by y-direction goes from getting the length of $$z$$ to getting the $$z$$ vector itself?

• There are two different types of multiplication in $(u\cdot x)u$, but you appear to be interpreting both the same way. – amd Apr 16 at 5:50
• @amd two different ones in what sense? – Bolboa Apr 16 at 12:52
• $u\cdot x$ takes two vectors and produces a scalar $a$. You then multiply the vector $u$ by this scalar to get another vector. These two operations are rather different. – amd Apr 16 at 16:58