IntroVectors

Version 2.0
11/4/92
John B. Schneider

Introduction

Vectors have both a magnitude and a direction.  It is important that you understand two different types of vectors.  In this NoteBook we will discuss position vectors and distance (or displacement) vectors.  Position vectors indicate a position relative to the origin while distance vectors indicate a magnitude and direction from one point in space (generally not the origin) to another.
     
     We will discuss two-dimensional position and displacement vectors in the Cartesian and cylindrical (polar) coordinate systems.

Vectors in Cartesian Coordinates

Position vectors.

A position vector indicates the distance and direction from the origin to a point in space.  For example, the position of an airplane relative to a fixed coordinate system could be described with a position vector.  Of course, this position vector would be a function of time.  The magnitude of the vector would give the distance to the airplane and the direction from the origin would be given by the direction of the vector.
     
     The program below defines a function that will plot a vector from the origin to a user specified point.  The assumption is made that point of interest is within the region bounded by ±5 <= x <= 5 and ±5 <= y <= 5 (feel free to change these limits).  The position vector itself is red.  The function additionally shows the x and y unit vectors in blue.  The purpose of the unit vectors will become more clear later.

Off[General::Spell];
positionVector[x_,y_] :=
Block[{pVect,xUnit,yUnit,xMin=-5,xMax=5,yMin=-5,yMax=5},
  pVect = Line[{{0,0},{x,y}}];
  xUnit = Line[{{x,y},{x+1,y}}];
  yUnit = Line[{{x,y},{x,y+1}}];
  Show[Graphics[{axes[xMin,xMax,yMin,yMax],
        RGBColor[1,0,0],pVect,
        RGBColor[0,0,1],xUnit,yUnit}
        ],
     PlotRange->All,
     AspectRatio -> (yMax-yMin)/(xMax-xMin)
     ]
  ]

Try this function for a few combinations of end points and convince yourself that it really does draw a position vector from the origin to the point you specify.

positionVector[ 1, 3 ]

The following command will generate a sequence of graphics (that can be animated if you wish).  In this sequence the end point of the position vector will move in a circle with a radius of three.  The x position is 3 cos(phi) and the y position is 3 sin(phi), where phi goes from 0 to 350 degrees in 10 degree increments.

Table[
   positionVector[ 3 Cos[dum`i Pi/180], 3 Sin[dum`i Pi/180] ],
   {dum`i,0,350,10}
   ]

Note that no matter where the end point of the position vector is, the x and y unit vectors always point in fixed directions.  The x unit vector always points in the positive x direction and the y unit vector always points in the positive y direction.  As you will see, unit vectors do not point in constant directions in the cylindrical (or spherical) coordinate systems.

Distance vectors.

A distance or displacement vector specifies a magnitude and direction from a point in space other than the origin.  A displacement vector can be used to indicate the speed and direction of an airplace.  For example, when the plane is at the point (1,3) its speed is 2 units horizontally and 0.5 units vertically.  The displacement vector is therefore (2,0.5) and it is drawn with its base at the point (1,3).
     
     The following program defines a function that will draw a position vector to the base of the displacement vector and then draw the displacement vector from that point.  The position vector and unit vectors are drawn as before.  The displacement vector is drawn in black.

distanceVector[x_,y_,x1_,y1_] :=
Block[{dVect,pVect,xUnit,yUnit,xMin=-5,xMax=5,yMin=-5,yMax=5},
  dVect = Line[{{x,y},{x+x1,y+y1}}];
  pVect = Line[{{0,0},{x,y}}];
  xUnit = Line[{{x,y},{x+1,y}}];
  yUnit = Line[{{x,y},{x,y+1}}];
  Show[Graphics[{axes[xMin,xMax,yMin,yMax],dVect,
     RGBColor[1,0,0],pVect,
     RGBColor[0,0,1],xUnit,yUnit}],
     PlotRange -> All,
     AspectRatio -> (yMax-yMin)/(xMax-xMin)
     ]
  ]

The following command will display the position and displacement vectors.  The first two arguments give the x and y coordinates to the base of the displacement vector.  The next two arguments indicate the distance along the x unit vector and the distance along the y unit vector for the displacement vector itself.

distanceVector[(*position*) 1,3, (*displacement*) 2,0.5 ]

We can again generate a sequence similar to the one for the position vector.   The x and y components move in a circle, but the x and y displacement are held fixed at 2 and 0.5, respectively.

Table[
   distanceVector[ 3 Cos[dum`i Pi/180], 3 Sin[dum`i Pi/180], 2, 0.5 ],
   {dum`i,0,350,10}
   ]

Notice that the orientation of the displacement vector does not change.  It is always two units to the ™right∫ and 0.5 units ™up.∫

Vectors in Polar Coordinates.

Position Vectors

In two-dimensional polar coordinates, a position vector is described by a radius from the origin and an angle from the positive x axis.  The following program defines a function to draw a position vector where the radius (r) and the angle (p) are specified by the user.  Again, the function is defined to draw the axes over the region ±5 <= x <= 5 and ±5 <= y <= 5.  This function draws the position vector in red and the r and p unit vectors in green.

