Two vectors $\mathbf{a}$ and $\mathbf{b}$ in $\mathbb R^2$ with components $a_x$ and $a_y$ (respectively $b_x$ and $b_y$), along the $x$ and $y$ axes can be written as:
$$\mathbf{a}=a_x\hat{\bf x}+a_x\hat{\bf y}, \quad \mathbf{b}=b_x\hat{\bf x}+b_x\hat{\bf y} $$
In several books in Italian language the $(1)$ is taken as definition of scalar product which has commutative property:
$$\mathbf{a}\cdot \mathbf{b}\stackrel{\text{def}}{=}ab\cos \vartheta \tag{1}$$ where $\vartheta=\measuredangle \mathbf{a}\mathbf{b}$. For my humble opinion it is not properly correct because to exist this simple proof:
$$\mathbf{a}\cdot\mathbf{b}=a_xb_x+a_yb_y=a\cos\vartheta_a \ b\cos\vartheta_b+a\sin\vartheta_a \ b\sin \vartheta_a$$ $$=ab \ (\cos\vartheta_a\cos\vartheta_b+\sin\vartheta_a\sin\vartheta_a)=ab \ \cos (\vartheta_a - \vartheta_b)$$ $$=ab \cos \vartheta \tag{2}$$
where $\vartheta_a$ is the angle measured in the counterclockwise direction in relation to the $x-$axis; same for $\vartheta_b$. In addition let be $\vartheta_a>\vartheta_b$ and $\vartheta=\vartheta_a-\vartheta_b>0$.
My clarifications are two:
- What is the correct definition of scalar product $\mathbf{a}\cdot\mathbf{b}=a_xb_x+a_yb_y \,$ or $\, \mathbf{a}\cdot \mathbf{b}=ab\cos \vartheta$?
- Is there a different proof of the $(2)$?
I'll assume vectors are column vectors, unless transposed. I recommend the definition $a\cdot b=\sum_ia_ib_i$, the unique entry in the $1\times 1$ matrix $a^Tb$ (so $a^T$ is a row vector), since then it's obvious $a\cdot b$ is invariant under rotations viz. $a\mapsto Ra,\,b\mapsto Rb$ with $R^TR$ the identity matrix so that$$(Ra)^TRb=a^TR^TRb=a^Tb\implies (Ra)\cdot Rb=a\cdot b.$$Since $ab\cos\vartheta$ (I usually see $\theta$ used, but maybe that's an English thing) is also obviously invariant under rotations, to prove the two expressions for $a\cdot b$ are equivalent you can start by rotating so $a$ is along the positive $x$-axis. Then$$\hat{x}\cdot\hat{x}=1,\,\hat{x}\cdot\hat{y}=0\implies a\cdot b=(a\hat{x})\cdot(b\cos\vartheta\hat{x}+b\sin\vartheta\hat{y})=ab\cos\vartheta.$$