Math 2248  Lab 2: 

Basic Vector Operations and Equations of Planes

© Copyright by T.I. Lakoba.
The original Introduction by D.S. Dummit.
Exercises by T.I. Lakoba.
Last modified  2025-09-07

Clear["`*"]

Introduction:  Algebraic operations on vectors

A vector in (ℝ^n) is represented in Mathematica  as a list:

              (Overscript[v, →]) = { (Subscript[v, 1]), (Subscript[v, 2]) , ... , (Subscript[v, n])}

of n entries.   For example

v = {13, 52,-27}

defines the vector  (OverVector[v])  in 3-space whose x-coordinate is 13, y-coordinate is 52, and z-coordinate is -27.

Note that to define a list (i.e., a vector) in Mathematica, you must use the curly brackets, { and }, and not any other types of brackets (e.g., NOT ( and ) or [ and ]).

To access the individual coordinates of the vector, use the syntax:
      
           v[[i]]  , 
           
which will give the (i^(th ))coordinate of the vector  (OverVector[v]).  For example,

v[[1]]

gives the first entry in the list  v, which is the x-coordinate of the vector (OverVector[v]).

Note that you need to use a different type of brackets to access the list’s entry than to define a list.

Practice on your own:
What Mathematica commands will give the y- and z-coordinates of (OverVector[v]) ?

A point in 3-space is also represented by Mathematica as a list. This is convenient, because, for example, you can define a vector connecting two given points as follows:

P1 = {-2,-3,4}          (*This is the starting point *)
P2 = {5,4,11}            (*This is the terminal point *)
vector12 = P2-P1      (* This is the vector from P1 to P2 *)

Many standard vector operations, including the dot product and the cross product, are built into Mathematica:

w = {-9, 3, 17}

Dot[v,w]

A shorthand way to get the dot product is the following:

v.w

Similarly, to find the cross product, type:

Cross[v,w]

Cross[w,v]

Some care should be exercised when dealing with vectors: Mathematica will perform operations on a list by performing the operation on each element in the list, which may not be what is intended.  For example,  squaring a vector (which makes no sense as a vector operation!) is interpreted by Mathematica as "squaring the list," i.e., squaring each element of the list:

{1,2,3}^2

In particular, typing

        v v 
 (with no dot in between!) does not give the dot product of  v with itself. Compare the outputs of the four expressions below and note that only one of them yields the dot product of   (OverVector[v])  with itself:

v
v^2
v v
v.v

Addition, subtraction, and scalar multiplication behave as one would expect them to:

v + w

v - w

3 v

Introduction continued:  Length of a vector

To compute the length of a vector, recall that the dot product   (OverVector[v]).(OverVector[v])   of a vector with itself gives the square of its length:  

						 (OverVector[v]).(OverVector[v]) = | (OverVector[v]) ((|)^2) 
						 
Hence, we can compute the length of (OverVector[v]) as follows:

Sqrt[v.v]

Since it is reasonable to expect that we may need to compute the length of a vector often, we can then define a function that does so for any vector:

mag[x_]= Sqrt[x.x]
(* The name "mag" stands for "magnitude,"which,for a vector, is the same as "length."*)

Now we can evaluate the length of any vector:

mag[v]

mag[w]

and so on.  For example:

mag[{1,t,t^2}]

Another word meaning “length” for a vector is “norm”, and, in fact, Mathematica has a built-in command for computing any vector’s norm called just that:

Norm[v]
(* So, Mathematica's 'Norm' and our own 'mag' are equivalent.*)

To get a unit vector, we simply divide a given vector by its length:

u = v/mag[v]

Mathematica also has a built-in command for defining a unit vector:

uM = Normalize[v]

To get an approximate numerical value of this vector, just wrap the command "N" around it:

N[u]

This last vector should be a unit vector -- so it should have length 1:

mag[u]

Practice on your own:
Find a numerical approximation for a unit vector in the direction of (OverVector[w]), defined above, and compute its magnitude to check that it is indeed a unit vector.

Clear everything before you continue on to the Exercises

Clear["`*"]

Before you begin working on the Exercises, do the following:

1) Look up (in the Notes or Textbook, but not online!) the standard form of the problem “find the equation of a line.” 
Clarification: I am not asking about vector, parametric, or symmetric form of the equations. Rather, I am asking about the standard form of the problem as was covered in class. That is, what two ingredients do you need to be able to find the equations of a line?
    On a piece of paper, list these two ingredients.
    So, if you are given a line, then you have these two ingredients.
    Conversely, if you have these two ingredients, then you know the line that they define. Thus, “finding a line” means finding those two ingredients.
    
2) Repeat the above step for a plane instead of a line.

Another logistical suggestion:
You will need to look at the examples in the Introduction quite a few times when doing the Exercises. It will be rather inconvenient for you to keep scrolling up and down, going between the Introduction and an Exercise. It will be much more convenient to always have the Introduction in front of you. For that, open the Lab again, save it under a different name (you may simply not change the “_yourname” suffix at all), and open it on the Introduction. So, you will have two copies of the Lab open: one is where you are working and the other with the open examples, which you will need to mimic.