positionVectorRP[r_,p_] :=
Block[{pVect,x,y,rUnit,pUnit,cosp,sinp,
       xMin=-5,xMax=5,yMin=-5,yMax=5},
  (* Cos[p] and Sin[p] are used more than once so
     calculate them once here and use again later. *)
  cosp = Cos[p];
  sinp = Sin[p];
  x = r cosp;
  y = r sinp;
  dVect = Line[{{0,0},{x,y}}];
  pVect = Line[{{0,0},{x,y}}];
  rUnit = Line[{{x,y},{x+cosp,y+sinp}}];
  pUnit = Line[{{x,y},{x-sinp,y+cosp}}];
  Show[Graphics[{axes[xMin,xMax,yMin,yMax],
     RGBColor[1,0,0],pVect,
     RGBColor[0,1,0],rUnit,pUnit}],
     PlotRange -> All,
     AspectRatio -> (yMax-yMin)/(xMax-xMin)
     ]
  ]

Here is the function set up and ready to use but feel free to change the arguments.  Note that the angular dimension is specified in radians.  (To use degrees, make sure you multiply the value in degrees by Pi/180 to get radians.  In the command below, the p value is initially 30 degrees.)

positionVectorRP[ 3, 30 Pi/180 ]

Note the behavior of the unit vectors.  The r unit vector always points in the direction  the position vector would move if r were increased and p was unchanged.  However, the direction of r depends on p.   Therefore, the r unit vector does not point in a fixed direction the way the x and y unit vectors did in the Cartesian coordinate system.  The p unit vector always points in the direction the position vector would move if p were increased and r was unchanged.  Of course, the length of both unit vectors is one.
     
     The command below generates a sequence of graphics where the radius is held at three and p ranges from 0 to 350 in 10 degree increments.  These are the same positions that were used in the Cartesian coordinate sequences.  Position vectors describe a physical ™truth∫ that is independent of the coordinate system you are using.  The airplane is at the same point in space whether you are using Cartesian coordinates or polar coordinates.  All that changes is how you describe that point.

Table[positionVectorRP[3, dum`i Pi/180],
   {dum`i,0,350,10}
   ]

Note the movement of the unit vectors as the position moves.

Displacement Vectors

The following program defines a function to draw a displacement vector where the base of the vector is specified as a radius from the origin and an angle from the x axis.  The displacement vector itself is specified by a distance along the r unit vector and a distance along the p unit vector.  The displacement vector is drawn in black.

distanceVectorRP[r_,p_,r1_,phiDistance_] :=
Block[{dVect,pVect,x,y,rUnit,pUnit,cosp,sinp,
       xMin=-5,xMax=5,yMin=-5,yMax=5},
  (* Cos[p] and Sin[p] are used more than once so
     calculate them once here and use again later. *)
  cosp = Cos[p];
  sinp = Sin[p];
  x = r cosp;
  y = r sinp;
  dVect = 
     Line[{{x,y},
     {x+r1 cosp-phiDistance sinp,
      y+r1 sinp+phiDistance cosp}}];
  pVect = Line[{{0,0},{x,y}}];
  rUnit = Line[{{x,y},{x+cosp,y+sinp}}];
  pUnit = Line[{{x,y},{x-sinp,y+cosp}}];
  Show[Graphics[{axes[xMin,xMax,yMin,yMax],dVect,
     RGBColor[1,0,0],pVect,
     RGBColor[0,1,0],rUnit,pUnit}],
     PlotRange -> All,
     AspectRatio -> (yMax-yMin)/(xMax-xMin)
     ]
  ]

The displacement vector is specified by two distances, a distance along the r unit vector and a distance along the p unit vector.  This is not another radius and angle.  It is similar to the displacement vectors in the Cartesian coordiante system in that we are specifying two distances.  However, in the polar coordinate system the unit vectors are not constant.
     
     The following command will draw a position vector, the unit vectors associated with that position, and the displacement vector.  Please change the arguments to whatever you want.  Initially, the arguments are for a position vector that is 3 units long and forms a 30 degree angle with the positive x axis.  The displacement vector is 2 units along the r unit vector (or 2 units in the r direction) and 0.5 units along the p unit vector.

distanceVectorRP[3,30 Pi/180,2,0.5]

The command below will again create a sequence of graphics where the end point of the position vector moves in a circle.  In this command, the displacement vector is always 2 units in the r direction and 0.5 units in the p direction.  Note how the displacement vectors changes with different position vectors.

Table[distanceVectorRP[3, dum`i Pi/180,2,0.5],
   {dum`i,0,350,10}
   ]

Conclusions

This NoteBook illustrated the difference between position vectors and displacement vectors in two different coordinate systems.  It was shown that unit vectors point in a constant direction in the Cartesian coordinate system but that their orientation is position dependent in the cylindrical coordinate system.  Position vectors are described by two distances in the Cartesian coordinate system and by a distance and an angle in the cylindrical coordinate system.  However, displacement vectors are specified by two distances in both coordinate systems.
     
     Although the illstrations were restricted to two dimensions, the same concepts hold in three dimensions.  For example, in spherical coordinates a position vector would be described by a distance and two angles.  However, a displacement vector would consist of three distances – the distance in the r direction, the distance in the theta direction, and the distance in the phi direction.

Initialization Cells

The following command is used in the drawing of the axes.

axes[x0_,x1_,y0_,y1_] := 
Block[{tick,x,y},
   tick = .02 Min[{x1-x0,y1-y0}];
   {(* x axis *) Line[{{0,y0},{0,y1}}],
   (* y axis *) Line[{{x0,0},{x1,0}}],
   (* x axis tick marks *) Table[Line[{{x,-tick},{x,tick}}],{x,x0,x1}],
   (* y axis tick marks *) Table[Line[{{-tick,y},{tick,y}}],{y,y0,y1}]}
   ]