Dot product angles greater than 180

501 Views Asked by At

Am I correct in saying that the angle in a dot product can't exceed or be 180 because the angle is based on the law of cosines?

3

There are 3 best solutions below

0
On

Ah, the situation is that the dot product unambiguously computes the cosine of the angle between the vectors. It does not at all directly compute the angle itself... for which there would indeed be ambiguity or an issue of definition/convention, as you speculate. That is, the dot product computes a value $c$, and it's up to you to decide how to determine an angle $\theta$ such that $\cos \theta = c$. (Yes, I know, many textbooks authoritatively declare that $\cos^{-1}$ takes values in a certain range, but that's just convention, not a mathematical fact: $\cos^{-1}$ is multi-valued...)

0
On

Let's take two vectors, $a,b \in \mathbb{R^2}$, as you've pointed out:

$a\cdot b = b\cdot a= a_1b_1+a_2b_2 = |a||b|\cos \theta \implies \theta = \arccos \left(\frac{a\cdot b}{ |a||b|}\right) \in [0,\pi]$

Concretely, if $a=[1,0],\;b=[1,1]$ then $|a|=1,\;|b|=\sqrt{2}\;$ and we get

$a\cdot b = 1 \implies \theta = \arccos\left(\frac{1}{\sqrt{2}}\right) = \frac{\pi}{4} \text{rad}$ or $45\deg$ -- this is the smaller of the two possible angles, with the other being $\frac{7\pi}{4}$ or $315 \deg$.

So we can see that the above formula for $\theta$ will give us the smallest unsigned angle between the vectors. As given by the other answer, this a bit of convention.

0
On

One common approach:

First, define $\arccos$ to be the inverse of $\cos|_{[0,\pi]}=\cos|_{[0,180^\circ]}$ (the restriction of $\cos$ to $[0,\pi]=[0,180^\circ]$, i.e. the function that is the same as $\cos$ but with that domain).

Next, define the angle between two vectors $\mathbf u$ and $\mathbf v$ to be $\arccos \frac{\mathbf u \cdot \mathbf v}{|\mathbf u||\mathbf v|}$. (This definition can indeed be motivated by the Law of Cosines.)

Now, so defined, any angle will indeed be in $[0,\pi]=[0,180^\circ]$.