If you were to draw out some more vectors and
perform subtraction on them there is an important property that you
will see. If we position the vectors a and b so that
they share the same point for their tale then b minus a
can be interperted as the vector pointing from b's head to
a's head.
There are two vectors that are given special names. These vectors
have a length of one and point int the direction of the increasing
x- and y-axis. Mathematically, they are defined like this:
i = <1, 0>
j = <0, 1>
Many times it is convient to write a vector as a sum of its i
and j components. This is done by scaling the i and
j vectors until their sum is equal to the vector you are
trying to obtain. For example, the vector <3, 2> could be
written as 3i + 2j. In general, a vector <x, y>
can also be written as xi + yj. Individually i
and j are called unit vectors, and grouped together they
are called the standard basis vectors. Bases will be something covered
in another tutorial and you will see why that name is given to these
vectors.
Unit Vectors
From the arithmetic of scalars you know that if you divide a number
by itself you get the number one. Well, a similar operation can
be done to vectors except the outcome is much more useful. If you
multiply a vector by the reciprocal of its norm then you get what
is called a unit vector. A unit vector has a norm of one.
v = <x, y>
u = (1 / ||v||) * v
________
= (1 / \/ x2 + y2) * v
Unit vectors are very useful in many different situations. The
first peculiarity that we will look at with unit vectors are its
components. By looking at the definition of a unit vector above
we can see that the individual components come out like this:
________
ux = x / \/ x2 + y2
________
uy = y / \/ x2 + y2
Therefore the components of a unit vector are obtained by dividing
each component by the norm of the vector. Doing this is actually
the same as doing the "opposite over hypotenuse" or "adjacent
over hypotenuse" familiar with sine and cosine. This means
that the x-components of a unit vector is the cosine of the vector's
direction, and the y-component of a unit vector is the sine of the
vector's direction.
u = <cos q, sin q>
Many times it is best to represent the "direction" of a
vector with the vector's unit vector rather than its angle with the
horizontal. For example, what if you wanted a vector in the same direction
as v = <1, 2> but with a magnitude of four exactly. You
may start of by finding the angle that v makes with the horizontal,
then find the sine and cosine of that angle, and finally multiplying
the sine and cosine by the new length to find the components of the
new vector. However, with what we know about unit vectors we can simply
take the unit vector of v, and scale it by four, thus giving
us a new vector with a length of four.
_
||v|| = \/5
_
u = (1 / \/5) * <1, 2>
= <.447, .894>
w = 4 * u
= <1.788, 3.578>
The vector w is now in the same direction as v except
with a magnitude of four. You can double check that by find the
norm of w.
In general, you can change the length of vector v to a
by doing this:
v
w = a * -----
||v||
Dot Product
Another form of multiplication for vectors is called the dot product.
The dot product is defined as follows:
v = <vx, vy>
w = <wx, wy>
v · w = vxwx + vywy
Note that the dot product of two vectors is a scalar. A dot product
does not return a vector.
The best geometric interpretation of the dot product is the angle
between two vectors. The dot product relates the cosine of the angle
between two vectors with the following equation:
v · w = ||v|| * ||w|| * cos q
Although we are skipping all mathematical rigor for this tutorial
it can be said that the above is derived from the law of cosines.
By re-arranging the above equation we can explicitly solve for
the cosine of the angle between two vectors:
v · w
cos q = ---------------
||v|| * ||w||
Finally, we can also use the dot product to determine whether or
not two vectors are perpendicular (orthogonal). Othogonal is used
when two things meet at a right angle (90 degrees or p/2
radians). Plugging in the known angle into the dot product we see
this:
v · w = ||v|| * ||w|| * cos 90
= ||v|| * ||w|| * 0
= 0
This implies that if the dot product of two vectors is zero then
they are orthogonal. This is a very important property and it will
be used later on.
Projection
A common situation that occurs when dealing with vectors is find
the component of one vector along another. This is known as a projection.
There are four types of projection that can be very useful: parallel
scalar projection, parallel vector projection, perpendicular scalar
projection, and perpendicular vector projection.
The parallel scalar projection is like dropping the shadow of one
vector onto another. The parallel vector projection is basically
the same except it is a vector in the direction of the vector being
projected onto with the norm of the scalar projection. The perpendicular
scalar projection is the shortest distance from the head of one
vector to the vector being projected onto. The perpendicular vector
projection has a norm equal to the perpendicular scalar projection
and is orthogonal to the vector being projected onto.
The picture below will help most with developing what these quantities
mean. Fortunately all are very simple to derive. To start off with
we will find the parallel and perpendicular projection equations.
First here is a picture:
|