*©Fernando Caracena 30 September 2012*

The purpose of this section is to show the usefulness of various vector operations. We begin the discussion with the problem: given two vectors **A** and **B**, which are not parallel, find the orthogonal, unit vectors (**e _{1}**

**,e**), which define the three dimensional space that includes the plane defined by

_{2},e_{3}**A**and

**B**and its normal, beginning with the unit vector

**e**=

_{1}**A**/|A|. We have the freedom to choose the plane defined by

**A**and

**B**as the space defined by the orthonormal basis vectors

**and**

**e**_{1}**, that is**

**e**_{2}**A=e_{1} ***A

**(1a)**

_{x}B= **e_{1} ***B

_{x}+

**B**

*******e**_{2}_{y .}(1b)

The third unit vector ** e_{3}** is defined by the cross product of

**A**and

**B**(Fig. 1).

*Products of two vectors*

In this discussion we use the two types of products defined for any two vectors: the scalar product, which yields a number; and the vector, or cross, product, which yields a vector, which is orthogonal to the two vectors involved.

The rule for the scalar (or dot) product is as follows for any two vectors (**A** and **B**):

**A**•**B**=A** _{x} **B

_{x}+A

_{y}B

_{y}+A

_{z}B

_{z}. (2a)

also

**A**•**B**=|**A**|*|**B**| cos(θ), (2b)

where θ is the angle between the two vectors, and the magnitude of a vector is given by

|**A**| = √(**A**•**A**). (2c)

The cross (or vector product) is defined as follows:

**A×****B** =** e_{1}** (A

_{y }B

_{z}-A

_{y }B

_{z})+

**e**(A

_{2}_{z }B

_{x}-A

_{x }B

_{z})+

**(A**

**e**_{3}_{x }B

_{y}-A

_{y }B

_{x})

**(3a)**

**,**

;also, the magnitudes of the vector product and vectors are related as,

|**A×****B**|=|**A**|*|**B**| sin(θ). (3b)

Note that the basis vectors are orthogonal, unit vectors:

**e_{1}**•

**e**

**=1,**

_{1}**•**

**e**_{1}**e**

**=0 and**

_{2}**•**

**e**_{1}**e**

_{3}=0

**e_{2}**•

**e**

**=0,**

_{1}**•**

**e**_{2}**e**

**=1 and**

_{2}**•**

**e**_{2}**e**

_{3}=0

**e_{3}**•

**e**

**=0,**

_{1}**•**

**e**_{3}**e**

**=0 and**

_{2}**•**

**e**_{3}**e**

_{3}=1 ,

which follow the following rules for their cross products:

**e_{1}×e_{1}=** 0

**, e**_{1}**×**

**e**

**=**

_{2}**,**

**e**_{3}

**e**_{1}**×**

**e**

_{3}=-

**;**

**e**_{2 }**e_{2}×e_{1}=** -

**e**_{3}

**, e**_{2}**×**

**e**

**=**

_{2}**0 ,**

**e**_{2}**×**

**e**

_{3}=

**;**

**e**_{1 }**e _{3}**

**×**

**e**

_{1}=

**e**_{2}

**, e**_{3}**×**

**e**

**= -**

_{2}**,**

**e**_{1}

**e**_{3}**×**

**e**

_{3}=

**0 .**

Fig. 2 gives an example of the graphical solution to the above stated problem for the following two vectors, which are initially defined in terms of the orthogonal, unit vectors,**u _{1}, u**

_{2}**,**

**u**

**:**

_{3}**A = **1/3**u _{1}**

**+**

**u**

_{2}**+**5/3

**u**

_{3}and

**B **= **u**_{1}**- **1/3**u**_{2}** + ****u**** _{3 }**.

The old vector space in which A and B were initially defined (**u _{1}, u**

_{2}**,**

**u**

**) is decomposition into a new vector space into a new on defined by a set of new basis vectors,**

_{3}**e**

_{1}**,e**, which are drawn in the colors red, green and blue respectively, a unit circle is drawn in the

_{2},e_{3}**e**

_{1}**, e**plane in the color red. The python code for generating Fig. 2 is presented in Listing 1.

_{2 }Although the python script cuts through the calculations like a hot knife through butter, sometimes a long hand calculation is best for learning the meanings of the vector operations. For your convenience, the magnitude of A is computed below

**A**•**A**=1/9 + 1 + 25/9=35/9

|A|= √(35/9)

=1/3 *√35

**e_{1} **=

**A**/|A|

**e_{1} **=[1/3

**u**

_{1}**+**

**u**

_{2}**+**5/3

**u**

**]/(1/3 * √35)**

_{3}**e_{1} **=[

**u**+3 *

_{1}**u**

**+5**

_{2}**u**

**]/√35**

_{3}The vector** A** expressed in terms of the new basis is

**A=**1/3 *√35 * **e_{1}** .

Problem: Show that the cross product of **A** and **B** is the following:

**A** x **B** = (2/9) * [7**u _{1}**

**+**6

**u**

_{2}**-**5

**u**

**] .**

_{3}

*Vector Identities*

*Vector Identities*

Because of the antisymmetric structure of the cross product (3a), it follows that

**B x A = - A x B ** (4a)

and

**A** x **A** = 0. (4b)

