Geometric interpretation of the euclidean product. I have always been taught about the euclidean product in $\mathbb{R}^n$ the algebraic way, that is $$xy=\sum_1^n x_iy_i$$
Now I find myself having to come to grips with the geometric definition as $xy=\|x\|\|y\|\cos \theta.$
I am trying to understand how to pass from one to the other.
Now if I fix the standard orthonormal basis of $\mathbb{R}^n,$ I have that $x_i=xe_i$ for every $i.$ Then, If I suppose that the geometric definition holds, I have $x_i=xe_i=\|x\|\|e_i\|\cos \theta_i=\|x\|\cos\theta_i, $ and similarly for $y_i,$ hence $$xy=\sum_i\|x\|\|y\|\cos^2 \theta_i=\|x\|\|y\|\sum_i \cos^2 \theta_i$$
How do I proceed from here to conclude the implication geometric $\implies$ algebraic?
And then I need also to show that the algebraic definition implies the geometric one.
 A: Think about the triangle that connects the vectors $x$, $y$, and the origin together. The law of cosines from geometry states that
$$a^2=b^2+c^2-2bc\cos(\alpha)$$
where $\alpha$ is the angle opposite $a$. We will assign $a$ to be the side of the triangle connecting $x$ and $y$, so $\alpha$ is the angle between $x$ and $y$. The equation reads
$$\|x-y\|^2=\|x\|^2+\|y\|^2-2\|x\|\|y\|\cos\alpha$$
The left side can be expanded, since
$$\|x-y\|^2=\|x\|^2-2(x\cdot y)+\|y\|^2$$
and canceling like terms gives
$$\cos\alpha=x\cdot y$$
Hope this helps!
A: I'll make the dot product explicit as $\cdot$.
First, let's correct a mistake of yours. While $x_i=x\cdot e_i=|x|\cos\theta_i$ with $\theta_i$ the angle between $x$ and $e_i$, the angle between $y$ and $e_i$ will in general be different, say $\phi_i$, so the angle $\alpha$ between $x$ and $y$ satisfies$$|x||y|\cos\alpha=x\cdot y=\sum_ix_iy_i=|x||y|\sum_i\cos\theta_i\cos\phi_i,$$i.e. $\cos\alpha=\sum_i\cos\theta_i\cos\phi_i$.
Now we'll move onto why $\sum_ix_iy_i=|x||y|\cos\alpha$. Both sides are invariant under rotations about the origin; for the left-hand side, note a rotational matrix $R$ satisfies$$R^TR=I\implies x^Ty=x^TR^TRy=(Rx)^TRy\implies x\cdot y=Rx\cdot Ry,$$and for the right-hand side note lengths are invariant under rotations, as are angles. So we only need check the special case where $x$ runs along the positive $x$-axis. Then $x$ has a single nonzero component, say $x_1=|x|$, while $y_1=|y|\cos\alpha$. (You can verify this with a diagram; bear in mind $x,\,y$ are coplanar, regardless of $n$.) So$$\sum_ix_iy_i=x_1y_1=|x||y|\cos\alpha.$$
