# Vectors

## Claimed by:

**Anushka Dogra (Fall 2022)**
Additional edits by **Sally Smith (Fall 2023)**
Additional edits by **Shiv Patel (Spring 2024)**

## Vectors and Units

Vectors and units are fundamental concepts in mathematics and physics, playing a crucial role in describing quantities with both magnitude and direction. Understanding vectors and units is essential for various fields, including physics, engineering, and computer science.

Image

https://labs.phys.utk.edu/mbreinig/phys221core/modules/m1/images/Image3.gif

## Overview

Vectors are mathematical objects represented by directed line segments, characterized by both magnitude and direction. They are often denoted by boldface letters or arrows, such as v or ⟶AB. Vectors can represent various physical quantities, including displacement, velocity, force, and acceleration.

Units, on the other hand, are standards used to quantify and measure physical quantities. They provide a reference for expressing magnitudes and enable meaningful comparisons between measurements. Common units include meters (m) for length, kilograms (kg) for mass, seconds (s) for time, and newtons (N) for force.

https://www.onlinemathlearning.com/image-files/unit-vector.png

## Magnitude

The magnitude of a vector represents its length or size and is denoted by |v|. It is a scalar quantity and is always non-negative. The magnitude of a vector is calculated using the Pythagorean theorem in two or three dimensions.

## Direction

The direction of a vector indicates its orientation in space and is often described relative to a reference axis or another vector. It can be expressed using angles, unit vectors, or geometric descriptions.

## Addition and Subtraction

Vectors can be added or subtracted to form new vectors using the parallelogram rule or the head-to-tail method. In component form, vector addition involves adding corresponding components separately.

## Scalar Multiplication

Scalar multiplication involves multiplying a vector by a scalar quantity, resulting in a new vector with the same direction but a modified magnitude. It is a fundamental operation in vector algebra and has applications in scaling and resizing vectors.

https://i.ytimg.com/vi/0LYOSzRuNeI/hqdefault.jpg

## Dot Product

The dot product (or scalar product) of two vectors yields a scalar quantity equal to the product of their magnitudes and the cosine of the angle between them. It is used to calculate the angle between vectors, project one vector onto another, and determine the work done by a force.

https://study.com/cimages/multimages/16/dotproducteq2.jpg

## Cross Product

The cross product (or vector product) of two vectors yields a new vector that is perpendicular to the plane containing the original vectors. Its magnitude is equal to the product of the magnitudes of the original vectors and the sine of the angle between them. The cross product is used to find torque, angular momentum, and determine the direction of a resultant force in rotational motion.

https://i.ytimg.com/vi/yLug2TnnyI4/maxresdefault.jpg

## Units of Measurement

## SI Units

The International System of Units (SI) is the most widely used system of measurement, adopted by most countries worldwide. It defines seven base units from which all other units are derived, including the meter (m) for length, kilogram (kg) for mass, second (s) for time, ampere (A) for electric current, kelvin (K) for temperature, mole (mol) for amount of substance, and candela (cd) for luminous intensity.

## Derived Units

Derived units are formed by combining base units according to mathematical relationships. Examples include the newton (N) for force (kg·m/s^2), the joule (J) for energy (N·m), and the watt (W) for power (J/s). These units are essential for expressing complex physical quantities.

## Conversion

Conversion between units involves transforming measurements from one unit to another while preserving their numerical value. It is often necessary when working with data from different sources or when communicating results to audiences using different unit systems.

## Applications

Vectors and units have diverse applications across various disciplines:

- Physics: Vectors are used to describe the motion of objects, forces acting on bodies, and electromagnetic fields.

- Engineering: Vectors are employed in structural analysis, fluid mechanics, and electrical circuit design.

- Computer Graphics: Vectors are utilized to represent geometric shapes, positions of objects, and transformations in 2D and 3D graphics.

- Navigation: Vectors are used in GPS systems to determine position, velocity, and direction for navigation purposes.

## Conclusion

Understanding vectors and units is essential for comprehending and analyzing physical phenomena and mathematical relationships in various fields. By mastering these concepts, researchers, engineers, and scientists can effectively model, predict, and manipulate quantities in the real world.

_________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________

## What is a Vector?

In mathematics and physics, a vector is a quantity with a magnitude and a direction in space.

The general syntax of a vector follows a letter with an arrow above it equaling a set of coordinates in a 1st, 2nd, 3rd or more dimension coordinate system.
Looking at the following vector [math]\displaystyle{ \lt v_x, v_y, v_z\gt }[/math],
[math]\displaystyle{ v_x }[/math] says the x-component of the vector, [math]\displaystyle{ v_y }[/math] says the y-component of the vector, and [math]\displaystyle{ v_z }[/math] says the z-component of the vector.
Alternatively, a vector can be written as a boldface letter: **a**. Which letter is used depends on the problem and desired quantity; for example, [math]\displaystyle{ \vec{v} }[/math] represents velocity.
A specific component of a vector, see the section titled "forms", is denoted by a subscript: c_{x}. For example, q_{y} represents the y component of a vector [math]\displaystyle{ \vec{q} }[/math].

#### Example of a Simple Vector

