Lecture 1 

Vectors 

Geometric Representation of Vectors 

 

 In physics a vector is a quantity that has both magnitude and direction.  Another way of  

thinking of  this in two space is a quantity that has length and makes an angle with respect to a fixed line.   

The fixed line is taken to be the positive x - axis.  Consider a vector of magnitude 2 that makes an angle of 45  

degrees with respect to the positive x-axis.    We will represent the vector by a line segment .  In order to find the points recall that we can use the trig functions sine and cosine to find a point such that the line from the origin to the point  will be of length two.  We are going to use Maple 11 to find the point and then plot the vector and a line segment  starting at the  origin and ending at the desired point.  To use maple we will need to call up a package called plots.  It is always good to call up the package as soon as we think that it is needed.  The packages that we will use most often are  with(linalg), with(LinearAlgebra), and with(plots).  I would place the with(linalg) and with(LinearAlgebra) commands at the top of every work sheet.  The with(linalg) is an oder package but still has many useful commands for a class in matrix theory.  The newer package is the with(LinearAlgebra) package.  If you place both commands at the top of the worksheet I have found that you can use both commands to work the problmes.   Every command line should be given a name .  This stores either the data or the symboles in a location so they can be used later.   Every command line in Maple must end with either a semicolan or a colan.  The colan will not show the results of an operation.  I use them at the end of each with package.  You do not want to see all the options in the package.  This just takes up memory space.  Please use the colan at the end of every with(command).  For homework you need to see the results of the Maple commands so use the semicolan command.  Your text has the type of commands that are used in the with(linalg) package.  The manual has not been updated with the new commands.   The lectures will have the new commands.  To best use the lectures you should read the lecture before ever starting a your homework.  Opening the lecture and trying to just copy the commands I use means you do not get the commands down in a timely fashion.  You need to try to look at the commands in the lecture only when necessary.  As the term goes on you will not need to look back at the lecture that much as you do your homework.  Be sure to look at the instructions for how to name each homework assignment.   

> with(linalg):
 

> with(LinearAlgebra):
 

 

> with(plots):
 

> x:=2*cos(Pi/4);
 

`*`(`^`(2, `/`(1, 2))) (1)
 

> y:=2*sin(Pi/4);
 

`*`(`^`(2, `/`(1, 2))) (2)
 

> arrow(<x,y>,shape=arrow,width=0.01,head_length=0.06,color=red);
 

Plot_2d
 

We are interested in free vectors in this class .  That is vectors that are free to move in space.  The following are all representations of the same vector but they start at different points in space.  Also take a close look at the different commands for creating the vectors .  The first vector will be in standard position i.e. will start at the origin.  The remaining vectors will have different starting values.  The first values given in the calling sequence is the starting point for the vector and the second term will tell you the size of the vector.  The starting point for a vector not in standard position is given first.  i.e. vector v1 starts at the point (1,1) .  To place all four vectors on the same graph we will need the display command.    Also, notice that I gave each vector a different color.    

 

> v:=arrow(<2,1>,shape=arrow,width=0.01,head_length=0.06,color=red):
 

> v1:=arrow(<1,1>,<2,1>,shape=arrow,width=0.01,head_length=0.06,color=black):
 

> v2:=arrow(<-1,1>,<2,1>,shape=arrow,width=0.01,head_length=0.06,color=blue):
 

> v3:=arrow(<-1,-1>,<2,1>,shape=arrow,width=0.01,head_length=0.06, color=green):
 

> v4:=arrow(<1,-1>,<2,1>,shape=arrow,width=0.01,head_length=0.06,color=yellow):
 

> display(v,v1,v2,v3,v4,scaling=CONSTRAINED);
 

Plot_2d
 

 

