Given two vectors a and b we define there sum and difference as follows
The graph below shows the sum and difference of the two vectors a = < 1, 2, 1 > (in red) and b = < 1, -1, 2> (in blue). The sum is the longer diagonal of the parallelogram (in magenta) and the difference is the shorter diagonal of the parallelogram (in yellow).
The dot product of two vectors a and b is defined by
and since the angle between the two vectors can be computed using
we have that two vectors are perpendicular or orthogonal if
The dot product is also used to compute projections of one vector onto another as well as components of one vector along another. This is illustrated in the following figure.
The component and the projection vector are computed as follows.
The other vector product is called the cross product. Given two vectors a and b, their cross product is defined as the vector that is perpendicular to both vectors and in the direction given by the right-hand rule. It is calculated using 2 x 2 determinants.
The figure below gives the cross product of the vectors a = < 1, 2, 1 > (in red) and b = < 1, -1, 2> (in blue). Their cross product is c = < 5, -1, 3>. As can be seen the cross product is perpendicular to each of the vectors a and b.