:PROPERTIES:
:ID: c2ab3236-d808-4121-8bee-67b2dd619ae0
:mtime: 20231017010823 20231010011730 20231007012626
:ctime: 20231007012524
:END:
#+title: Calculating the angle between 2 Vectors
#+filetags: :public:project:
* Method 1: Use the Law of Cosines
$|c|^2 = |a|^{2}+|b|^{2} -2|a||b|\cos\theta$
* Example
Let $a = (1,2,3)$, let $b = (2,3,2)$, let $O=(0,0,0)$.
Calculate the angle between $OA$ and $OB$.
** Solution
$|c|^2 =|a|^{2}+|b|^{2}-2|a||b|\cos\theta$
$\cos\theta = \frac{14+17-3}{2\sqrt{14}\sqrt{17}}=\sqrt{\frac{14/17}}$
But there also was a much easier way to solve this problem.
* Method 2: Using the [[id:51f7af57-31ed-4224-ae23-3e8230d908e7][Dot Product]]
$\cos\theta = \frac{\vec{a} \cdot \vec{b}}{|\vec{a}| | \vec{b}|}$
The [[id:51f7af57-31ed-4224-ae23-3e8230d908e7][dot product]] method is probably the easiest method
* Method 3: Using the [[id:cedb1489-8203-40db-82b7-48031c23f171][cross product]]
\[\theta = \arcsin{\frac{|\vec{a} \times \vec{b}|}{|\vec{a}| |\vec{b}|}}\]