The Vector Cross Product  V x W 
(or Cross[V,W])

by
K. D.  Stroyan
University of Iowa

copyright 1997 by Academic Press, Inc. - All rights reserved.

Special Mathematica Functions used in this NoteBook

We told you not to look.  This horrible stuff sets various defaults and defines some functions needed to draw the geometric side of the lexicon.  Ignore the details here and go on to the lesson.

Off[General::spell];
Off[General::spell1];
Off[ParametricPlot3D::ppcom]
Needs["Graphics`Colors`"]

SetOptions[Graphics,Axes->False,AxesOrigin->{0,0},AspectRatio->Automatic];
SetOptions[Graphics3D,ViewPoint->{5,2,1},Boxed->False,AspectRatio->Automatic];
SetOptions[ParametricPlot3D,ViewPoint->{5,2,1},AspectRatio->Automatic];
SetOptions[Plot3D,ViewPoint->{5,2,1},AspectRatio->Automatic];
SetOptions[ParametricPlot,AspectRatio->Automatic];
SetOptions[Plot,AspectRatio->Automatic];

colorQ[a_]:=(Head[a]===RGBColor);
grayQ[a_]:=(Head[a]===GrayLevel);
thickQ[a_]:=(Head[a]===Thickness);
absthickQ[a_]:=(Head[a]===AbsoluteThickness);
notruleQ[u_] := !(Head[u]===Rule);
ruleQ[u_] := (Head[u]===Rule);

Norm::usage = "Norm[expr] returns the Euclidean length of the
		vector, 'expr'.";

Norm[a_?VectorQ] := Sqrt[a.a];

Angle[a_?VectorQ,b_?VectorQ] := ArcCos[(a.b)/(Norm[a] Norm[b])]

Proj[a_?VectorQ,b_?VectorQ] := ((a.b)/(b.b))b

tol = .5*10^-6;

OrthUp[a_?VectorQ] :=
	Module[{b,c,d,f},
		d = N[a/Norm[a]];
		If[Chop[d[[3]]^2 - 1,tol] == 0, b={1,0,0} ,
		b = {0,0,1} - d[[3]] d; b = b/Norm[b];];
	Return[b]];
	
OrthSet[a_?VectorQ] :=
	Module[{b,c,d},
		d = N[a/Norm[a]];
		If[Chop[d[[1]],tol]==0,b={1,0,0},
			 If[Chop[d[[2]],tol]==0,b={0,1,0},
			  b={-d[[2]],d[[1]],0}]];
			b=b/Norm[b];c = Cross[d,b];
	Return[{b,c/Norm[c],d}]];

				
Rotate[a_?VectorQ,theta_] :=
	Module[{u,v,r},
		u = OrthSet[a];
		v = Transpose[u];
		r = N[{{Cos[theta],-Sin[theta],0},{Sin[theta],Cos[theta],0},{0,0,1}}];
	Return[v.r.u]];

Vector2D[tail_,tip_,opts___]:=
	Module[{ntail,ntip,sopts,Punit,up,arrow},
	ntail = N[tail];
	ntip = N[tip];
	
	sopts = Join[Select[{opts},colorQ],Select[{opts},
				thickQ],Select[{opts},absthickQ],Select[{opts},grayQ]];

If[Chop[ntail.ntail+ntip.ntip,tol] == 0,
			(*too small to plot or not number*)
			Return[Graphics[Point[{0,0}]]];
	,						
If[Chop[(ntip-ntail).(ntip-ntail),tol] == 0,
		Return[Graphics[{Join[sopts,{Line[{ntail,ntip}]}]}]];
	,
	Punit = (.075 Norm[ntip-ntail]/Norm[ntip-ntail]) (ntip-ntail) ;
	up = 0.15 {-Punit[[2]],Punit[[1]]};
	arrow = Line[{ntail,ntip,ntip-Punit+up,ntip,ntip-Punit-up}];
	]];
Return[Graphics[{Join[{AbsoluteThickness[2]},Join[sopts,{arrow}]]}]];
];

