Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

All published worksheets from http://sagenb.org

Views: 168756
Image: ubuntu2004

Introduction to Vectors *note: work in progress*

1.1 Introduction

This Sage notebook is here to give students an interactive guide to learning about Vectors. I am going to dive into all the basic notation for vectors, operations, and some basic practical applications on them. Vectors are very useful in applications such as physics, computer graphics, and engineering.

1.2 What is a vector?

A vector is an object that resembles what you may have learned as a "ray" in high school mathematics. The vector consists of two points in Euclidean space--that is, on a graph. These are called the starting and ending points for the vector.

This gives the vector two important properties. One is that it has a length. It is the distance from the starting point to the ending point. Some other texts may refer to the length as the magnitude, while others refer to it as the norm. We're going to call it the norm. Why norm? Because it's the most standard term outside of basic calculus...and it reminds me of Norm from Cheers.

The other property is direction. It is the relation of the starting point to the ending point. If I had a vector that started at the origin, and ended at point (4,4), it would be pointing in the northeast direction(see Fig 1).

One thing to note is that a vector's norm and direction are the only things that distinguishes it from other vectors. Where it is on a graph doesn't matter. The following two vectors are equal to each other. When two vectors are equal, the term we used to describe them is parallel

The other thing to note, although this text uses two-dimensional vectors, vectors can be of any dimension. It only makes sense to draw vectors of two and three dimensional space, but any vector in nth dimensional space, has both a norm and a direction in that dimension.

1.3 Notations for Vectors

A vector \textbf{v} = \langle a_1,a_2\rangle can be drawn as an arrow \vec{AB} where A = (x,y) and B = (x + a_1, y + a_2) In other words, \textbf{v} can be thought of has starting at the origin, and having an endpoint of (a_1,a_2).

Vectors are denoted using a bold letter--such as \textbf{v}. However, in class, your professor may write them on the board as \hat{v} or \vec{v}. This is because it's hard to write a bold letter on a chalkboard.

Adding vectors

2.1 What Does it Mean to Add Vectors?

A common thing to do with vectors is to add them to each other. How do you add them? What is the result? Let's jump in with a quick example, and then look at the result on a graph.

If \textbf{a} = \langle3,4\rangle and \textbf{b} = \langle2,8\rangle what is the result of \textbf{a} + \textbf{b}?

\textbf{a} + \textbf{b} is defined to be equal to a vector that is \langle a_1 + b_1,a_2 + b_2\rangle. So in this case, the result is a vector \langle 3+2,4 + 8\rangle or just \langle5,12\rangle. A graph of all three vectors is show below

Looking at the resulting graph, it's easy to see why the addition of vectors is sometimes called the triangle law. The two vectors that are added together make up two sides of the triangle, and the addition completes the triangle. Note from section 1.2 that you can move vectors on a graph and it doesn't change them. Just because \textbf{b} starts at the endpoint of \textbf{a} does not change it. It still has the same direction, and norm.

2.2 Subtracting Vectors

The subtraction of vectors is the same as the addition of vectors. The only difference is that we add the negative of the vector. The vector \textbf{-v} has the same norm as \textbf{v} but points in the exact opposite direction.

Let's do a quick example using the same vectors we used for the addition. If \textbf{a} = \langle3,4\rangle and \textbf{b} = \langle2,8\rangle what is the result of \textbf{a} - \textbf{b}?

As you can see from the graph, we end up with the vector \langle1,-4\rangle. This is the result of \langle3-2,4-8\rangle.

Mutiplication of a Vector by a Scalar

1.1 Scalar..fancy word for a number

A scalar is just another name for a number. So what do we end up with if we do something like 3\textbf{v}? Again, this is best explained by a simple example. The multiplication by a scalar c is defined to be the vector \langle cv_1,cv_1\rangle. So if we have a vector \textbf{v}=\langle2,4\rangle and multiply it by 3, the resulting vector is \langle 3(2),3(4)\rangle or just \langle 6,12 \rangle. Now lets look at the graph to see what this looks like.

The original vector is show in blue. The resulting vector is shown in green. As you can see, the new vector has the same direction, but is just three times as long. So multiplication of a vector does not change the direction, but it does change the norm. Multiplication by a negative number will change the direction as well--the new vector will point in the exact opposite direction.

Standard Basis Vectors

1.1 Special Vectors \textbf{i} and \textbf{j}

Now that we now know how to add two vectors and multiply a vector by a scalar, we can talk about the standard basis vectors, and why they are useful. Let's define two vectors named \textbf{i} and \textbf{j}. The vector \textbf{i} = \langle1,0\rangle and \textbf{j} = \langle0,1\rangle. A graph of these two vectors is in Fig. 6.

So what exactly makes these two vectors so special? Because we can express ANY two-dimensional vector in terms of \textbf{i} and \textbf{j}. The vector \textbf{v} = \langle 5,3\rangle can be expressed as 5\textbf{i} + 3\textbf{j}. Now when we do additions or multiplication by a scalar, we can just combine terms and multiply coefficients. A lot easier to do than dealing with the \langle\rangle notation, eh?