[math]\displaystyle{ \vec{v} = \lt 1, 0, 0\gt }[/math]

This vector is denoted by the letter v. It is in a 3-dimensional coordinate system and its direction is in the positive-x direction with a magnitude of 1.

### Magnitude

The magnitude of a vector is the length of a vector.

Surrounding a vector by | | symbols denotes a vector's magnitude: [math]\displaystyle{ |\vec{v}| }[/math]. Alternatively, there exists the notation [math]\displaystyle{ \overline{v} }[/math] and [math]\displaystyle{ \lVert \vec{v} \rVert_2 }[/math], with the latter denoting the Euclidean norm. This is the type of vector norm that you will see most often.

Most commonly used in this class, in a three dimensional system, the magnitude of some vector [math]\displaystyle{ \lt v_x, v_y, v_z\gt }[/math] is defined to be [math]\displaystyle{ \lVert \vec{v} \rVert = \sqrt{v_x^2 + v_y^2 + v_z^2} }[/math].

In other systems, the magnitude of some vector is found by taking the square root of all of its components squared: [math]\displaystyle{ \lVert \vec{v} \rVert = \sqrt{v_x^2 + v_y^2 + v_z^2 ...+v_n^2} }[/math].

The magnitude of a vector can represent a variety of characteristics, depending on the situation. The magnitude of the vector, and the vector itself, has units corresponding to the characteristic it represents.

Note that a vector does not necessarily extend from one point in real, physical space to another; unless the magnitude is in units of length, the magnitude of the vector usually represents a property that exists at a single point in real, physical space, or no position in particular.

#### Unit Vector

By dividing a vector by its magnitude, the vector's magnitude will be equal to 1, creating a unit vector: [math]\displaystyle{ \hat{v} = \frac{\vec{v}}{\lVert \vec{v} \rVert} = \lt v_x, v_y, v_z\gt /\sqrt{v_x^2 + v_y^2 + v_z^2} }[/math]. The answer would be in the form of a vector.

A unit vector is denoted by a letter with a ^ symbol written over it: [math]\displaystyle{ \hat{v} }[/math]. Certain letters represent specific unit vectors. Non-Cartesian coordinate systems often have their own different unit vectors. For example, 2D polar coordinates make use of the [math]\displaystyle{ \hat{r} }[/math] and [math]\displaystyle{ \hat{\theta} }[/math] unit vectors.

A simple example of unit vectors are the axes of the 3D-map which are notated as [math]\displaystyle{ \hat{x}, \hat{y}, \hat{z} }[/math]. This is spoken as x-hat, y-hat, and z-hat. These unit vectors are equal to [math]\displaystyle{ \lt 1, 0, 0\gt }[/math], [math]\displaystyle{ \lt 0, 1, 0\gt }[/math], [math]\displaystyle{ \lt 0, 0, 1\gt }[/math] respectively.

### Direction

The direction of a vector refers to the direction along which the vector acts.

In a 2-dimensional space, the direction refers to the angle from the positive x -axis.

The direction of a vector in a 2-dimensional space can be easily calculated by using the following formula:

[math]\displaystyle{ \theta = arctan(v_y/v_x) }[/math]

### Simple Examples of Vector Quantities

#### Position

A person's position can be represented in vector form. Position relative to another object is found by subtracting their respective vector forms. Finding the magnitude of the relative position vector will find the shortest path distance between the two objects. A very common use of the position vector is finding a position relative to the origin. To do this, we subtract the zero vector from the given position vector. This allows for easy manipulation of the position vector because it is centered at zero.

#### Velocity

Velocity can be represented in vector form. The velocity of an object, often given in meters per second (m/s), is a scalar value describing how quickly the object is moving. Speed is the magnitude of the velocity vector. However, the object's movement happens in a particular spatial direction, which the speed alone does not tell us. The direction of the object's movement is also a part of the velocity vector. Together, speed and direction comprise the velocity vector and give a complete description of an object's motion at a point in time.

The velocity vector can be calculated by calculating the derivative of the position vector.

For example, let [math]\displaystyle{ \vec{r} }[/math] be a position vector equaling to [math]\displaystyle{ \lt t, 1, 0\gt m }[/math]. Where t is equal to the time in seconds. To get the velocity vector, we calculate the derivative of [math]\displaystyle{ \vec{r} }[/math] to get the velocity vector [math]\displaystyle{ \vec{v} }[/math]:

[math]\displaystyle{ \vec{v} = \lt 1, 0, 0\gt m/s }[/math]

The speed would be the magnitude of the velocity vector, which is equal to 1 m/s.

#### Weight (Force of Gravity)

Weight is also a vector, typically with only a component in the y-direction. Weight is usually represented by the force of gravity, [math]\displaystyle{ \vec{F_g} }[/math], on an object. We represent [math]\displaystyle{ \vec{F_g} }[/math] as follows:

[math]\displaystyle{ \vec{F_g} = \lt 0, -mg, 0\gt }[/math]