The colon was used when we were creating the arrows and giving them a label.  This is another place were the colan command must be used.  There was no display to the screen which is what we wanted.  Even if we had wanted to display the arrow to the screen this would not have been possible because we gave the arrow command a Name. The display did not have a colon but a semi-colon at the end of the command which allowed the graph to displayed to the screen as we wanted..  If you do not end a command line in the Maple mode  with a semicolon or a colon you will receive an error message telling you that there is a missing colon or semicolon. Again, the display command has a semicolon which allows the display of all four vectors on one graph.  

 

 

Addition and Scalar Multiplication 

 

We are now ready to define the addition of two vectors in Typesetting:-mrow(Typesetting:-msup(Typesetting:-mi( and Typesetting:-mrow(Typesetting:-msup(Typesetting:-mi(  Vectors will be represented by order pairs or ordered triples of numbers or symbols enclosed by square brackets.    Your text represents vectors as columns of  numbers or symbols   .  The reason for changing in the lecture is the fact that we are going to be using Maple for our homework and Maple represents vectors  in row notation.  .  Vectors will be represented by bold face Latin letters and the elements by normal size Latin letters.      x= [a,b] or in three space x =[a,b,c] . 

x =[x1,x2,x3]  y=[y1,y2,y3] then the sum x+y =[x1+y1,x2+y2,x3+y3].  The following will show how you can handle vector addition using Maple.  You will need first  to make sure you are in the linear algebra package.   The <a,b,c> will give you a column vector.  While the command <a|b|c|> will give you a row vector.  These commands come from the with(LinearAlgebra): 

Typesetting:-mrow(Typesetting:-mo( 

>
 

 

> x:=<x1,x2,x3>;
 

`:=`(x, Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mtable(Typesetting:-mtr(Typesetting:-mtd(Typesetting:-mi( (2.1)
 

> y:=<y1,y2,y3>;
 

`:=`(y, Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mtable(Typesetting:-mtr(Typesetting:-mtd(Typesetting:-mi( (2.2)
 

> v:=x+y;
 

`:=`(v, Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mtable(Typesetting:-mtr(Typesetting:-mtd(Typesetting:-mrow(Typesetting:-mi( (2.3)
 

> xa:=<1,-2,1>;
 

`:=`(xa, Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mtable(Typesetting:-mtr(Typesetting:-mtd(Typesetting:-mn( (2.4)
 

> ya:=<-3,4,-5>;
 

`:=`(ya, Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mtable(Typesetting:-mtr(Typesetting:-mtd(Typesetting:-mrow(Typesetting:-mo( (2.5)
 

> z:=xa+ya;
 

`:=`(z, Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mtable(Typesetting:-mtr(Typesetting:-mtd(Typesetting:-mrow(Typesetting:-mo( (2.6)
 

 Before, defining scalar multiplication we will look at an example of adding three vectors in two space. 

 

> w:=<2,-3>;
 

`:=`(w, Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mtable(Typesetting:-mtr(Typesetting:-mtd(Typesetting:-mn( (2.7)
 

> m:=<-2,5>;
 

`:=`(m, Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mtable(Typesetting:-mtr(Typesetting:-mtd(Typesetting:-mrow(Typesetting:-mo( (2.8)
 

> p:=<-4,-2>;
 

`:=`(p, Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mtable(Typesetting:-mtr(Typesetting:-mtd(Typesetting:-mrow(Typesetting:-mo( (2.9)
 

> s:=w+m+p;
 

`:=`(s, Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mtable(Typesetting:-mtr(Typesetting:-mtd(Typesetting:-mrow(Typesetting:-mo( (2.10)
 

In two and three space the addition of two or more vectors can be viewed in a geometric way.  We will only look at the geometric way of addition of vectors in two space and even then will look at only the addition  of two vectors.  The represent of the addition of two vectors geometrically is where the idea of working with free vectors will come into play.    Given two vectors      a and b represented in standard  position we will move vector b to the tip of  vector a then we will draw a vector form the origin to the head of b.   

 

> a:=arrow(<2,1>,shape=arrow,width=0.01,head_length=0.06,color=red):
 

> b:=arrow(<2,1>,<1,-3>,shape=arrow,width=0.01,head_length=0.06,color=black):
 

> c:=arrow(<3,-2>,shape=arrow,width=0.01,head_length=0.06,color=green):
 

> display(a,b,c);
 

Plot_2d
 

>
 

> a:=<2,1>;
 

`:=`(a, Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mtable(Typesetting:-mtr(Typesetting:-mtd(Typesetting:-mn( (2.11)
 

> b:=<1,-3>;
 

`:=`(b, Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mtable(Typesetting:-mtr(Typesetting:-mtd(Typesetting:-mn( (2.12)
 

> c:=a+b;
 

`:=`(c, Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mtable(Typesetting:-mtr(Typesetting:-mtd(Typesetting:-mn( (2.13)
 

The geometric representation  and the algebraic representation for the sum results in the same vector.  The order is not important.   You could have started with vector b in standard position and moved the vector a to the end of vector b and then drawn a vector from the the origion to the end of the combination of the two vectors.   

Scalar Multiplication 

We are now ready to define another operation  on vectors in n space.  In particular, our examples will be in two and three space.  A scalar will be a real or complex number in this class.  For the present will be concerned with only real numbers.   

 

Given the vector a = [b,c] we want to form a new vector which results from multiplying a scalar e times the vector  a.  ea = [eb,ec] i.e. scalar multiplication is a new vector formed from the old vector by multiplying each element of the original vector by the scalar.  For example 2[3,-2]=[6,-4].        In Maple , we will use column vectors as in your text to represent the vectors.  It is easier for me to use the row vectors to write the text.   

 

> a:=<2,1,-1>;
 

`:=`(a, Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mtable(Typesetting:-mtr(Typesetting:-mtd(Typesetting:-mn( (2.1.1)
 

> 3*a;
 

Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mtable(Typesetting:-mtr(Typesetting:-mtd(Typesetting:-mn( (2.1.2)
 

We can combine addition and scalar to produce a new vector which is call a linear combination. 

3[1,2]+4[-3,4] = [3,6]+[-12,16]=[-9,22]  or in Maple 

 

> 3*<1,2>+4*<-3,4>;
 

Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mtable(Typesetting:-mtr(Typesetting:-mtd(Typesetting:-mrow(Typesetting:-mo( (2.1.3)
 

 

 

Also, notice that multiplication by a scalar greater than one will give a new vector in the same direction but of longer length.   Multiplication by a positive scalar less than one  will result in a vector in the same direction but of length less than the original vector.    Multiplication by a negative scalar will result in a vector that has been been reflected through the origin.  .  A few examples using Maple will follow. 

 

> arrow(<2,3>,shape=arrow,width=0.01,head_length=0.06,color=red);
 

Plot_2d
 

> arrow(3*<2,3>,shape=arrow,width=0.01,head_length=0.06,color=red);
 

Plot_2d
 

> arrow(-1*<2,3>,shape=arrow,width=0.01,head_length=0.06,color=red);
 

Plot_2d
 

Length of Vectors (Norm of a Vector) 

The standard length of a vector in n space is found by finding the length of the hypotenuse of a right triangle formed by the vector and the horizontal and vertical axis.  This length is then found by using the Pythagorean  Theorem.  The norm is also call the Euclidean norm or the 2 norm.    The notation for the norm or length of a vector  a = [a1,a2]  is ||a|| =Typesetting:-mrow(Typesetting:-msqrt(Typesetting:-mrow(Typesetting:-mo(Note:  the square root is over the entire expression .  The processor  is having a problem.   

 

v = [3,1]  then  ||v||Typesetting:-mrow(Typesetting:-mo( 

 

 

>
 

> v:=<3,1>;
 

`:=`(v, Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mtable(Typesetting:-mtr(Typesetting:-mtd(Typesetting:-mn( (3.1)
 

> Norm(v,Euclidean);
 

`*`(`^`(10, `/`(1, 2))) (3.2)
 

> w:=<2,-1,4>;
 

`:=`(w, Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mtable(Typesetting:-mtr(Typesetting:-mtd(Typesetting:-mn( (3.3)
 

> Norm(w,2);
 

`*`(`^`(21, `/`(1, 2))) (3.4)
 

Notice I used the work Euclidean for the first Norm command and the number 2 for the second.  They are exactly the same command.  Use which ever you want.  

One use of the Norm is to determine a vector of unit length in the direction of a given vector.or to find a vector of given magnitude in the direction of a given vector.  We will now look at several examples of this use of  Norm 

 

Example  1.  Find a vector of unit length in the direction of the vector  [3,-2]. 

 

 

> b:=<3,2>;
 

`:=`(b, Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mtable(Typesetting:-mtr(Typesetting:-mtd(Typesetting:-mn( (3.5)
 

> u:=b/Norm(b,2);
 

`:=`(u, Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mtable(Typesetting:-mtr(Typesetting:-mtd(Typesetting:-mrow(Typesetting:-mfrac(Typesetting:-mn( (3.6)
 

> Norm(u,2);
 

1 (3.7)
 

The final step was a check to make  sure that we obtained a vector of length one. 

 

Example  2.  Find a vector of length 6 in the direction of the vector  [3,-2] 

 

 

> r:=6*u;
 

`:=`(r, Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mtable(Typesetting:-mtr(Typesetting:-mtd(Typesetting:-mrow(Typesetting:-mfrac(Typesetting:-mn( (3.8)
 

> Norm(r,2);
 

6 (3.9)
 

The results of example used the results of Example  1 to first find a unit vector in the same direction as [3,2] and then to multiply the results by the scalar 6  The final step was to check to make sure no mistakes were made. 

 

Example  3  Find a vector of length 4 in the opposite direction to [3,2].         Again we will need to find a unit vector in the direction of [3,2] and then multiply by -4 to obtain the desired vector. 

 

 

> s:=-4*u;
 

`:=`(s, Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mtable(Typesetting:-mtr(Typesetting:-mtd(Typesetting:-mrow(Typesetting:-mo( (3.10)
 

> Norm(s,2);
 

4 (3.11)
 

We have been looking at the 2 norm or Euclidean norm.  The word norm is reserved for any operation that satisfies the following set of  rules for vectors 

 

a. ||a|| >0 if a is not the zero vector and is zero if  a is the zero vector. 

 

b.  ||ba|| = |b| ||a||  where b is any real or complex number 

 

c.  || a +c|| Typesetting:-mrow(Typesetting:-mo(||a|| + ||b|| 

 

You text list some of the other common norms used in advanced linear algebra courses. 

 

The symbol u is reserved for  a unit vector  .  Again always remember that a unit vector in the direction of a given  vector   a  is given by  u = a/||a||. 

 

  

Inner Product and Angle between Vectors. 

 

The inner product  or dot product of two vectors produces a scalar number.  The inner product (dot product) for two vectors in two space will now be illustrated.  See your text for the formula for three and more space.  We will also look a some  examples using Maple of the inner product of vectors in two and three space. 

 

Example 4.  a = [Typesetting:-mrow(Typesetting:-msub(Typesetting:-mi(the inner product   < a,b> = Typesetting:-mrow(Typesetting:-msub(Typesetting:-mrow(Typesetting:-msub(Typesetting:-mi(  or for the vectors  where a = [3,-2] and b = [4,1]  we have  <a,b> = 3*4 + (-2)*1 = 12 -2 = 10  We will be using the command from the with(LinearAlgebra): package with is DotProduct.   

 

 

> a:=<3,-2>;
 

`:=`(a, Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mtable(Typesetting:-mtr(Typesetting:-mtd(Typesetting:-mn( (3)
 

> b:=<4,1>;
 

`:=`(b, Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mtable(Typesetting:-mtr(Typesetting:-mtd(Typesetting:-mn( (4)
 

> DotProduct(a,b);
 

10 (5)
 

The inner product defined above can also be expressed then the following way 

 

<a,b> = ||a|| ||b|| cos (Typesetting:-mrow(Typesetting:-mi() where  Theta is the angle between the vectors. .   In order to prove that the two expressions are really equal one need to use the law of cosine .    This last expression for the inner product is not used to calculate the inner product but is used to find the angle between two vectors. 

 

 

Example 5. 

We will now find the angle between the two vectors given in Example 4.  

 

> Theta:=arccos(DotProduct(a,b)/(Norm(a,2)*Norm(b,2)));
 

arccos(`+`(`*`(`/`(10, 221), `*`(`^`(13, `/`(1, 2)), `*`(`^`(17, `/`(1, 2))))))) (6)
 

> evalf(Theta);
 

.8329812665 (7)
 

>
 

The last calculation illustrated what must be done to obtain an answer when Maple can not use symbols to find an answer.  evalf stands for evaluate floating point.    It should mentioned where that the evalf is a command from the older package with(linalg): .  We have here illustrated that we sometime need to use both packages to obtain an answer that can be worked with.  The following is a short cut command for finding the angle between two vectors.  You should always used the above formula for this set of homework exercises and in future assignments you can use the Maple command unless told to go back to the definition.  

I will also show you how to combine more than one command.  

> Theta:=VectorAngle(a,b);
 

arccos(`+`(`*`(`/`(10, 221), `*`(`^`(13, `/`(1, 2)), `*`(`^`(17, `/`(1, 2))))))) (8)
 

> evalf(Theta);
 

.8329812665 (9)
 

> evalf(VectorAngle(a,b));
 

.8329812665 (10)
 

>
 

Problems to be turned in for credit 

Use Maple to work each  problem .  You should work each problem by hand to see if you understand the operations.  I want you to  e-mail your *.ms file or print it out and hand it to me by the due date.  .  

D0 NOT TRY TO TURN IN WORK TO MY MAIL BOX IN THE MATH OFFICE, 

The problems are in your text. 

Exercise 1.1.2,  Exercise 1.1.5 Exercise 1.1.15, Exercise 1.1.33  

Due January 16 2009 

To make it easier for you to do you home work , you  will need to go to Tools one the tool bar and click on it.  Next, go down to Options and click on it.  At the top of this window you should click on Display.  This will bring up a window that  has  some options that you will need to change.  Make sure that the Input Display is changed to Maple notation .  Output display should be set to 2-D Math notation.    Finally click on Apply to Session.   

To place you name at the top of the page  you can just type you name  and  assignment.   Place your name on the first line and then hit return and place the assignment on the second followed by a return.   Next use the text to tell the problem you are working on.   Now you are ready to work the first problem in  Maple .  To  work in Maple click on the icon [> on the tool bar.  A red [> should appear.  You must type with(linalg): first followed by a return.  Remember that every line in Maple must end in either a : or a ;.  The semi-colon is used for any code where you desire an answer to appear on the screen.  Do not use the semicolon when typing in the with(linalg) ,with(LinearAlgebra) , with(plots) and when defining graphs to be used in a display command.  Always use the colon with the with(linalg) or with(pilots) commands.    After the first problem is complete you will need to go back up to the tool bar and click on the text command and then go to C and select Text.    After you finish with the number of the problem you should get back to the [>  symbol to get back in the Maple working mode.  You must have the [> symbol in red to be working with (linalg).  with(LinearAlgebra) and wiht(plots) package.s  All of these instruction will very quickly become second nature to you after the first assignment.  One last thing, you can go to the tool bar and click on the T to insert text in you worksheet.  This may be the best way to insert text.  You will need to do a little playing with the software to get down all the options.   If your login name is ims0001 then save this first assignment as lecture101.  If you login name is ims0025 then save the first assignment as lecture125.  If you have any question be sure to ask me or e-mail me. Email the assignments of bogar5101@gmail.com