vector operations

Basic operations

Here are the operations that you will learn once you finish this lecture:

  1. Vector addition

  2. Vector subtraction

  3. Scalar multiplication

  4. Dot product

  5. Cross product

Most of the operations shown below are applied to vectors in R2 \mathbb {R}^2 , but they can be also applied to vectors in R3 \mathbb {R}^3 and any Rn \mathbb {R}^n .

Vector addition

You can add two vectors quite easily by simply adding their xx coordinates together, and adding their yy coordinates together.

To add the vectors v1=(x1, y1) \vec {v_1} = (x_1, \ y_1) and v2=(x2, y2) \vec {v_2} = (x_2, \ y_2) , use the following formula:

v1+v2=(x1+x2, y1+y2) \vec {v_1} + \vec {v_2} = (x_1 + x_2, \ y_1 + y_2)

Vector addition may look different depending on the type of vector.

Both graphs display the two vectors being added together: v1+v2=(2+2, 3+2)=(4, 5) \vec {v_1} + \vec {v_2} = (2 + 2, \ 3 + 2) = (4, \ 5)

Two algebraic vectors being added to one another
Two geometric vectors being added to one another

Note that v1+v2 \vec {v_1} + \vec {v_2} starts at (0, 0) (0, \ 0) for the algebraic representation, contrary to the geometrically represented one, which starts at the start of v1 \vec {v_1} and ends at the end of v2 \vec {v_2} .

Notation

There is a special notation that you might see when two geometric vectors are added with a similar point. When adding them, the sum vector has the "inner" point removed (BB in this case):

AB+BC=AB+BC=AC \vec {AB} + \vec {BC} = \vec{A \cancel {B}} + \vec{\cancel {B} C} = \vec {AC}

Again, this only occurs if the "inner" points are the same.

Vector subtraction

Just as you can add two vectors, you can also subtract them! Vector subtraction follows the same formula

To subtract the vectors v1=(x1, y1) \vec {v_1} = (x_1, \ y_1) and v2=(x2, y2) \vec {v_2} = (x_2, \ y_2) , use the formula below:

v1v2=(x1x2, y1y2) \vec {v_1} - \vec {v_2} = (x_1 - x_2, \ y_1 - y_2)

Here's a comparison of what vector subtraction looks like with algebraic and geometric vectors:

Two algebraic vectors being subtracted from one another
Two geometric vectors being subtracted from one another

A good way to think of vector subtraction, is that you add both vectors, except all the vectors with a negative infront of them have the start and end points flipped.

Scalar multiplication

You can multiply a scalar value kk to a vector. This is done by multiplying kk by both the xx and yy values.

Here is the formula for such operation with the vector v=(x, y) \vec {v} = (x, \ y) :

kv=(kx, ky) k \vec {v} = (kx, \ ky)

Visually, this looks like you are multiplying the magnitude (length) of the vector:

The elongation of the vector is the same for both geometric and algebraic vectors

Dot product

The dot product of two vectors is the length of the projection of one vector onto the other. Now this sound a bit complicated, but once you see what it really looks like it makes total sense!

However, before doing so, let's look at the formula to obtain the dot product of two vectors v1=(x1, y1) \vec {v_1} = (x_1, \ y_1) and v2=(x2, y2) \vec {v_2} = (x_2, \ y_2) :

v1  v2=x1x2+y1y2 \vec {v_1} \ \cdot \ \vec {v_2} = x_1 x_2 + y_1 y_2

The visualization of the dot product is the same for geometric and algebraic vectors

Please note that the dot product is a scalar. It is the included in the magnitude of the vector, NOT the vector itself!

Alternate formula

There is another way to calculate the dot product, and it involves the magnitudes of both vectors, as well as the angle between them:

v1  v2=v1v2cosθ \vec {v_1} \ \cdot \ \vec {v_2} = \left \| \vec {v_1} \right \| \left \| \vec {v_2} \right \| \cos \theta

Dot product of orthogonal vectors

The dot product of two orthogonal (perpendicular) vectors is equal to 00.

For two orthogonal vectors n \vec {n} and m \vec {m} :

n  m=0 \vec {n} \ \cdot \ \vec {m} = 0

This is because the angle between both vectors is 90o 90^o , and the value of cosθ \cos \theta when θ=90o \theta = 90^o in n  m=v1v2cosθ \vec {n} \ \cdot \ \vec {m} = \left \| \vec {v_1} \right \| \left \| \vec {v_2} \right \| \cos \theta equals 00.

Cross product

The cross product is used in R3 \mathbb {R}^3 , and it produces a new vector that is orthogonal (or perpendicular) to the two vectors used.

Calculating the cross product can be complicated, so we will try to simplify it for you.

Visualization

Here is what the cross product c \vec {c} of the two vectors a \vec {a} and b \vec {b} looks like:

Note that the vectors being used in the cross product don't need to be orthogonal

Calculation