Where [math]\displaystyle{ g }[/math] is the Earth's gravitational constant 9.8 [math]\displaystyle{ m/s^2 }[/math] and [math]\displaystyle{ m }[/math] is the mass of the object. Because the gravitational force is always pointed down towards the Earth, it is always displayed as a negative value in the [math]\displaystyle{ -y }[/math] direction. This then commonly yields weight in Newtons (N). The magnitude of the force of gravity, [math]\displaystyle{ |\vec{F_g}| = mg }[/math] is the weight of the object, also called the weight force.

### Visually Representing Vectors

Vectors are visually represented by arrows. The length of the arrow represents the magnitude of the vector, while the direction the arrow points in represents the direction of the vector. If a vector exists at a particular point in space, the "tail" of the arrow, or the start of the arrow, should be placed at that point.

This example shows a visual representation of the velocity vector of a ball, which is moving to the right at a speed of 5 m/s.

## Vector Operations

It is possible to perform a variety of mathematical operations on vectors, both with other vectors and with scalars. These operations appear in a variety of formulas in physics. To make the operations easier to learn, they are defined below assuming all vectors to be 3-dimensional; the more general n-dimensional definitions look more confusing. If necessary, it is easy to guess how to perform each operation with n-dimensional vectors by extrapolating from the 3-dimensional case.

### Addition

[math]\displaystyle{ \vec{a} + \vec{b} = \langle (a_x + b_x), (a_y + b_y), (a_z + b_z) \rangle }[/math].

In other words, to add two vectors, simply add the vector's components to form the new components. In order to add two vectors together, your first have to identify the heads and the tails of the vectors. Using the head to tail method, you place the head of the second vector on the tail of the first vector. Then, you draw a connecting vector also known as the resultant vector, seen here in red, from the tail of the first vector to the tip of the second vector. The resultant vector is the sum of the two vectors.

### Subtraction

[math]\displaystyle{ \vec{a} - \vec{b} = \vec{a}+(-\vec{b}) = \langle (a_x - b_x), (a_y - b_y), (a_z - b_z) \rangle }[/math].

In other words, to subtract two vectors, simply subtract their like components to form the new components.

### Multiplication by Scalar

[math]\displaystyle{ k \cdot \vec{a} = \langle k \cdot a_x, k \cdot a_y, k \cdot a_z \rangle }[/math].

In other words, multiplying a vector by a scalar multiplies each of that vector's components by that scalar, yielding a vector. This will only affect a vector's magnitude, not its direction, unless the scalar is negative, in which case the direction of the vector will be reversed.

### Division by Scalar

Division by a scalar behaves exactly like scalar multiplication. Each component is divided by the scalar, thus yielding a vector. This can also be accomplished by multiplying each component by the reciprocal of the scalar: [math]\displaystyle{ 1/(scalar) }[/math]

The scalar in this case being k.

[math]\displaystyle{ \frac{\vec{a}}{k} = \langle \frac{a_x}{k}, \frac{a_y}{k}, \frac{a_z}{k} \rangle }[/math].

### Dot Product (also called Scalar Product)

[math]\displaystyle{ \vec{a}\cdot\vec{b} =(a_x \cdot b_x) + (a_y \cdot b_y) + (a_z \cdot b_z) }[/math].

The dot product of two vectors is the sum of the products of their like components, and this operation yields a scalar. This quantity makes it easy to see the relationship between two vectors in a simple scalar quantity.

One of the most common uses of the dot product is to use it to check whether two vectors are orthogonal (perpendicular) to one another. Two vectors are orthogonal if (and only if) their dot product is equal to 0.

It is important to note that the dot product of two vectors has a specific value: [math]\displaystyle{ \vec{a}\cdot\vec{b} = |\vec{a}| \cdot |\vec{b}| \cdot \cos(\theta) }[/math], where [math]\displaystyle{ \theta }[/math] is the angle between the vectors.

### Cross Product (also called Vector Product)

One definition of a cross product, which is also the one found on the formula sheet, is:

[math]\displaystyle{ \vec{a} \times \vec{b} = \langle (a_yb_z - a_zb_y), (a_zb_x - a_xb_z), (a_xb_y - a_yb_x) \rangle = (a_yb_z - a_zb_y)\hat{i} - (a_zb_x - a_xb_z)\hat{j} + (a_xb_y - a_yb_x)\hat{k} }[/math].

While this definition may appear overwhelming, it helps in application to remember that the result of taking the cross product of two vectors is a third vector that is orthogonal (perpendicular) to both of the original vectors. The order of terms in a cross product determines the sign of the resulting vector, so it is important to have vectors in the correct order when you compute a cross product.

Computing a cross product is equivalent to taking the determinant of a matrix of the following form:

[math]\displaystyle{ \begin{vmatrix} \hat{i} & \hat{j} & \hat{k} \\ a_x & a_y & a_z \\ b_x & b_y & b_z \end{vmatrix} }[/math]

In order to find the determinant of a 3x3 matrix, it can be helpful to use process of cofactor expansion. The below image shows how this works. You cross out the first row, and then the column corresponding to i. Then, find the determinant of the smaller 2x2 matrix created by this simplification. Perform this 2 more times with j and k, and do not forget that the j term is always subtracted!

Here is a website to conduct cross products and see the steps for how to solve them if you need more help: https://www.symbolab.com/solver/vector-cross-product-calculator

Here is a generic video displaying the formula being used: https://www.youtube.com/watch?v=e9T5p_Jwv5c

