VI. Vectors

VI. Vectors Vector is a quantity that has both magnitude and directionality.
For example: the velocity of a particle describes how fast it is going (magnitude) and where it is heading
(direction).
On the other hand, scalar is a quantity that only has a magnitude (no direction)
For example the mass of a particle only says how heavy it is, but does not describe a direction.
More generally, vector can mean an array of numbers, without the actual meaning of magnitude and
direction. That is because vectors have several components, each of which is a scalar (number). Such
collection (array) of components (scalars) therefore obeys the same rules of algebra as vectors and for the
math purposes they are the same thing.
3­D Unit Vectors:
These are vectors that point in the direction of the Cartesian axes (x, y, x) and have the magnitude of 1.
z
ˆk
î
1
ˆj
y
1
x 1
The three unit vectors can be multiplied by a scalar quantity to obtain a vector pointing in the direction of
the unit vector:
x = x i (x is a scalar, î is the unit vector in the x-direction, and x is the vector),
y=yj
z=zk
Basis vectors: Such three mutually perpendicular vectors (actually, it is sufficient that they are linearly independent - see
below) define a three-dimensional space: any point in space (i.e. any vector) can be written as a
combination of these three unit vectors. We call such a set of vectors, which are sufficient to describe the
entire space, the basis vectors.
Components of a vector: Since i, j and k for a basis of the 3-D space, any R = R êR (where êR is the unit vector in the direction of
R), can be written in terms of its components along the i, j, and k basis vectors:
1
R=x+ y+ z
= x î + y ˆj + z ˆk
= (x,y,z) êR
R = Rxi + Ryj + Rzk
where Rx, Ry, Rz are scalars and represent, respectively, the x-, y- and z-components of the vector R. For a
given set of basis vectors, we can write R in terms of its components as:
R = (Rx, Rx, Rx)
Remember, however, that the components of the vector are dependent on the basis. If we chose different
basis vectors, for example by rotating our coordinate system, the components would also change. In other
words, writing vectors as their components always implies that there is a well defined basis.
Algebra of Vectors:
For the purpose of examples, we will use the following generic 3-D vectors:
a = ax i + ay j + azk and b = bx i + by j + bzk
Scalar Multiplication:
s • a = s•ax i + s•ay j + s•az k
s • (a + b) = s • a + s • b
Magnitude (Norm) of a Vector
|a| = (ax2 + ay2 + az2)1/2
Arbitrary Unit Vector:
êb = b/|b|
Addition:
a + b = (ax + bx) i + (ay + by ) j + (az + bz) k
Scalar (“dot”) product Unlike for scalars, there are several different products of vectors. The most important one is the scalar
(also called a “dot product, or an inner product). As the name implies, scalar product of vectors is a
NUMBER (SCALAR)!
a • b = |a| |b| cos()
2
a

b
In terms of individual components:
a • b = ax i • b + ay j • b + az k • b = ax i • (bx i + by j + bz k) + ...
= (axbx) i • i + (axby) i • j + (axbz) i • k + ....
But, if we look at the individual unit vector dot products we see:
i • i = (1)(1) cos(0) = 1
i • j = i • k = (1)(1) cos(π/2=90˚) = 0
Therefore:
a • b = (axbx) + (ayby) + (azbz) = b • a
In other words, the scalar product is the sum of products of the individual components:
a • b = [ax , ay , az] • [bx , by , bz] = axbx + ayby + azbz
The dot product can be used as a way of finding the angle between two vectors:
 = cos–1
a•b
a•b
= arccos
a b
a b
Note that the norm of magnitude of a vector is also given from its dot product with itself:
| a | =( a • a)1/2
Projection of a vector onto another vector The dot product can also be considered as a projection of one vector onto the other:
projection of b onto a = |b| cos() = [b•a]/|a|=[b•a]/(a•a)1/2
This tells us what portion of the vector a is in the direction given by the vector b.
In fact, the components of a vector are nothing else than its projections on the coordinate axes:
a.x/|x| = (ax i + ay j).xi /x = ax i.i + ay j.i = ax
a.y/|y| = (ax i + ay j).yj /y = ax i.j + ay j.j = ay
3
You can see that the orthonormal basis (i, j, k) is great - it makes the calculations extremely simple, as
the product of the basis vectors is either 1 (if it is multiplied by itself) or 0 (for two different basis
vectors).
Orthogonal vectors If the dot product of two non-zero vectors is zero:
a • b =0
 = arccos(0) = /2 = 90o.
the vectors are perpendicular to each other or in proper mathematical terms, they are orthogonal. In other
words, the projection of a on b is zero (and vice versa).
Note that the 3-D unit vectors are orthogonal. A set of orthogonal basis vectors is called an orthogonal
basis.
i•j=i•k=j•l=0
Furthermore, these vectors are normalized, i.e. their magnitudes are all equal to 1.
| i | = | j | = | k |=1
Normalized orthogonal vectors are called orthonormal. The i, j, k vectors therefore form an orthonormal
basis.
Linear independence A set of vectors a, b, c are linearly independent if any one of them cannot be written as a linear
combination of the others.
a  mb + nc, m,n constants
Otherwise they are linearly dependent.
Special cases:
1. Two vectors are linearly dependent if they are collinear (point in the same or exact opposite direction).
a= 1i +2j , b= 2i 4j
b = 2a
2. Three vectors are linearly dependent if they are in the same plane.
a= 1i +2j +0k, b= i 2j +0k , c= 8i 126j + 0k
they all are in xy plane, therefore must be linearly dependent. Indeed:
c = -52a +11b
A set of n linearly independent vectors defines n-dimensional space:
Two (linearly independent) vectors define a plane. In a plane a maximum of two vectors can be linearly
independent.
4
example:
x = i = [1, 0]
y = j = [0, 1]
Three (linearly independent) vectors define a 3-D space. In 3-D space a maximum of three vectors can be
linearly independent.
example:
x = i = [1, 0, 0]
y = j = [0, 1, 0]
z = k = [0, 0, 1]
As we have already mentioned, n linearly independent vectors form a basis of the n-dimensional space.
Any vector can be described as a linear combination of the basis vectors.
Coordinate systems
2­D: Plane polar coordinates: Cartesian coordinates is not the only type of basis. In 2-D another useful system is called the Polar
coordinates. This is similar to the Argand diagrams:
a = ax i + ay j = |a|cos() i + |a|sin() j
Therefore we can write the vector a in terms of r and  instead of x and y. From the above, the general
relationship is:
x= r cos()
r | a | x 2  y 2
y= r sin()
 = arcsin(y/r)=arcos(x/r) =arctan(y/x)=arccot(x/y)
