How to prove ${\bf u}\cdot{\bf v}=|{\bf u}|\cdot|{\bf v}|\cos\theta$, if $\theta$ is the angle between $|{\bf u}|$ and $|{\bf v}|$ This is a snippet from my book.

How did they get from $|{\bf u}|^2={\bf u}\cdot{\bf v}=|{\bf u}||{\bf v}|\frac{|{\bf u}|}{|{\bf v}|}$?

$\textbf{A really nice construction of this proof}$: Let $\textbf{A,B}$ be two vectors and $B$ $\neq O$.  We seek a vector $P$ such that, $$(\textbf{A} -P) \cdot \textbf{B} = 0$$ and $P=c\textbf{B}$ for some number $c$. Suppose we can find such a number $c$, namely one satisfying, $$(A-cB) \cdot B = 0$$ We then get $$\textbf{A} \cdot \textbf{B} = c\textbf{B} \cdot \textbf{B}$$ and therefore $c=\frac{ \textbf{A} \cdot \textbf{B}}{\textbf{B} \cdot \textbf{B}}$. From this construction and use of what we know about planee geometry,  $$\cos(\theta) = \frac{c||\textbf{B}||}{||\textbf{A}||}$$ and substituting in our value for $c$ we get, $$A \cdot B = ||\textbf{A}|| ||\textbf{B}|| \cos(\theta)$$ \
$\textbf{Picture for our Construction}$

