I am trying to prove the angle between two vectors (u and v) formula i.e. $$u\cdot v = \cos(\theta)\|u\|\|v\|$$ I am having problem figuring out only a part of the proof. Please refer to the image from the proof of the formula as given in the book Mathematics for Economists by Simon and Blume.
In the image, m is given to be equal to $u - tv$. I am not sure which property is being used. I don't think the Pythagoras theorem is being used. Can anyone help explain what this is concerned with.
Thanks.

By definition, $\cos(\theta) = \frac{OR}{OP}$, where $OR = ||tv||$, $OP = ||u||$.
Then,
$$ \begin{aligned} \cos(\theta) &= \frac{||tv||}{||u||} = \frac{|t|\cdot||v||}{||u||}\Leftrightarrow ||u||\cos(\theta) = |t|\cdot||v|| \Leftrightarrow \\ |t|||v||^2 &= ||u||||v||\cos(\theta) \end{aligned} $$
Next, applying the Pythagorean theorem, $OR^2 = OP^2-RP^2$, i.e.,
$$ \begin{aligned} t^2||v||^2 &= ||u||^2-||u-tv||^2 = u\cdot u - (u-tv)\cdot (u-tv) = \\ &= u\cdot u - u\cdot u + 2t u \cdot v - t^2v\cdot v = 2t u \cdot v - t^2||v||^2 \Leftrightarrow \\ 2t^2 ||v||^2 &= 2t u \cdot v \Leftrightarrow t||v||^2 = u\cdot v \end{aligned} $$
Comparing the two equalities, we obtained that $$ u\cdot v = ||u||||v||\cos(\theta) $$