## Mathematical Recreations

 MathRec Home Introductory Problem Last Month's Problem Older Problems Educational Resources Steve's Personal Page

#### Vector Operations

Many problems can be solved most easily by using vector operations. (And some problems can't really be expressed very well, without reference to vector operations.) This page is a very quick review of vector operations. It might be sufficient to teach this material if you've never seen it before, but only if you're prepared to put in some work (or play) to really understand and familiarize yourself with the concepts and techniques.

#### Vectors

A vector is a quantity with both magnitude and direction. The classic example of a vector quantity is velocity. That is, how fast is it moving and in what direction? Vectors are often represented as arrows. This can be useful for communicating with others or for visualizing something yourself. In this representation, the arrow points in the direction of the vector, and the length of the arrow is proportional to the magnitude.

Vectors are often expressed in Cartesian coordinates with components along the x-, y- and z-axes. (Two-dimensional vectors are common, and higher-dimensional vectors are useful, too.) These vectors may be written like (3,4,12) indicating that the component of the vector in the x-direction is 3, the component in the y-direction is 4 and the component in the z-direction is 12.

Traditionally, symbols for vector quantities are written with an arrow over the symbol, but this is not convenient in most printing systems, including HTML. As an alternative, vector quantities are often set in bold type. This is the convention that I use on this site. The magnitude of x is represented as |x|.

If a train is moving with speed v, and someone is walking from back of the train to the front of the train with speed w, then we understand immediately that the speed of the walker with respect to the ground is v + w. In this case, the quantities w and v are scalar quantities. That is, they are represented by a single value without direction.

If the two velocities are not in the same direction, however, scalar addition won't answer the problem. Suppose, for example, that the wind is blowing from northeast to southwest at 20 km/hr, and a bicycle is moving from west to east at 30 km/hr, then what is the velocity of the wind with respect to the bicycle? Let's adopt coordinates which are aligned with the usual compass orientation, so that the positive y-axis is north and the positive x-axis is east. The bicycle will see a motion-induced headwind opposite to its own motion, so that apparent headwind is (–30, 0). The wind is blowing at a 45 degree angle with respect to the axes of our coordinate system. More precisely, the clockwise angle from the x-axis is 225 degrees, or 5π/4. The wind is (20 cos 5π/4, 20 sin 5π/4), or aproximately (–14.14, –14.14). The apparent wind with respect to the cyclist is approximately (–44.14, –14.14). That is, the x-components of the two vectors add together to give the x-component of the resultant. The y-component of the resultant is determined in the same way. Using the Pythagorean formula, we find that the magnitude of this wind is 44.30 km/hr. The direction of the wind is usually simply expressed using the components of the vectors, but you can always calculate the arctangent to find that the cyclist's apparent wind is coming from a direction 17.76 degrees to the left of a true headwind.

This same calculation can be accomplished geometrically. If you represent the vectors as arrows with magnitude and direction, then the geometric method is the same as aligning the head of the first vector with the tail of the second vector and finding the magnitude and direction of the arrow from the first tail to the second head.

#### Vectors and Position

Vectors do not have a location. A particular vector may represent a quantity which has a location, but that information is not part of the vector. On the other hand, you should be aware that position can be represented as a vector, where the three (Cartesian) components of the vector are the three coordinates of the position. In this case, the vector is describing the offset of the coordinate with respect to the origin of the coordinate system.

While the vector itself does not have a location, vectors can be expressed in terms of local coordinates. For example a vector in a spherical polar coordinate system (r, θ, φ) would be expressed in terms of the coordinate directions at some location. The r-direction is the direction in which the coordinate r increases, and similarly for the θ- direction and the φ-directions. These vectors may be added by summing the components, if (and only if) the coordinate directions apply to the same location in the coordinate system. For this reason, it is not uncommon to use Cartesian vector components from time to time, even when the position coordinates are in another system.

#### The Dot Product (Scalar Product)

The dot product of a vector is a scalar quantity equal to the product of the magnitudes of the two vectors times the cosine of the angle between them. The dot product is very useful for extracting the components of a vector in a particular direction. For example, the dot product between the unit vector in the x-direction (1,0,0) and a vector x gives the component of x in the x-direction.

In Cartesian coordinates, the dot product is numerically equal to the sum of the products of the vector components. That is,

a · b  =  (xa, ya, za) · (xb, yb, zb)  =  xaxb + yayb + zazb

The dot product is commutative. That is, a·b = b·a. Since the dot product is a scalar quantity, it is a binary operation on two vectors. Therefore, the concept of associativity is meaningless. The dot product does generalize to higher dimensions, and the dot product is still the product of the magnitudes times the cosine of the angle between the vectors, and it is still equal to the sum of the products of the components.

#### The Cross Product (Vector Product)

The cross product of two vectors is a vector quantity with a magnitude equal to the product of the magnitudes of the two vectors times the sine of the angle between them. The direction is perpendicular to the plane containing the original vectors. The orientation is according to the "right-hand rule". If you think of the direction of the angle (less than 180°) from the direction of the first vector to the direction of the second vector as a west-to-east angle, then the direction of the cross product is toward the north pole, not the south pole. That is, if x, y and z are the unit vectors in the x-, y- and z-directions, then x × y = z.

In Cartesian coordinates, the cross product is given by

a × b  =  (xa, ya, za) × (xb, yb, zb)  =  (yazbybza, zaxbzbxa, xaybxbya)

The cross product is not commutative, since a × b = –b ×a. Furthermore, the cross product is not associative, and (a × b) × c ≠ a × (b × c). For example, (x × y) × y = z × y = –x, but x × (y × y) = x × 0 = 0, where 0 is the zero vector (0,0,0). The cross product does not readily generalize to more than three dimensions. In fact, it is meaningless in two dimensions (except as a scalar quantity being the magnitude of the z-component of the cross product of two vectors in the x-y plane).

The simplest vector operator is the gradient. The gradient operator is normally written as an inverted delta (called a nabla) with a vector line over it or as a bold version of the same. If your browser supports it, then it looks like this: or ∇. When fonts do not allow, the operator is often simply written as grad or grad. This is the convention that I will use in this site. The gradient operates on a function to produce a vector field; that is, a function with vector values at all points. The gradient of a function f is verbally referred to as "grad f" or sometimes "del f", since the nabla is frequently referred to as "del". We write

grad f  =  (∂/∂x, ∂/∂y, ∂/∂z) f  =  (∂f/∂x, ∂f/∂y, ∂f/∂z)

where ∂/∂x represents partial differentiation with respect to x. (Partial differentiation of a function with respect to a variable, is normal differentiation holding the other variables constant. For a function of orthogonal spatial variables, such as the Cartesian coordinates, partial differentiation with respect to x respresents the rate of change of the function in the x-direction.)

The gradient is the maximal directional derivative. That is, if you look at the rate of change of the function f in a particular direction, and consider the direction which gives the maximum such rate of change, then grad f has a magnitude equal to that rate of change and has direction equal to that direction. If you want the rate of change in any other direction, specified by a unit vector (a vector with magnitude equal to one) u, then that rate of change is given by

f/∂u = u · grad f

#### The Divergence

The divergence operator is normally written as the dot product between a nabla and a vector function. When fonts do not allow, the divergence is usually written as div f. Verbally, the divergence of f is often refered to as "del dot f". The divergence is a scalar quantity.

A serious discussion of the physical significance of the divergence is beyond the scope of this page, but if you think of the vector field as a fluid flow or a current, the divergence shows where fluid or charge is created or destroyed. The Cartesian form is given by:

div f  =  (∂/∂x, ∂/∂y, ∂/∂z) · (fx, fy, fz)  =  ∂fx/∂x + ∂fy/∂y + ∂fz/∂z

#### The Curl

The curl operator is normally written as the cross product between a nabla and a vector function. When fonts do not allow, the divergence is usually written as curl f. Verbally, the curl of f is often refered to as "del cross f". The curl is a vector quantity.

A serious discussion of the physical significance of the curl is beyond the scope of this page, but if you think of the vector field as a fluid flow or a current, the curl reflects the tendency of the fluid or current to form vortices or loops. The Cartesian form is given by:

curl f  =  (∂/∂x, ∂/∂y, ∂/∂z) × (fx, fy, fz)  =  (∂fz/∂y – ∂fy/∂z, ∂fx/∂z – ∂fz/∂x, ∂fy/∂x – ∂fx/∂y)

Send all responses to .

Thanks,
Steve