Mathematics of Vectors
Introduction
Purpose
The purpose of this applet is to permit exercises in simple vector calculations
to be devised. It is designed to produce the answers to a particular problem
or problems that involve addition, subtraction, dot products, translation
and rotation of four vectors and allows the question to be posed for the
known solution. The applet does not extend to cross products or beyond.
Students and lecturers should find it a useful tool.
Some basics
A vector is a quantity having both magnitude and direction, such as displacement,
velocity, force and acceleration. Graphically, an arrow defining the direction
represents a vector. The length of the line connecting the tip of the arrow
to the tail indicates the magnitude of the vector. The tail end of the
vector is called the origin or initial point of the vector and the head
of the arrow is called the terminal point or terminus. Operations with
vectors do not always follow the same rules as elementary algebra. However,
the Commutative and Associative Laws for addition and multiplication do
apply and also does the distributive law when the vector is multiplied
by a scalar. In contrast, a scalar is a quantity having magnitude but no
direction. Examples are mass, length, time, temperature and any real number.
Operations with scalars follow the same rules as elementary algebra. It
is assumed that the reader is familiar with the above and with the basic
laws governing vector algebra, as well as the graphical method of summing
and taking the difference of vectors.
The rectangular unit vectors i, j, k.
An important set of unit vectors, which is used in this applet, are those
having the directions of the positive x, y and z axes of a three dimensional
right-handed rectangular coordinate system. These vectors are denoted by
i, j and k respectively. Any vector A, can
be represented with initial point at the origin O of a rectangular coordinate
and extend into space. The position of the tip of the arrow of the vector
can be resolved into a distance along the x axis, that is the component
Ax, a distance along the y axis, that is the component Ay,
and a distance along the z axis, that is the component Az. The
vector A can then be written as the sum of the components Axi,
Ayj and Azk, giving, A = Axi
+ Ayj + Azk. All vectors in this applet
are represented in this manner.
The sum of vectors.
Given two (or more vectors) say, A = Axi + Ayj
+ Azk and B = Bxi + Byj
+ Bzk, then the sum of these two (or more) vectors will
form a new vector R, given by R = A + B = (Ax
+ Bx)i+(Ay + By)j+(Az
+ Bz)k. Similarly, for the difference in two or more
vectors. Note, that it is only the components of the i unit vector
in the x direction that add. Similarly, for the y and z directions, the
components of the j and k unit vectors add. No adding of
components i with j, or j with k, or k
with i occurs, only i with i, and j with j
and k with k is permitted. The applet shows the sum of four
vectors R0, R1, R2 and R3 from two different
viewpoints. The first viewpoint is in the xy plane and the second is in
the xz plane. The resultant vector is called the Sum. Where the
sum is given by Sum = (R0x + R1x + R2x
+ R3x)i + ( R0y + R1y + R2y
+ R3y)j + ( R0z + R1z + R2z
+ R3z)k. In the xy plane only the i and j
vector components are observed, whereas, in the xz plane only the i
and k vector components are observed. It should be noted that the
Sum vector is not drawn in the applet, only its value is given.
This is to avoid a mass of lines that would tend to be distracting.
The dot product (scalar product).
The dot or scalar product of two vectors A and B, denoted
by A.B is defined as the product of the magnitudes of
A and B and the cosine of the angle q
between them. That is, A.B = |A||B|cosq
, 0£ q £
p . Note that A.B is a scalar
and not a vector. The following laws are valid; A.B =
B.A (Commutative Law for Dot Products), A.(B
+ C) = A.B + A.C (Distributive Law), m(A.B)
= (mA).B = A. (mB) = (A.B)m,
(where m is a scalar), and most important, i.i = j.j
= k.k = 1 and i.k = k.j = j.i
= 0. Also, if A = Axi + Ayj
+ Azk and B = Bxi + Byj
+ Bzk, then A.B = AxBx
+ AyBy + AzBz because
of i.i = j.j = k.k = 1 and i.k
= k.j = j.i = 0. Similarly, A.A
= (Ax)2+ (Ay)2+ (Az)2, and B.B
= (Bx)2+ (By)2+ (Bz)2. It follows
that as A is parallel with A, the angle between a line and
itself is zero, thus, A.A = |A||A|cos0 = |A|2.
This means that A.A = (Ax)2+ (Ay)2+
(Az)2 = |A|2 , and the magnitude of the vector
A is given by |A| = [(Ax)2+ (Ay)2+
(Az)2]1/2. Thus, A.B = AxBx
+ AyBy + AzBz = |A||B|cosq
= [(Ax)2+ (Ay)2+ (Az)2]1/2[(Bx)2+
(By)2+ (Bz)2]1/2 cosq
allowing the angle q , between any two vectors
A and B to be determined. The applet permits the three-dimensional
angle between any two vectors of the vector set, R0, R1,
R2 and R3 to be determined. Should the angle q
xy, in the XY plane be required (that is a two-dimensional angle)
then (A.B)xy = A.B = AxBx
+ AyBy = |(A)xy||(B)xy|
cosq xy = [(Ax)2+ (Ay)2]1/2[(Bx)2+
(By)2]1/2 cosq xy.
Similarly, should the angle q xz,
in the XZ plane be required (again a two-dimensional angle) then (A.B)xz
= AxBx + AzBz = |(A)xz||(B)xz|
cosq xz = [(Ax)2+ (Az)2]1/2[(Bx)2+
(Bz)2]1/2 cosq xz.
The applet does not show two-dimensional angles. Finally, if A.B
= 0 and A and B are not null vectors, then A and B
are perpendicular. Figure 1, below shows some of the aspects discussed
above.
Figure 1
The applet
The applet permits the vectors R0, R1, R2 and R3
to be changed. This is done by "clicking and dragging" the mouse in the
XY plane, at the point where all of these vectors come to a point (at the
point where Vxy is located in the XY plane in the diagram above).
The value of each of these vectors can be obtained by reading the relevant
vector on the top left-hand corner of the screen. Figure 2, above shows
only vectors R0 and R2. To change the vectors to those required,
change the value in the two bottom left-hand side scroll bars, labeled
"First Vector" and "Second Vector" to 0, 1, 2 or 3. If 1 is selected in
the "First Vector" scroll bar and 2 in the other, then the values of the
two vectors R1 and R2 will be displayed as shown in Figure
2.
Figure 2
In addition to the values of the vectors, the applet determines the
angle in space (three dimensions) between the two chosen vectors and prints
its value on the screen before the values of the chosen vectors. This is
the angle q mentioned in the dot product section
above and is called "3D-angle RmRn" on the screen. Its value is found by
taking the acosine of the dot product of the two chosen vectors after being
divided by their magnitudes. The Sum vector is the sum of the four
base vectors R0, R1, R2 and R3 is shown printed
out on the screen below the values of the chosen vectors. With no rotation
and no applied vector, the Result R vector will equal the Sum
vector. However, when the four base vectors are rotated together, as on
a rotating platform, by changing the value of the top left-hand scroll
bar labeled "Rotate Base", the value of the Result R vector will
change as the base vectors R0, R1, R2 and R3 change
on rotation. These base vectors change because of the change in orientation
of each vector in space. The rotation is in the XZ plane but the effects
of rotation can be seen drawn in the XY plane by the XY component Result
vector Rxy changing its x direction but keeping its y
value constant and by the base vectors changing in orientation and magnitude.
Similarly, in the XZ plane, the Result vector Rxz rotates
about the blue dot, representing the point where all base vectors converge,
as does the base vectors R0, R1, R2 and R3.
The values of the base vectors in the XY plane can be read by scrollbar
selection and considering only the i and j vector component
and in the XZ plane by considering only the i and k vector
component. The application of an "Applied Vector V" is made by inserting
values in the right-hand side scroll bars for the i, j and
k vector components. This vector V can be applied without
rotation and with rotation. The result of applying the vector V is
a change in the Result R vector. This change is further compounded by rotation.
The source code
(version 98/10/17) is available according to the GNU
Public License.
Tony Townsend,
tonyart@ieee.org