Even though these are quite concepts that can be defined for a general vector space, let's define these first in <math>\R^{2}</math>.

Length

The length of a vector <math>\vec v = \left[\begin{array}{c}x\\y\\z\end{array}\right]</math> is given by <math>||\vec v|| = \sqrt{x^2 + y^2 + z^2} </math>

To define distance between points, it is useful to keep in mind this picture that relates points to vectors: Vec-points.jpg

Distance

The distance between two points <math> P_1 = (x_1, y_1, z_1)</math> and <math> P_2 = (x_2, y_2, z_2)</math> is given by

<math>

\|\vec p_2 - \vec p_1\| = \sqrt{(x_2-x_1)^2 +(y_2-y_1)^2 + (z_2-z_1)^2} </math>

Dot Product

The dot product of two vectors <math> \left[\begin{array}{c}x_1\\y_1\\z_1\end{array}\right]</math> and <math>\vec v_2 = \left[\begin{array}{c}x_2\\y_2\\z_2\end{array}\right]</math> is defined as

<math>

\vec v_1 \cdot \vec v_2 = x_1 x_2 + y_1 y_2 + z_1 z_2 </math>

A couple things to note:

  • Dot product is related to length
<math> \vec v \cdot \vec v = x^2 + y^2 + z^2 = \|\vec v\|^2 </math>
  • Dot product is related to angle
<math> \vec v_1 \cdot \vec v_2 = \|\vec v_1\|\|\vec v_2\| \cos{\theta}</math> where <math> \theta </math> is the angle between <math> \vec v_1 </math> and <math> \vec v_2 </math>

The proof of this last equation involves a trigonometric identity (the Law of Cosines) that I can never really remember. However, to get some idea why there is a relationship between dot product and angles, let's try to determine a test to see whether two vectors <math>\vec v_1 </math> and <math>\vec v_2 </math> are perpendicular. If they are perpendicular, then by Pythagoras, <math>\|\vec v_1\|^2 + \|\vec v_2\|^2 = \|\vec v_2 - \vec v_1\|^2</math>. Applying the length formula, this becomes

<math>

(x_1^2 + y_1^2+ z_1^2) + (x_2^2 + y_2^2 + z_2^2) = (x_2 - x_1)^2 + (y_2 - y_1)^2 + (z_2 - z_1)^2 </math> Expanding out and canceling, we get that the test for perpendicularity is given by

<math>

x_1 x_2 + y_1 y_2 + z_1 z_2 = 0 \Longrightarrow \vec v_1 \cdot \vec v_2 = 0 </math> This is consistent with the equation above since <math> \cos 90^{\circ} = 0 </math>.