The cross product of two vectors results in another vector in [math]\displaystyle{ \lt \hat{i}, \hat{j}, \hat{k}\gt }[/math] form. It is important to note that the *magnitude* of the cross product of two vectors has a specific value: [math]\displaystyle{ |\vec{a}\times\vec{b}| = |\vec{a}| \cdot |\vec{b}| \cdot \sin(\theta) }[/math], where [math]\displaystyle{ \theta }[/math] is the angle between the vectors.

The direction of the cross product of two vectors is perpendicular to the plane in which those vectors lie and is given by the Right Hand Rule. 2D vectors do not have cross products. While the other operations listed here are commutative, associative, and distributive over addition the cross product operation is not associative and is anti-commutative (i.e., [math]\displaystyle{ \vec{a}\times\vec{b} = -\vec{b}\times\vec{a} }[/math]), meaning that if the order of the factors is reversed, their cross product will be reversed in direction.

**For more mathematically-advanced students**, I will invoke some higher-level linear algebra. Recall that the null space, defined as [math]\displaystyle{ \operatorname{Null}(A) = \{ \vec{v} \in \mathbb{R}^n \mid A\vec{v} = \vec{0} \} }[/math] for an arbitrary matrix [math]\displaystyle{ A \in \mathbb{R}^{m \times n} }[/math], is the orthogonal complement of its row space. That is, for all [math]\displaystyle{ \vec{v} \in \operatorname{Null}(A) }[/math] and for all rows [math]\displaystyle{ \vec{a}_{j} }[/math] of [math]\displaystyle{ A }[/math], we have that [math]\displaystyle{ \vec{a}_j \cdot \vec{v} = 0 }[/math]. This is because, since [math]\displaystyle{ \vec{v} \in \operatorname{Null}(A) }[/math], we have that

[math]\displaystyle{ A\vec{v} = \begin{bmatrix}\vec{a}_1 \\ \vec{a}_2 \\ \vdots \\ \vec{a}_m\end{bmatrix}\vec{v} = \begin{bmatrix}0 \\ 0 \\ \cdots \\ 0\end{bmatrix}. }[/math] Now, recall how matrix vector multiplication works! We see that [math]\displaystyle{ \begin{bmatrix}\vec{a}_1 \\ \vec{a}_2 \\ \vdots \\ \vec{a}_m\end{bmatrix}\vec{v} = \begin{bmatrix}\vec{a}_1 \cdot \vec{v} \\ \vec{a}_2 \cdot \vec{v} \\ \vdots \\ \vec{a}_m \cdot \vec{v}\end{bmatrix} = \begin{bmatrix}0 \\ 0 \\ \cdots \\ 0\end{bmatrix} }[/math]. Since all of the dot products are 0, [math]\displaystyle{ v }[/math] is orthogonal to all of the rows of [math]\displaystyle{ A }[/math]. Therefore, we can conclude that [math]\displaystyle{ v }[/math] is orthogonal to the whole row space of the matrix [math]\displaystyle{ A }[/math].

For two vectors [math]\displaystyle{ \vec{a},\vec{b} \in \mathbb{R}^{3} }[/math] that are not scalar multiples of one another, if we think of [math]\displaystyle{ \vec{a}, \vec{b} }[/math] as corresponding rows in a matrix [math]\displaystyle{ A }[/math], then the null space contains the set of all vectors orthogonal to them both simultaneously. In particular, it contains the unique vector produced by taking the cross product of both vectors. Once we fix what direction is the right direction, and what is the appropriate magnitude, we would then yield a unique vector in the nullspace that is equal to their cross product. **This is why the right-hand rule works.** (That is, this is why it yields a unique result.) If we visualize the plane spanned by two vectors with our index and middle fingers, then their null space will be perpendicular to the intersection point of the two vectors, or rather the thumb. Likewise, if we use all of our fingers and our thumb to make an L-shape representing the span of the two vectors, upon curling our fingers, we will have the direction of the cross product, which is orthogonal to the two vectors represented by your thumb and fingers. (If we were in [math]\displaystyle{ \mathbb{R}^4 }[/math], this would be much trickier, since the dimension of the nullspace would be 2 dimensional, and as a result, even after fixing the appropriate magnitude, we would have an infinite number of *directions* we could chose from.)

#### Another Cross Product Trick

This trick can be used to calculate the cross product quickly. This is done by bypassing the need to create a big matrix and creating a simple visual representation to quickly calculate the determinants.

The best way to explain this trick is to use an example.

Let there be two vectors [math]\displaystyle{ \vec{a} }[/math] and [math]\displaystyle{ \vec{b} }[/math].

[math]\displaystyle{ \vec{a} = \lt 3, -2, 4\gt }[/math] [math]\displaystyle{ \vec{b} = \lt -1, 6, 3\gt }[/math]

Find [math]\displaystyle{ \vec{a} \times \vec{b} }[/math].

To use this trick, section out the vectors in this order like so:

