Angle Between Vectors

## Description

Here, we will find the angle between two vectors ($\theta$) $a$ and $b$, where

(1)
\begin{align} a = <1, 2, 3> \\ b = <4, 5, 6> \end{align}

Sage has no command to directly find the angle between two vectors, so we will be making use of the formula

(2)
\begin{align} cos \theta = \frac{a \cdot b}{\|a\| \cdot \|b\|} \end{align}

## Sage Cell

Note the answer is in radians. We use .n() here, because Sage would otherwise return arccos(16/539*sqrt(77)*sqrt(14)), which isn't very useful.

#### Code

a = vector([1, 2, 3])
b = vector([4, 5, 6])
dotproduct = a.dot_product(b)
myfraction = dotproduct/(norm(a) * norm(b))
arccos(myfraction)

none

## Tags

Primary Tags:

Secondary Tags:

A list of possible tags can be found at The WeBWorK Open Problem Library. For linear algebra tags see the Curated Courses Project.

## Related Cells

Any related cells go here. Provide a link to the page containing the information about the cell.