Scalar product

The scalar product a.b is defined as \textbf{a.b}=\left|\textbf{a}\right|\left|\textbf{b}\right|\cos\theta where \theta is the angle between \textbf{a} and \textbf{b}.

From this definition it can also be shown that \textbf{a.b} = {a_x}{b_x} + {a_y}{b_y} + {a_z}{b_z}

The main use of the scalar product is to calculate the angle \theta.

\left|\textbf{a}\right|\left|\textbf{b}\right|\cos \theta  = \textbf{a.b}

therefore \cos \theta  = \frac{{\textbf{a.b}}}{{\left|\textbf{a}\right|\left|\textbf{b}\right|}} where \textbf{a.b} = {a_x}{b_x} + {a_y}{b_y} + {a_z}{b_z}

Example

Calculate the angle \theta on the diagram below.

Angle theta between two lines

State the rule you are using for this question:

\cos \theta  = \frac{{p.q}}{{\left| p \right|\left| q \right|}}

Calculate p.q

{p_x}{q_x} + {p_y}{q_y} + {p_z}{q_z} =

3 \times 2 + ( - 1) \times 4 + 4 \times 2

= 10

Calculate \left| p \right| and \left| q \right|

\left| p \right| = \sqrt {9 + 1 + 16}  = \sqrt {26}

\left| q \right| = \sqrt {4 + 16 + 4}  = \sqrt {24}

Substitute:

\cos \theta  = \frac{{10}}{{\sqrt {26} \sqrt {24} }} = 0.400

Evaluate \theta

\theta  = 66.4^\circ

If your answer at the substitution stage works out negative then the angle lies between 90^\circ and 180^\circ. For example, if \cos \theta = - 0.362 then \theta = 111^\circ