Vector3D[tail_,tip_,opts___]:=
	Module[{ntail,ntip,sopts,Punit,up,u2,u3,u4,rotmat,arrow},
	ntail = N[tail];
	ntip = N[tip];
	
	sopts = Join[Select[{opts},colorQ],Select[{opts},
				thickQ],Select[{opts},absthickQ],Select[{opts},grayQ]];

If[Chop[ntail.ntail+ntip.ntip,tol] == 0,
			(*too small to plot or not number*)
			Return[Graphics3D[Point[{0,0,0}]]];					
	,		
If[Chop[(ntip-ntail).(ntip-ntail),tol] == 0,
		Return[Graphics3D[{Join[sopts,{Line[{ntail,ntip}]}]}]];
	,
	Punit = (ntip-ntail);
	rotmat = Rotate[Punit,N[Pi/2]];
	up = OrthUp[Punit];
	Punit = .075 Punit;
	up = .15 Norm[Punit] up;
	u2 = rotmat.up;
	u3 = rotmat.u2;
	u4 = rotmat.u3;
	arrow = Line[{ntail,ntip,
				ntip - Punit + up,ntip,
				ntip - Punit + u2,ntip,
				ntip - Punit + u3,ntip,
				ntip - Punit + u4}];
	]];
Return[Graphics3D[{Join[{AbsoluteThickness[2]},Join[sopts,{arrow}]]}]];
];

aRCtAN[y_,x_] := Module[{v},
	If[ Chop[N[x],tol] == 0 ,If[ N[y] < 0, v = -N[Pi/2], v = N[Pi/2]],
		v = N[ArcTan[y/x]];
		If[ x < 0 && y < 0, v = N[Pi -  v],v]];
	Return[v]];

Arc2D[X_,Y_,opts___] := Graphics[{opts,
		Disk[{0,0},1,{Min[
							aRCtAN[
						N[X[[2]]],N[X[[1]]]
								]
							,
							aRCtAN[
							N[Y[[2]]],N[Y[[1]]]
								]
						]
						,
					Max[
							aRCtAN[
						N[X[[2]]],N[X[[1]]]
								]
							,
							aRCtAN[
							N[Y[[2]]],N[Y[[1]]]
								]
						]}
				]}
				];
Arc3D[X_,Y_] := 
	Module[{t,U,V},
		U[V_]:= N[(1/Sqrt[V.V]) V];
		Return[Graphics3D[
		Polygon[Append[Table[U[t X + (1-t) Y],{t,0,1,0.1}],{0,0,0}]]
				]
		]
	];

(*Zero Arrow causes trouble. Put in Vector?*)

Vector[tail_,tip_,opts___]:=
	If[Length[N[tail]]==2,Return[Vector2D[tail,tip,opts]],
		Return[Vector3D[tail,tip,opts]]];
		
Arrow[vec_,opts___]:= 
	Module[{a,b},
				If[Length[N[vec]]==2,
				a=ToExpression["Tail"]/.Select[{opts},ruleQ]/.
					{ToExpression["Tail"]->{0,0}};
				Return[Vector2D[a,a+vec,opts]],
				a=ToExpression["Tail"]/.Select[{opts},ruleQ]/.
					{ToExpression["Tail"]->{0,0,0}};
				Return[Vector3D[a,a+vec,opts]]]
				];

Frame2D[delta_] := 
      Graphics[{
            {Green,Line[{{-delta/4,0},{delta,0}}]},
                    Text["x",{1.01 delta,0}],
            {Green,Line[{{0,-delta/4},{0,delta}}]},
                    Text["y",{0, 1.01 delta}]}];

Frame3D[delta_] := 
      Graphics3D[{
            {Green,Line[{{-delta/4,0,0},{delta,0,0}}]},
                    Text["x",{1.01 delta,0,0}],
            {Green,Line[{{0,-delta/4,0},{0,delta,0}}]},
                    Text["y",{0, 1.01 delta,0}],
            {Green,Line[{{0,0,-delta/4},{0,0,delta}}]},
                    Text["z",{0,0,1.01 delta}]}];

View2D[stuff_] := Show[stuff,Frame2D[1]];
View3D[stuff_] := Show[stuff,Frame3D[1]];

Notebook Overview

When  X  and  Y  are nonzero vectors, the cross product,  Z = X×Y = Cross[X,Y], has the following important properties:

(1)  Z is perpendicular to both  X  and  Y.

(2)  The norm of  Z  is equal to the area of the parallelogram with the arrows  X  and  Y as edges.

(3)  The frame (X, Y, Z) is right-handed (assuming the x-y-z-axes are right-handed.)

The cross product is computed with a symbolic determinant.

References to the Text

This NoteBook goes with Section 15.7 of the text.

Cross Product

2-D

