How do I calculate the angle between two vectors?

1 Answer
Aug 29, 2014

You can use the dot product to solve this problem. See http://en.wikipedia.org/wiki/Dot_product

The dot product is an operation on two vectors. There are two different definitions of dot product. Let #\vec(A)=[A_1,A_2,...,A_n]# be a vector and #\vec(B)=[B_1,B_2,...,B_n]# be another vector, then we have 2 formulas for dot product:

1) Algebraic definition:

#\vec(A) \cdot \vec(B) = \sum_1^n A_i B_i = A_1 B_1 + A_2 B_2 + ... + A_n B_n#

2) Geometric definition:

#\vec(A) \cdot \vec(B) = ||\vec(A)||\ ||\vec(B)||\cos(\theta)#

where #\theta# is the angle between #\vec(A)# and #\vec(B)#, and #||\vec(A)||# denotes the magnitude of #\vec(A)# and has the formula:

#||\vec(A)|| = \sqrt(A_1^2 + A_2^2 + ... + A_n^2)#

We can solve many questions (such as the angle between two vectors) by combining the two definitions:

#\sum_1^n A_i B_i = ||\vec(A)||\ ||\vec(B)||\cos(\theta)#

or

#A_1 B_1 + A_2 B_2 + ... + A_n B_n = (\sqrt(A_1^2 + A_2^2 + ... + A_n^2))(\sqrt(B_1^2 + B_2^2 + ... + B_n^2))\cos(\theta)#

If we have two vectors, then the only unknown is #\theta# in the above equation, and thus we can solve for #\theta#, which is the angle between the two vectors.

Example:

Q: Given #\vec(A) = [2, 5, 1]#, #\vec(B) = [9, -3, 6]#, find the angle between them.

A:
From the question, we see that each vector has three dimensions. From above, our formula becomes:

#A_1 B_1 + A_2 B_2 + A_3 B_3 = (\sqrt(A_1^2 + A_2^2 + A_3^2))(\sqrt(B_1^2 + B_2^2 + B_3^2))\cos(\theta)#

Left side:

#A_1 B_1 + A_2 B_2 + A_3 B_3 = (2)(9) + (5)(-3) + (1)(6) = 9#

Right side:

#||\vec(A)|| = \sqrt(A_1^2 + A_2^2 + A_3^2) = \sqrt(2^2 + 5^2 + 1^2) = \sqrt(30)#
#||\vec(B)|| = \sqrt(B_1^2 + B_2^2 + B_3^2) = \sqrt(9^2 + (-3)^2 + 6^2) = \sqrt(126)#
#\theta# is unknown

Plug everything into the formula, we get:

#9 = (\sqrt(30))(\sqrt(126))\cos(\theta)#

Solve for #\theta#:

#\cos(\theta) = \frac(9)((\sqrt(30))(\sqrt(126))#
#\theta = \cos^-1(\frac(9)((\sqrt(30))(\sqrt(126))))#

Using a calculator, we get:

#\theta = 81.58# degrees

See the following video of ...

Angle Between Vectors Example