It is left to the reader to prove the following identities from definitions of the scalar (2a) and cross product:

**A**** •****B x C**= A_{1}(B_{2}C_{3}-B_{3}C_{2})+A_{2}(B_{3}C_{1}-B_{1}C_{3})+A_{3}(B_{1}C_{2}-B_{2}C_{1}). (5a)

The above is known as the triple scalar product, the value of which is the same for all cyclic permutation of the vectors(ABC, CAB, BCA) and interchanges of the dot and cross operators:

**A** **x** **B •C** = **A**** •****B** x **C** ;** ** (6a)

**B • C x A= A •B x C** ;

**(6b)**

**C • A x B = A •B x C** ;

**(6b)**

and reverses sign for anti-cyclic permutations(ACB, BAC, CBA);

**B • A**

**x**

**.**

**C = -****A****•****B**x**C****(6c)**

The triple vector product evaluates as follows:

** A x B x C = (A•C) B - (A•B) C** . (7a)

Further not that the sum of the three cyclic permutations of (7a) are identically zero,

**A x B x C **+

**C**

**x****+**

**A**x**B****=0. (7b)**

**x A****B****x****C**Finally. we often have to evaluate the scalar product of two cross products**,**

**(A x B) •(C x D)=(A•C) (B•D) - (A•D)(B•C)**.

**(8)**

Using the above identities, you will be able to solve a lot of problems involving vectors.

*Closing message*

*Closing message*

Some of the modern scripting languages, such as python, allow you to do scalar products and cross products on vectors defined by you. You do not have to get into the details of those products. You have only to define the vectors in question. This means that you can operate in code rather than doing the math operations manually. Using such languages, you can do many vector operations per second in a three dimensional setting to create animations.

Current teaching techniques emphasize doing a lot of details by hand, hoping that you will learn by some kind of osmosis through rote learning. Here we have pursued a different tack: learn the abstractions and program them directly in a suitable language that is easy to run and ubiquitous to visualize the results. Doing the hand calculations is worthwhile, the first time, just to get the hang of the concepts; but thereafter, I say that you should use the computer as a powerful tool in doing mathematics and physics rather than killing yourself doing a lot of hand calculations.

Listing 1

#_________________________________________________________

ipython --pylab

from pylab import *

from mpl_toolkits.mplot3d import Axes3D

import numpy as np

import matplotlib.pyplot as plt

fig = plt.figure()

ax = fig.gca(projection='3d')

ax.set_xlim3d(-1, 1.5)

ax.set_ylim3d(-1, 1.5)

ax.set_zlim3d(-1, 1.5)

ax.set_xlabel('X axis')

ax.set_ylabel('Y axis')

ax.set_zlabel('Z axis')

x=2.

y=2.

z=2.

plot([-x, x],[-y,y],[-z,z],color='w')

a=array([1, 3, 5])/3.

b=array([ 3, -1, 3])/3.

c=cross(a,b)

x=a[0]

y=a[1]

z=a[2]

plot([0., x],[0.,y],[0.,z],color='r')

x=b[0]

y=b[1]

z=b[2]

plot([0., x],[0.,y],[0.,z],color='g')

x=c[0]

y=c[1]

z=c[2]

plot([0., x],[0.,y],[0.,z],color='b')

aa=sqrt(dot(a,a))

ba=sqrt(dot(b,b))

#_____________________________________________________

# Compute the angle between them

L=dot(a,b)/aa/ba #The cosine of hte angle between them.

# Find the angle theta by inverting the cosine:

theta=math.acos(L) #Solution is in radians.

print theta*180./math.pi # Print angle in degrees:

#______________________________________________________

#Define the first orthonormal vector

e1=a/aa

#______________________________________________________

#Define the third orthonormal vector

e3=cross(a,b) #/aa/ba/sin(math.acos(L))

e3=e3/sqrt(dot(e3,e3))

#______________________________________________________

#Find the second orthonormal vector from:

e2=cross(e3,e1)

# In the new coordinate system the vectors are redefined as ap and bp:

x=e1[0]

y=e1[1]

z=e1[2]

plot([0, x],[0,y],[0,0],color='k')

plot([x, x],[y,y],[0,z],color='k')

plot([0, x],[0,y],[0,z],color='r')

x=e2[0]

y=e2[1]

z=e2[2]

plot([0, x],[0,y],[0,0],color='k')

plot([x, x],[y,y],[0,z],color='k')

plot([0, x],[0,y],[0,z],color='g')

x=e3[0]

y=e3[1]

z=e3[2]

plot([0, x],[0,y],[0,0],color='k')

plot([x, x],[y,y],[0,z],color='k')

plot([0, x],[0,y],[0,z],color='b')

#Draw a circle through the ends of e1 and e2:

ang = arange (0.0 , 100.0 , 1.0) #100 points along the circumference

# are defined by an angular array.

ang=2*math.pi*ang/100. #, which is wrapped into the range 0 to 2*pi.

#Compute x, y, z coordinates along that circle:

x=e1[0]*cos(ang)+e2[0]*sin(ang)

y=e1[1]*cos(ang)+e2[1]*sin(ang)

z=e1[2]*cos(ang)+e2[2]*sin(ang)

plot(x,y,z,color='r') #Plot the circle as red.

#_____________________________________________________________