Cross Product is strictly a 3D notion.  There is no corresponding 2D vector idea (the 2D analog is scalar valued.)  Notice that property (1) in the NoteBook Overview is not possible in 2D.

3-D

The cross product of two vectors in 3 dimensions is defined by the following formula for W.  It is built in as  ×  (or  Cross[ , ] in Mathematica Input form).

<Enter> it now and compare the index-defined formula with the built-in function.

W = {
        X[[2]] 
            Y[[3]] - 
          X[[3]] 
            Y[[2]], 
        X[[3]] 
            Y[[1]] - 
          X[[1]] 
            Y[[3]], 
        X[[1]] 
            Y[[2]] - 
          X[[2]] 
            Y[[1]]}; Clear[X, Y, a, b, c, x, y, z]; X = {a, b, c}; Y = {x, y, z}; Z = X\[Cross]YW

Notice that  Z, even when computed completely symbolically,  is perpendicular to both  X  and  Y  because the dot products  Z.X  and  Z.Y  are both  zero.

Z . XSimplify[Z . X]Z . YSimplify[Z . Y]

An alternate computation

The symbolic determinant form of the cross product can be compted with Mathematica as follows:

Clear[i, j, k, X, Y, a, b, c, x, y, z]; X = {a, b, c}; Y = {x, y, z}; W = Det[{{i, j, k}, X, Y}]i = {1, 0, 0}; j = {0, 1, 0}; k = {0, 0, 1}; W

The Fundamental Properties of the Cross Product

When  X  and  Y  are nonzero vectors, the cross product,  Z = X×Y, has the following important properties:

(1)  Z is perpendicular to both  X  and  Y.

(2)  The norm of  Z  is equal to the area of the parallelogram with the arrows  X  and  Y as edges.

(3)  The frame (X, Y, Z) is right-handed (assuming the x-y-z-axes are right-handed.)

Notice that property (1) is proved in the general symbolic computation above:  Z.X  and Z.Y  are both zero in general.

If  X  and  Y are parallel (this happens if and only if X is a scalar multiple of Y), then the "parallelogram" with X and Y as edges is degenerate, only a line segment.  It can be viewed as a zero area parallelogram and in any case, when  X  and  Y  are parallel,  Z = X×Y = Cross[X,Y] = 0.

X =  .5 {2, 3, 1}; Y =  .3 {-4, -2, 1}; Z = X\[Cross]Y; View3D[{Graphics3D[Polygon[{{0, 0, 0}, X, X + Y, Y}]], Arrow[X, Red], 
        Arrow[Y, Red], Arrow[Z, Red]}]; Print[X, " x ", Y, " = ", Z, " |Z| = ", Norm[Z]]; Print["|X|*|Y|*Sin[Angle[X,Y] = ", Norm[X], " * ", Norm[Y], 
      " * ", Sin[Angle[X, Y]], " = ", 
      Norm[X] Norm[Y] N[Sin[Angle[X, Y]]]];

Practice Exercise

Copy and modify the computation above to show the three properties of the cross product for the vectors

X =  { 1/3,  2/3, 2/3}  and  Y = {-2/3, -1/3, 2/3}.

Exercises

Exercise 15.1

For each of the pairs of vectors  X  and  Y  below, find a vector  Z such that

1)  Z is perpendicular to  X
2)  Z is perpendicular to  Y
3)  The frame  (X,Y,Z) is right-hand oriented.

and skecth all three vectors.

a

X = {1,3,1}  & Y = {-2,-3,1}

b

X = {1,3,1}  & Y = {-2,-3,1}

c

X = {2,2,1}/3  & Y = {-2,1,2}/3

d

X = {2,3,6}/7  & Y = {-6,-2,3}/7

e

X = {2,6,9}/11  & Y = {9,-6,2}/11

f

X = {2,2,1}/3  & Y = {1,-2,2}/3

g

X = {-2,1,2}/3  & Y = {1,-2,2}/3

Problem 15.1: The Formula |Z| = |X| * |Y| * Sin[ Angle[X,Y] ]

Use property (2) of the cross product and the figure below to show that 

|Z| = |X| * |Y| * Sin[ Angle[X,Y] ]

(Hint:  The area of a parallelogram is the height  h  times the base.  What is the length of the base?  Given the hypotenuse  |Y|  of the right triangle with the angle marked, what is the value of  h?)

Verify your formula on the vector pairs from the previous exercise.