# Inner product in $\mathbb{R}^2$ and angles of a triangle

Let $P_1,P_2,P_3$ be $3$ different points in $\mathbb{R}$, then $P_1,P_2,P_3$ form a triangle.

What is the relation between the (one of the) angles of this triangle and $\langle P_2-P_1,P_3-P_1 \rangle$ ?

I am having trouble figuring out which angle of the triangle it is - and even why it is an angle in the triangle...

Note: $\langle ,\rangle$ denotes the standard inner product of $\mathbb{R}^2$.

-

From the definition of the inner product for vectors $\vec{a},\vec{b}$ we got:

$$\vec{a}\cdot\vec{b}=\|\vec{a}\| \|\vec{b}\|\cos(\widehat{\vec{a},\vec{b}})$$

Applying this rule in your case:

$$\langle P_2-P_1,P_3-P_1 \rangle =\|P_2-P_1\|\cdot \| P_3-P_1\|\cdot \cos(\widehat{P_2-P_1,P_3-P_1}),$$

so by reforming:

$$\cos(\widehat{P_2-P_1,P_3-P_1})=\frac{\langle P_2-P_1,P_3-P_1\rangle}{\|P_2-P_1\|\cdot \| P_3-P_1\|}$$

The angle inside the $\cos$ is actually the angle between the two vectors that you're computing their inner product, in other words the angle between the two sides of your triangle formed by $P_2,P_1$ and $P_3,P_1$ respectively. So because the only mutual point is $P_1$, the angle is actually the angle corresponding to this point.

-

The angle between two vectors $a,b$ in $\mathbb{R}^2$ is actually defined by the formula $$\cos(\varphi)=\frac{\langle a,b \rangle}{\Vert a\Vert\cdot\Vert{b}\Vert}$$ so $\frac{\langle P_2-P_1,P3-P_1\rangle}{\Vert P_2-P_1\Vert\cdot\Vert P_3-P_1\Vert}$ is the cosine of the angle in $P_1$.

Here's a motivation for the above formula: First note that we can rewrite $\frac{\langle a,b\rangle}{\Vert a\Vert\cdot\Vert{b}\Vert}=\left\langle \frac{a}{\Vert a\Vert},\frac{b}{\Vert b\Vert}\right\rangle$, so replacing $a$ and $b$ by $\frac{a}{\Vert a\Vert}$ and $\frac{b}{\Vert b\Vert}$ we can assume that the vectors have length $1$. Now write $b$ in the basis $a,a^{\perp}$ ($a^{\perp}$ is one of the 2 perpendicular vectors to $a$ of length $1$). In this basis $a$ corresponds to the vector $(1,0)$ and $b$ will be a vector on the unit circle, $b=x_1 a + x_2 a^{\perp}$. Note that the cosine of the angle between $a$ and $b$ is $x_1$ by the classical definition! This is in accordance to our formula $\cos(\varphi)=\langle a,x_1 a + x_2 a^{\perp}\rangle=\langle a,x_1 a\rangle =x_1$.

-