[math]\displaystyle{ \begin{vmatrix} a_x \\ a_y \\ a_z \\ a_x \end{vmatrix} }[/math] [math]\displaystyle{ \times }[/math] [math]\displaystyle{ \begin{vmatrix} b_x \\ b_y \\ b_z \\ b_x \end{vmatrix} }[/math] [math]\displaystyle{ = }[/math] [math]\displaystyle{ \begin{vmatrix} c_x \\ c_y \\ c_z \end{vmatrix} }[/math]

[math]\displaystyle{ \begin{vmatrix} 3 \\ -2 \\ 4 \\ 3 \end{vmatrix} }[/math] [math]\displaystyle{ \times }[/math] [math]\displaystyle{ \begin{vmatrix} -1 \\ 6 \\ 3 \\ -1 \end{vmatrix} }[/math] [math]\displaystyle{ = }[/math] [math]\displaystyle{ \begin{vmatrix} c_x \\ c_y \\ c_z \end{vmatrix} }[/math]

Now to solve for the cross product.

For [math]\displaystyle{ c_x }[/math], draw an X that connects [math]\displaystyle{ a_y }[/math] to [math]\displaystyle{ b_z }[/math] and [math]\displaystyle{ a_z }[/math] to [math]\displaystyle{ b_y }[/math].

Now to calculate [math]\displaystyle{ c_x }[/math], multiply the values of the first line of the X and multiply the values of the second line of the X.

Then subtract both those values to calculate [math]\displaystyle{ c_x }[/math].

A mathematical form of this would look like this:

[math]\displaystyle{ c_x = a_y*b_z - a_z*b_y }[/math]

[math]\displaystyle{ c_x = -2*3 - 4*6 = -6 - 24 }[/math]

[math]\displaystyle{ c_x = -30 }[/math]

For [math]\displaystyle{ c_y }[/math], do the same thing except draw an X that connects [math]\displaystyle{ a_z }[/math] to the bottom [math]\displaystyle{ b_x }[/math] and the bottom [math]\displaystyle{ a_x }[/math] to [math]\displaystyle{ b_z }[/math].

Then do the same concept as [math]\displaystyle{ c_x }[/math]:

[math]\displaystyle{ c_y = a_z*b_x - a_x*b_z }[/math]

[math]\displaystyle{ c_y = 4*-1 - 3*3 = -4 - 9 }[/math]

[math]\displaystyle{ c_y = -13 }[/math]

Then for [math]\displaystyle{ c_z }[/math], do the same thing by drawing an X that connects [math]\displaystyle{ a_x }[/math] to [math]\displaystyle{ b_y }[/math] and [math]\displaystyle{ a_y }[/math] to [math]\displaystyle{ b_x }[/math].

Then do the same concept as [math]\displaystyle{ c_x }[/math]:

[math]\displaystyle{ c_z = a_x*b_y - a_y*b_x }[/math]

[math]\displaystyle{ c_z = 3*6 - -2*-1 = 18 - 2 }[/math]

[math]\displaystyle{ c_z = 16 }[/math]

Now the cross product has been finished with the answer that [math]\displaystyle{ \vec{a} \times \vec{b} = \lt -30, -13, 16\gt }[/math].

As this trick is practiced extensively, the following can be done to make calculations must faster:

- Skipping the drawing of the X as practitioners will know what values to multiply and subtract.

- Removing the 4th vector x value on the bottom of the visual representation.

## Equations Involving Vector Operations

Sometimes, you might encounter formulas or situations where vector-specific operations, such as a dot product or a cross product, are combined in some way. In this case, it can help to remember these two facts:

- [math]\displaystyle{ (w⨯v)•v=0 }[/math], because the vector produced by the cross product is orthogonal to both [math]\displaystyle{ w }[/math] and [math]\displaystyle{ v }[/math], and therefore that vector dotted with either of the original two vectors will always equal zero.
- [math]\displaystyle{ a•(b⨯c)=(a⨯b)•c }[/math]. This property can be useful in situations where computing [math]\displaystyle{ a⨯b }[/math] is easier than computing [math]\displaystyle{ b⨯c }[/math]. Note that the order of the vectors still matters here in the cross products, but that the dot product commutes.

## Forms

The information necessary to describe a specific vector can be presented in several forms.

### Magnitude and Direction Form

In this form, the magnitude and the direction of the vector are explicitly stated. The statement describing direction might be a cardinal direction (ex. "North"), a direction on a graph (ex. "the +x direction"), or an angle (ex. "210[math]\displaystyle{ ^\circ }[/math] from the x axis counterclockwise"), depending on the situation. Magnitude and direction form is often used in word problems because it is easy to understand. This also makes it easier to measure vectors in real world applications. When building structures, it is much easier to say that you want a 5 foot plank of wood 60[math]\displaystyle{ ^\circ }[/math] off of the ground.

### Component Form

In this form, the vector is divided into components, each representing a different coordinate direction. In 2D space, these are the x and y directions. In 3D space, these are the x, y, and z directions. Each component tells how much the vector extends in that particular direction. Often, the three components are written enclosed by angle brackets and separated by commas. For example, the vector [math]\displaystyle{ \lt 2,0,-3\gt }[/math] describes a vector that extends 2 units in the [math]\displaystyle{ \hat{+x} }[/math] direction, 0 units in the [math]\displaystyle{ \hat{y} }[/math] direction, and 3 units in the [math]\displaystyle{ \hat{-z} }[/math] direction. Most vector operations described above can only be performed if the vectors are in component form, so this form may be necessary to do math for certain problems. Additionally, it is important to note that programming languages store vectors in component form.