Exercise 1

Find an equation of the plane that contains the line 
 L:   x = -2 + 3t,    y = 4 + 2t,     z = 3 - t
 and is perpendicular to the plane
 S:   x - 2y + z  = 5.
 
As always when finding the equation of a plane, you need to find its normal vector and a point in the plane. However, it is always a good practice to reduce a new problem to the one that you have solved earlier (or which was solved for you). This is the approach that we will use. Follow the steps outlined below.

Also, please put your work in the part (i.e., (a), (b), or (c)) that has asked for it. For example, even if you can finish the problem right after answering the question in (b), still put your work in (c) (as the instructions say). It makes it hard for me to grade a large number of Labs if I have to look for your work all over the place instead of in a part where it is requested. I appreciate your cooperation.

(a)   On a piece of paper, sketch two perpendicular planes. One of them represents the given plane  S and the other one represents plane  F  whose equation you are asked to find. 
Draw a line in plane  F ; this line represents the given line  L .
Do not forget to put the given ingredients (see the red text before this Exercise) in your sketch!
   
As an alternative for a sketch, you can make a 3D model. For example, the two halves of your laptop can represent the two planes (you can make them perpendicular, right?). If the horizontal half represents plane  F, then a pencil lying on it will represent line  L . 

From your sketch or model, decide which two vectors plane  F  is parallel to. Briefly (in no more than two sentences) explain your reasons for each vector in the answer box below. Your explanation for each vector should make two things clear:
  * why this vector is parallel to plane  F,   and 
  * how it is related to the given line and/or plane. 
(Note that saying something like “I got v1 from the coefficients of ... .” will not be a correct explanation because it does not address the first “thing” above.)

(b)   Which point does the required plane contain? (Of course, it contains infinitely many points, and you can pick any of them. What I mean, though, is that you can read the coordinates of one such point immediately from the information given to you in this problem.) 
Record its coordinates in the box below. In the same box, state why you chose these values. To clarify: The main question is not about where these coordinates came from. Rather, you need to focus on explaining why the point with these coordinates must lie on the plane in question.

(c)   Now you know two vectors and one point that the sought plane contains.
This case was considered in class. Find that example in your notes, review it, and then finish the problem on your own. Show all the work you do. Use the cross and dot product notations, introduced earlier in this Lab, as needed. (Do not compute them by hand - Mathematica will do it for you!) 

If you decide to simplify the equation that you have obtained (which is not required), please do not do arithmetic calculations by hand! Just as with the dot and cross products, let Mathematica do those calculations for you. You may find the command  Expand[...]  helpful for this task of simplifying your equation. (To learn more about it, go to “Help” on the right of the main menu bar, left-click on it, select “Wolfram Documentation” (it’s at the top of the list), and type the command name into the Search box. Find an example most relevant to your case among the Basic Examples presented there.)

Record your answer in the box below.

Exercise 2

Before you proceed: Have you done what is asked in the red text before Exercise 1? If not (but you have somehow gotten through Exercise 1), do what those instructions say.


Find an equation of the plane that contains the point P0=(-1,2,-5) and is perpendicular to the planes:
S1:   2x - y + z = 1	    and	  S2:    x + y - 2z = 3.

Follow the steps outlined below.

(a)   On a piece of paper, sketch any two intersecting planes; these represent the given planes S1 and  S2 . (You may also take a notebook and stand it on your desk. Then the two covers of the standing notebook represent your two planes. You may also use the halves of your laptop.) 

As you remember, one of the ingredients of a plane is its normal vector, and so in this part you need to explain how you can find it. As a guide, consider answering the questions stated in the next paragraph. (You need to answer them to yourself first; this, hopefully, will lead you to the understanding of how to find that vector. You will then need to record a short summary of your solution in the AnswerBox provided after the next two paragraphs.) 

Which vector (let us call it  n ) is the sought plane orthogonal to? 
This, actually, implies two separate questions.
  - First, where is that vector (or line, L) in your sketch (or 3D model)?
  - Second, once you have located the vector/line, you need to find its equation. We did not do a problem exactly like that in class, so here are a couple of hints.
  	 (i) How is  n  (or, equivalently,L) oriented relative to certain ingredients of planes S1 and  S2 ?  
  	 (ii) In which section of the textbook did you learn how to find a vector oriented like that? 
   Now that you have answered these questions, you can finish this part of the Exercise.  
  
Show all the work necessary to understand how you found the required vector. (Again, if you need to do any calculation with vectors, do not do them by hand - let Mathematica do the work that it does best.) 
Briefly (in no more than two sentences) explain the rationale for your steps.

(b)   Now you have reduced the problem to its classical form: Find an equation of the plane that contains a given point and is perpendicular to a given vector. Finish the problem and record your answer in the box below. Show all the work you do. And yet again, please have Mathematica do all the arithmetic (or any other calculations) for you.

Delete your output

In the main menu bar, go to “Cell” and select “Delete all output”.

The end