5
3­D: Spherical polar coordinates: Spherical coordinates are very useful for solving problems with spherical symmetry. Here we need three
coordinates: the distance from the origin (radius - r) and two angles azimuthal  and polar .
R = x i + y j + z k = r sin() cos() i + r sin() sin() j + r cos() k
x= r sin( cos()
r  | R | x 2  y 2  z 2
y= r sin() sin()
z= r cos()
 = arctan(y/x)
 = arccos(z/r)
3­D: Cylindrical coordinates: Again, these are great for cylindrically symmetric problems. Here we have the distance from the z axis
(), polar angle () and the z coordinate:
R = x i + y j + z k =  cos() i +  sin() j + zk
x=  cos()
  x2  y2
y=  sin()
z= z
 = arcsin(y/) (x  0),  = arcsin(y/) +  (x  0)
z=z
6
Examples of physical quantities that are dot products (projections): work = F • s = ∫ F • ds, where F is the force in the direction of the displacement, s.
voltage = – ∫ E • ds = – ∫ (F/q) • ds, where E is the electric field and q is a charge.
Vector (“cross”) product (3­D only!): The so-called vector product is only for vectors in three dimensions:
a x b = |a| |b| sin() ên
Where ên is the unit vector "normal" (i.e. perpendicular) to both vectors (a and b).
Using this formula, we can make the following conclusions:
i x j = k and j x i = –k
j x k = i and k x j = –i
k x i = j and i x k = –j
ixi=jxj=kxk=0
Therefore, in terms of unit vectors, we can define the cross product as:
a x b = ax i x b + ay j x b + az k x b = ax i x (bx i + by j + bz k) + ...
= (axbx) i x i + (axby) i x j + (axbz) i x k + ....
= (axbx) • 0+ (axby) k + (axbz) (–j)+ ....
= (aybz – azby) i + (azbx – axbz) j + (axby – aybx ) k = –(b x a)
We can see that the vector product is antisymmetric:
axb=bxa
In other words, it is not commutative and depends on the order in which the vectors are multiplied!
Rule for calculating vector products:
ax ay
az ax
ay
bx by bz bx
by
a x b: write
[aybz – azby, azbx – axbz, axby – aybx ]
By analogy to the dot product:
 = sin–1
ax b
ax b
= arcsin
a b
a b
7
Scalar Triple Product (3­D only!): is a NUMBER (SCALAR) !
a • (b x c) = c • (a x b) = b • (c x a)
= ax (bycz – bzcy) + ay (bzcx – bxcz) + az (bxcy – bycx)
= cx (aybz – azby) + cy (azbx – axbz) + cz (axby – aybx)
= bx (cyaz – czay) + by (czax – cxaz) + bz (cxay – cyax)
Triple product gives a volume (or negative) of a parallelpiped with vectors a, b, c as edges.
Vector triple product (3­D only!) is A VECTOR !
a x (b x c) = b (a • c) – c (a • b)
Examples of physical quantities that are vector products: angular velocity,   v =  x r, where v is the linear velocity and r is the radius of
rotation.
angular momentum, L = r x p = r x (m v) = m {r x ( x r)}, where p is the linear
momentum, and m is the mass.
angular force (torque),  = r x F = dL/dt
8
Vectors as arrays of numbers The more general meaning of “vector” is 1-D array of numbers:
A = [A1, A 2, A 3,….. , A N]
even though it may not be associated with a direction in any kind of “space” etc. As we already know, we
can arrange these arrays in two possible ways: as a row or as a column.
row vector:
column vector:
a1 , a2 , ..., a N 
 a1 
a 
 2
 ... 
 
a N 
These vectors, either row of column ones, obey the same rules as the 2D and 3D vectors we talked about
above:
1. addition and subtraction
2. scalar multiplication
3. magnitude (norm)
4. scalar (dot) product
5. projections
6. linear (in)dependence
The only difference is that they may have more components.
Note however, that the vector product does not exist: that can be defined only for 3-D vectors (not even 2D).
We will see how the vector properties of arrays of numbers become useful in linear algebra later.
9
Vectors in MATLAB Since we are already familiar with arrays, we pretty much know most about vectors. You should be able
to construct row and column vectors, concatenate them, split them, pick individual components etc.
From algebraic operations, you should be able to add, subtract, calculate norms (magnitudes), scalar
products (using element-by-element multiplication) and using the rules above calculate the vector and
triple products.
To make your life easier, however, as always MATLAB has functions that can do a lot of things for you:
dot(a,b)
cross(a,b)
norm(a)
calculates scalar products of vectors a, b
calculates scalar products of vectors a, b. Remember: a,b, must be 3-element
vectors.
calculates norm (magnitude) of a vector a.
10