### Unit Vector Form

In this form, the vector is expressed as a sum of unit vectors, each corresponding to a different coordinate direction. The symbols [math]\displaystyle{ \hat{i} }[/math], [math]\displaystyle{ \hat{j} }[/math], and [math]\displaystyle{ \hat{k} }[/math] OR the symbols [math]\displaystyle{ \hat{x} }[/math], [math]\displaystyle{ \hat{y} }[/math], and [math]\displaystyle{ \hat{z} }[/math] are used to represent unit vectors in the x, y, and z directions respectively. Consider the vector <2,0,-3>. It can be expressed in unit vector form as [math]\displaystyle{ 2\hat{i} - 3\hat{k} }[/math], meaning 2 times the x direction unit vector minus 3 times the z direction unit vector. While often considered its own form, unit vector form is very similar to component form, as the information describing the vector is stored in the same values. All references to component form in the rest of this page also apply to unit vector form.

Note that regardless of which form is used, an n-dimensional vector requires n values to mathematically describe. For example, consider a 3-dimensional vector. Describing this vector in component form requires an x value, a y value, and a z value. Describing it in magnitude and direction form requires one value to give the magnitude of the vector and two to give the its direction. The direction of a 3D vector could be described using, say, its polar angle [math]\displaystyle{ \theta }[/math] and its azimuthal angle [math]\displaystyle{ \phi }[/math]. A 1-dimensional vector, such as the velocity of a particle whose movement is constrained to the x axis, can be described using only 1 value whose sign indicates the vector's direction.

### Converting Between Forms

It is possible to convert vectors from one form to another using simple trigonometry.

To find the magnitude of a vector in component form, use the Pythagorean theorem: add the squares of the components and take the square root of the result. For a 2D vector, [math]\displaystyle{ |\vec{a}| = \sqrt{a_x^2 + a_y^2} }[/math].

To find the direction of a vector in component form, use inverse trigonometric functions. For a 2D vector, [math]\displaystyle{ \theta = \tan^{-1}(\frac{a_y}{a_x}) }[/math], where [math]\displaystyle{ \theta }[/math] is the angle vector [math]\displaystyle{ \vec{a} }[/math] makes with the x axis in the counterclockwise direction.

To find the components of a vector in magnitude and direction form, use trigonometric functions. For a 2D vector, [math]\displaystyle{ a_x = |\vec{a}|\cos\theta }[/math] and [math]\displaystyle{ a_y = |\vec{a}|\sin\theta }[/math], where [math]\displaystyle{ \theta }[/math] is the angle vector [math]\displaystyle{ \vec{a} }[/math] makes with the x axis in the counterclockwise direction.

## Vectors in VPython

The construction for a vector object is the word `vec`

or `vector`

and it takes three arguments, which define its x, y and z components respectively.

The following is an example of a vector instantiation:

`velocity = vec(3,-1,2)`

In this example, a vector named `velocity`

is created with an x value of 3, y value of -1, and z value of 2.

In VPython, vector objects are in component form; each one has an x, y, and z component. Recall that in VPython, using the default camera orientation, the +x axis points to the right, the +y axis points upwards, and the +z axis points out of the plane of the screen towards the viewer.

### Modifying Vectors

To access or modify a specific component of a vector object, its name should be followed by a period and an x, y, or z. For example, to change the x component of the above velocity vector from 3 to 5, the following line might be used:

`velocity.x = 5`

### Helpful Vector Functions

#### Magnitude

To calculate the magnitude of a vector, the `mag`

function is used. The `mag`

function takes in one argument of a vector.

**Example Usage**

velocity = vec(3, -1, 2) speed = mag(velocity) # use mag to calculate the magnitude of the velocity vector

### Normalize

To normalize a vector or calculate the unit vector, the `norm`

function is used. The `norm`

function takes in one argument of a vector.

**Example Usage**

v = vec(5, 0, 0) v_hat = norm(v) # normalize v -> v_hat = <1, 0, 0>

### Dot and Cross Prodcut

To get the dot product of two vectors, the `dot`

function is used.
To get the cross product of two vectors, the `cross`

function is used.

Both functions take in two arguments that are both vectors.

**Example Usage**

a = vec(1, 2, 3) b = vec(4, 5, 6) dot_prod = dot(a, b) # get the dot product a * b cross_prod = cross(a, b) # get the cross product a x b

### Visualization

To visualize vectors in VPython, the `arrow`

object is used.

To initialize an arrow, a position vector and a direction vector must be passed. There are optional parameters to increase the size and shape of the arrow: - shaftwidth - headwidth - headlength

Attributes of the arrow can also be changed, such as color. Read more here.

For example, this is how a velocity vector is visualized with an arrow at the origin:

velocity = vec(1,1,0) # velocity vector (required parameter) origin = vec(0, 0, 0) # position vector for the origin (required parameter) shaftwidth = 0.1 # optional parameter vel_arrow = arrow(pos=origin, axis=velocity, shaftwidth=shaftwidth, color=color.red) # create visualization of arrow