Follow the steps in this video to find the cross product of two vectors:

  1. The calculation of the cross product is done by first drawing the grid shown in the video.

  2. Then, by drawing lines, you can determine which product of terms you subtract with one another.

  3. Finally, once you have the equation seen in the end (with appropriate values), all you need to do is solve!.

  4. Since the vector is expressed as a sum of unit vectors, you can easily determine the vector's value in cartesian form by looking at the coefficients.

Scalar cross product

You can calculate the magnitude of the cross product vector by using the following formula:

a×b= a  b sinθ \vec {a} \times \vec {b} = | \ \vec {a} \ | | \ \vec {b} \ | \sin \theta

The angle between two vectors

You can determine the angle between two vectors by using the two formulas for the dot product that we just learned:

v1  v2v1v2=cosθ \frac {\vec {v_1} \ \cdot \ \vec {v_2}} {\left \| \vec {v_1} \right \| \left \| \vec {v_2} \right \|} = \cos \theta

No description

example

Find the angle between the vectors v1=(2, 3) \vec {v_1} = (2, \ 3) and v2=(3,4) \vec {v_2} = (3, 4) :

answer

Find the dot product of both vectors:

v1  v2=(2)(3)+(3)(4)=6+12=18 \vec {v_1} \ \cdot \ \vec {v_2} = (2)(3) + (3)(4) = 6 + 12 = 18


Find the magnitudes of both vectors:

v1=(2)2+(3)2=13 \left \| \vec {v_1} \right \| = \sqrt { (2)^2 + (3)^2 } = \sqrt {13}

v2=(3)2+(4)2=25=5 \left \| \vec {v_2} \right \| = \sqrt { (3)^2 + (4)^2 } = \sqrt {25} = 5


Now, just plug in the values into the equation:

v1  v2v1v2=cosθ \frac {\vec {v_1} \ \cdot \ \vec {v_2}} {\left \| \vec {v_1} \right \| \left \| \vec {v_2} \right \|} = \cos \theta

(18)(13)(5)=cosθ \frac { (18) } { (\sqrt {13})(5) } = \cos \theta

  θ=cos1(18513) \quad \quad \ \ \theta = \cos^{-1} (\frac { 18 } { 5 \sqrt {13} })

  θ3.18o \quad \quad \ \ \theta \approx 3.18^o


\therefore The angle between both vectors is approximated 3.18 3.18 degrees

The projection of one vector onto another

The vector projection of v1 \vec {v_1} onto v2 \vec {v_2} is a vector that is in the same direction as v2 \vec {v_2} , but same magnitude as the dot product of a \vec {a} and b \vec {b} .

It has its own special notation projv2v1 \text {proj}_{\vec {v_2}} {\vec {v_1}} indicated a projection of v1 \vec {v_1} onto v2 \vec {v_2} .


To calculate the projection of some vector a \vec {a} onto b \vec {b} , use the following formula:

projba=(a  bb  b)b \text {proj}_{\vec {b}} {\vec {a}} = (\frac { \vec {a} \ \cdot \ \vec {b} } {\vec {b} \ \cdot \ \vec {b}}) \vec {b}

No description

scalar projection

The scalar projection is the magnitude of the projection vector and it is obtained from the following formula:

 projba = a  b  b  | \ \text {proj}_{\vec {b}} \vec {a} \ | = \frac {| \ \vec {a} \ \cdot \ \vec {b} \ |} {| \ \vec {b} \ |}

vector properties

Vector addition properties

The following properties are true for all vectors being added:

  • Commutative: u+v=v+u \vec {u} + \vec {v} = \vec {v} + \vec {u}

  • Associative: (u+v)+w=v+(u+w) (\vec {u} + \vec {v}) + \vec {w} = \vec {v} + (\vec {u} + \vec {w})

  • Distributive: m(u+v)=mu+mv m (\vec {u} + \vec {v}) = m\vec {u} + m\vec {v}

  • Identity properties: v+0=v \vec {v} + \vec {0} = \vec {v} and 1v=v 1\vec {v} = \vec {v}

To clarify, 0 \vec {0} is a vector with only zeros.

Dot product properties

The following properties are true for all vectors in a dot product:

  • Commutative: u  v=v  u \vec {u} \ \cdot \ \vec {v} = \vec {v} \ \cdot \ \vec {u}

  • Not Associated: (u  v)  wv  (u  w) (\vec {u} \ \cdot \ \vec {v}) \ \cdot \ \vec {w} \neq \vec {v} \ \cdot \ (\vec {u} \ \cdot \ \vec {w})

  • Dot product with a vector and itself: v  v=v2=x2+y2 \vec {v} \ \cdot \ \vec {v} = \left \| \vec {v} \right \|^2 = x^2 + y^2

  • Dot product of two orthogonal: u  v=0  \vec {u} \ \cdot \ \vec {v} = 0 \ where uu and vv are orthongal

Two non-zero vectors are orthogonal to one another when they have angle of 90o 90^o with one another.