Finding the Norm(No, He's Not in Cheers)

3.1 Distance Formula and notation

If we have a vector \textbf{v}=\langle2,4\rangle or in our new notation, 2\textbf{i}+4\textbf{j} then the norm is defined to be \left| \textbf{v} \right| = \sqrt{v_1^2 + v_2^2}. You may recognize this from high school algebra as the distance formula. So in our example \left|v\right| = \sqrt{2^2 + 4^2} = \sqrt{20} = \sqrt{4}\sqrt{5} = 2\sqrt{5}. The notation for the norm is \left|\textbf{v}\right|. Some texts will use \left|\left|\textbf{v}\right|\right| to differentiate the norm from an absolute value. We will use the single pipe notation here.

3.2 Normalization of a Vector

Sometimes, we don't care about the length of a vector, only its direction. So what we want, is a way to normalize a vector--that is, keep the same direction, but give it a length of 1. This makes calculations that just use the direction of a vector easier to do. To normalize a vector, multiply the vector by the reciprocal of its norm. The equation for this is \textbf{n} = \frac{1}{\left|\textbf{v}\right|}\textbf{v} where \textbf{n} is the normalized vector of \textbf{v}. Why would we want to do this? A good example would be what is called a surface normal. A surface normal is a vector that shows the direction that a polygon is facing. In 3D graphics, you use the surface normal for all sorts of calculations, including light reflection. Also note that our standard basis vectors of \textbf{i} and \textbf{j} are normalized--they have a length of 1.

Putting it All Together

4.1 Resultant Force

Force can be written by a vector, because it has two properties. It has a direction, and a norm(in pounds, or Newtons in SI units). If there is more than one force acting on an object, the resultant force is the total of all the forces. This is a common type of problem for basic vectors. Let's learn how to solve it

4.2 Example #1

A 75 pound weight hangs from a ceiling with two uneven wires. The first wire hangs at an angle of 47 degrees, and the second at an angle of 30 degrees. What are the forces--also called tensions--on both wires? A crude picture displaying this problem is Fig. 7

Fig. 7 Picture for Example #1

What these types of problems ask us to find are the green and red vectors. Let's call them \textbf{g} and \textbf{r}. Because of the definitions of sine and cosine, we can express these vectors in terms of \textbf{i} and \textbf{j}.

*Since the green vector goes left and up, green is \textbf{g} = -|\textbf{g}|\cos{47}\textbf{i} + |\textbf{g}|\sin{47}\textbf{j}
*The red vector goes right and up, which makes it \textbf{r} = |\textbf{r}|\cos{30}\textbf{i} + |\textbf{r}|\sin{30}\textbf{j}
*The resultant force is \textbf{g} + \textbf{r} = -\textbf{w} = 75\textbf{j}. \textbf{w} is the weight of the weight pulling down. It is negative because it's going down. They are equal, because they counterbalance each other. Also note that since we are considering the weight at the origin, it doesn't have an \textbf{i} component. It's just -75\textbf{j}
*So now, we can dump the whole thing into one big equation of:
(-|\textbf{g}|\cos{47}\textbf{i} + |\textbf{g}|\sin{47}\textbf{j}) + (|\textbf{r}|\cos{30}\textbf{i} + |\textbf{r}|\sin{30}\textbf{j}) = 75\textbf{j}
*This equation says that if we add both \textbf{g} and \textbf{r} we're going to get a vector, that's the negative of the weight vector \textbf{w}. This makes sense, because the forces counter each other.
*Still doing nothing more than rewriting the equation. We can equate the coefficients of both sides and end up with two simpler equations. See how easier vectors are to work with when you have them in standard form?
-|\textbf{g}|\cos 47 + |\textbf{r}|\cos 30 = 0
|\textbf{g}|\sin 47 + |\textbf{r}|\sin 30 = 75
*solving for |\textbf{r}| in the first equation we get:
|\textbf{r}| = \frac{|\textbf{g}|\cos 47}{\cos 30}
*putting this result into the second equation: |\textbf{g}|\sin 47 + \frac{|\textbf{g}|\cos 47}{\cos 30}\sin 30 == 75
*we can solve for |\textbf{g}| by multiplying the first term by \frac{\cos 30}{\cos 30} so we have a common denominator, so we have:
\frac{|\textbf{g}|\sin 47\cos 30}{\cos 30} + \frac{|\textbf{g}|\cos 47\sin 30}{\cos 30} == 75
*then we can divide each term in the numerator by \cos 30 (remember that \tan\theta = \frac{\sin\theta}{\cos\theta}):
|\textbf{g}|\sin 47 + |\textbf{g}|\cos 47\tan 30 = 75
*factoring out a |\textbf{g}| on the left side, and then diving that to the right side:
|\textbf{g}| = \frac{75}{\sin 47+\cos 30\tan 47}

%sage #Here's how to find the exact values using Sage #the norm of g is 75/(sin47+cos30tan47) gnorm = (75)/(sin(47*(pi/180))+tan(30*(pi/180))*cos(47*(pi/180))) #the norm of r is (gnorm*cos47)/cos30 rnorm = (gnorm*cos(47*(pi/180)))/(cos(30*(pi/180))) #g is −∣g∣cos47i+∣g∣sin47j g = vector([(-gnorm)*cos(47*(pi/180)),gnorm*sin(47*(pi/180))]) #r is r=∣r∣cos30i+∣r∣sin30j r = vector([rnorm*cos(30*(pi/180)),rnorm*sin(30*(pi/180))]) w = vector([0,-75]) force = g+r rarrow = arrow((0,0),r.element(),color='red') garrow = arrow((0,0),g.element(),color='green') warrow = arrow((0,0),(0,-75),color='yellow') farrow = arrow((0,0,),force.element(),color='blue') plot(rarrow+garrow+warrow+farrow).show(aspect_ratio=1) (r+g) == -w
\newcommand{\Bold}[1]{\mathbf{#1}}{\rm True}