*Output in VPython of Visualized Vector*

## A Computational Model

Click Here to run the interactive computational model This computational model breaks each vector operation down. It begins with defining the vector, and then goes into different vector operations. These operations are broken into both their written formula and the Glowscript shortcut function. Play around with the numbers and vector definitions to see what happens! It begins by defining the vectors as arrows, and that's all you need to play around with the different functions! You may also want to comment out some of the sections, so you can see how each function works individually.

## Examples

### Very Simple

Vector [math]\displaystyle{ \vec{a} }[/math] is <2.5, 7.4, 8.0>. What is the magnitude and direction of Vector A?

Solution:

First, we must find the magnitude.

[math]\displaystyle{ |\lt 2.5, 7.4, 8.0\gt | = \sqrt{2.5^2 + 7.4^2 + 8.0^2} }[/math]

[math]\displaystyle{ = \sqrt{6.25 + 54.76 + 64} }[/math]

[math]\displaystyle{ = \sqrt{125.01} }[/math]

[math]\displaystyle{ = 11.18 }[/math]

Now, we must find the direction by finding the unit vector.

[math]\displaystyle{ unit vector = \vec{a} / mag(a) }[/math]

[math]\displaystyle{ x = 2.5/11.18 = .224 }[/math]

[math]\displaystyle{ y = 7.4 / 11.18 = .662 }[/math]

[math]\displaystyle{ z = 8.0 / 11.18 = .716 }[/math]

[math]\displaystyle{ direction = \lt .224, .662, .716\gt }[/math]

### Simple

Vector [math]\displaystyle{ \vec{a} }[/math] is <2,4,2>. Vector [math]\displaystyle{ \vec{b} }[/math] is <-1,1,3>. What is the magnitude of the vector [math]\displaystyle{ \vec{a} - 2\vec{b} }[/math]?

Solution:

[math]\displaystyle{ \vec{a} - 2\vec{b} = \lt 2,4,2\gt - 2 * \lt -1,1,3\gt }[/math]

[math]\displaystyle{ = \lt 2,4,2\gt - \lt -2,2,6\gt }[/math]

[math]\displaystyle{ = \lt 4,2,-4\gt }[/math]

We are asked to find the magnitude of this vector, so let us use the Pythagorean theorem with its components:

[math]\displaystyle{ |\lt 4,2,-4\gt | = \sqrt{4^2 + 2^2 + (-4)^2} }[/math]

[math]\displaystyle{ = \sqrt{16 + 4 + 16} }[/math]

[math]\displaystyle{ = \sqrt{36} }[/math]

[math]\displaystyle{ = 6 }[/math]

### Intermediate

An airplane is travelling in still air at 240m/s in the direction 35[math]\displaystyle{ ^\circ }[/math] south of west. A wind begins to blow; the wind has a speed of 80m/s in the direction 15[math]\displaystyle{ ^\circ }[/math] east of north. What should be the new velocity of the plane relative to the air around it to maintain its original trajectory? You may give your answer in component form (+x is east, +y is north).

Solution:

The vector sum of the new velocity of the plane [math]\displaystyle{ \vec{v_{p,1}} }[/math] and the velocity of the wind [math]\displaystyle{ \vec{v_w} }[/math] should equal the original velocity of the plane [math]\displaystyle{ \vec{v_{p,0}} }[/math] (see Relative Velocity):

[math]\displaystyle{ \vec{v_{p,1}} + \vec{v_w} = \vec{v_{p,0}} }[/math]

[math]\displaystyle{ \vec{v_{p,1}} = \vec{v_{p,0}} - \vec{v_w} }[/math]

Let us convert the given vectors to component form for easier subtraction. The +x and +y directions will be east and north respectively.

[math]\displaystyle{ \vec{v_{p,0}} = \lt 240\cos(215^\circ), 240\sin(215^\circ)\gt }[/math]m/s (35[math]\displaystyle{ ^\circ }[/math] south of west is 215[math]\displaystyle{ ^\circ }[/math] above the x axis)

[math]\displaystyle{ \vec{v_{p,0}} = \lt -196.6, -137.7\gt }[/math]m/s

[math]\displaystyle{ \vec{v_w} = \lt 80\cos(75^\circ), 80\sin(75^\circ)\gt }[/math]m/s (15[math]\displaystyle{ ^\circ }[/math] east of north is 75[math]\displaystyle{ ^\circ }[/math] above the x axis)

[math]\displaystyle{ \vec{v_w} = \lt 20.7, 77.3\gt }[/math]m/s

Now let us subtract:

[math]\displaystyle{ \vec{v_{p,1}} = \vec{v_{p,0}} - \vec{v_w} }[/math]

[math]\displaystyle{ \vec{v_{p,1}} = \lt -196.6, -137.7\gt - \lt 20.7, 77.3\gt }[/math]m/s

[math]\displaystyle{ \vec{v_{p,1}} = \lt -217.3, -214.9\gt }[/math]m/s

### Difficult

What is the angle between the vectors <2,5,-2> and <3,-4,-1>?

Solution:

The dot product between two vectors is equal to the product of their magnitudes times the cosine of the angle between them. Let us use this property to find the angle between the given vectors.

[math]\displaystyle{ \lt 2,5,-2\gt \cdot \lt 3,-4,-1\gt = |\lt 2,5,-2\gt | * |\lt 3,-4,-1\gt | * \cos\theta }[/math]

Rearranging this yields

[math]\displaystyle{ \theta = \cos^{-1}\frac{\lt 2,5,-2\gt \cdot \lt 3,-4,-1\gt }{|\lt 2,5,-2\gt | * |\lt 3,-4,-1\gt |} }[/math]

Let us evaluate the dot product and simplify:

[math]\displaystyle{ \theta = \cos^{-1}\frac{2(3) + 5(-4) + (-2)(-1)}{\sqrt{2^2 + 5^2 + (-2)^2} * \sqrt{3^2 + (-4)^2 + (-1)^2}} }[/math]

[math]\displaystyle{ \theta = \cos^{-1}\frac{-12}{\sqrt{33 * 26}} }[/math]

[math]\displaystyle{ \theta = 114^\circ }[/math]

## Connectedness

Vectors play a part in almost every part of our lives. For example, the desk you are probably sitting at was built by using vectors. A force vector is used to represent things like the force of gravity (0, mg, 0), to represent how the pieces within the desk are exerting forces on each other, and a vector to represent the force of the floor on the desk. This just scratches the surface of the vectors that can represent a desk. Any measurement taken, for example the diagonal across the desk, can be represented as a vector.

Another example of vectors in everyday life is how they can represent how we move. Your position can be represented as a vector relative to any other spot in the universe. To find your relative position vector, you take your position vector and subtract the other vector from it. Velocity can also be represented in vector form. When you move, you have a certain velocity in each direction, so it can be represented in vector form. This can also be found by taking the derivative of the position vector with respect to time. The velocity vector can also be integrated to find the position vector. The magnitude of the velocity vector is equivalent to the speed that one is travelling. Acceleration can be represented by taking the derivative of the velocity vector. Each of these vectors can be broken into their components to be able to see how you are traveling in each direction.

Vectors are a very important part of most Physics 2 material. Nearly every quantity we are looking for is represented as a vector. Electric field, Magnetic field, all of the forces, and many other things. For example, the Magnetic Force on a point particle is represented as follows:

[math]\displaystyle{ {\vec{F} = q\vec{v}\times\vec{B}} }[/math]

This uses both the cross products of 2 vectors and multiplying that cross product, a vector, by a scalar. Vector knowledge is very important in Physics 2, as it is the basis for nearly everything we do.

Most scientific disciplines don't rely as heavily on vector forms as Physics. Because Physics is so focused on the motion of different things (people, particles, objects), vectors are an integral part of Physics. Even planets move according to patterns described by vectors. Every physical quantity, no matter how big or small, can be represented in vector form.

## History

It is unknown who first developed the idea of vectors, but the oldest known reference to vectors is in the work *Mechanics* by Hero of Alexandria in the first century AD, which described their addition. At this point, however, the idea of a vector was little more than a line segment with a specific orientation. They had a length extending from one point in physical space to another but were not used to represent anything else.

In the early 19th century, several mathematicians and physicists including Caspar Wessel (1745-1818), Jean Robert Argand (1768-1822), Carl Friedrich Gauss (1777-1855), and William Rowan Hamilton (1805-1865) used 2D vectors to represent complex numbers. One component would represent the real value and another would represent the imaginary value. Hamilton would also become the first to use the word "vector." August Ferdinand Möbius (1790-1868) contributed to vector math in his 1827 book *The Barycentric Calculus*, in which he developed the convention of labeling vectors with letters and defined the multiplication of a vector by a scalar. Hermann Grassmann (1809-1877) wrote in his 1844 book *Ausdehnungslehre*, German for "The Calculus of Extension", that vectors could exist in the space of any number of dimensions and described much of what would become linear algebra, which makes ample use of vectors.

The modern language and conventions surrounding vectors come largely from notes created by J. Willard Gibbs (1839-1903), a professor at Yale University, and Oliver Heaviside (1850-1925), a significant English Physicist. They used their development of how vectors are modernly used to demonstrate the laws of electromagnetism discovered by James Clerk Maxwell.

## See Also

### External Links

Mathematical Computations on Vectors: [http://ocw.mit.edu/courses/mathematics/18-02sc-multivariable-calculus-fall-2010/1.-vectors-and-matrices/part-a-vectors-determinants-and-planes/session-1-vectors/MIT18_02SC_notes_0.pdf

Computational Work with Vectors: http://vpython.org/contents/docs/vector.html

Basics of Vectors: https://www.physics.uoguelph.ca/tutorials/vectors/vectors.html

### Further Reading

Vector Analysis by Josiah Willard Gibbs

Introduction to Matrices and Vectors by Jacob T. Schwartz

## References

https://mathinsight.org/definition/magnitude_vector

https://www.mathsisfun.com/algebra/vectors.html

http://mathinsight.org/vector_introduction

http://www.math.mcgill.ca/labute/courses/133f03/VectorHistory.html

https://www.glowscript.org/docs/VPythonDocs/vector.html