Vectors: Difference between revisions

From Physics Book
Jump to navigation Jump to search
No edit summary
 
(235 intermediate revisions by 14 users not shown)
Line 1: Line 1:
This page defines and describes vectors.
'''Aditya Verma – Fall 2025'''


==The Main Idea==
==Vectors and Units Introduction==


In mathematics and physics, a vector is a quantity with both a magnitude and a direction in space. The magnitude of a vector is a scalar value which 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. The direction of a vector is simply an orientation in space giving context to the magnitude. 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 at no position in particular.
Vectors and units are core tools for describing the physical world in a precise, quantitative way. A vector is a quantity that has both **magnitude** (how big) and **direction** (which way). Many important physical quantities are vectors: displacement, velocity, acceleration, and force all need both size and direction to be completely specified. By representing these quantities as vectors, we can keep track of how they combine, cancel, and interact in one, two, or three dimensions.
 
Units, meanwhile, tell us **what** we are measuring. A number by itself has no physical meaning until we attach a unit such as meters (m), seconds (s), or newtons (N). Consistent use of units helps us spot mistakes, compare results, and communicate clearly. Together, vectors and units allow scientists, engineers, and programmers to build models that match real-world behavior and to carry out calculations that remain physically meaningful.
 
In physics and engineering, vectors show up whenever we track motion, balance forces, or work with fields such as electric and magnetic fields. In computer science and related fields, vectors appear in computer graphics, simulations, game physics, machine learning, and data representation. Units ensure that all of these computations line up with real measurements rather than just abstract numbers. A strong grasp of both vectors and units is essential for solving problems, interpreting formulas, and understanding how different parts of a system relate to each other.
 
Vectors are usually written using boldface letters or an arrow, such as '''v''' or <math>\vec{v}</math>. You may also see a vector written as a directed segment like <math>\overrightarrow{AB}</math>. Common vector quantities include displacement, velocity, force, and acceleration. Units provide the scale for these quantities and are based on standard systems like SI. For example, meters (m) measure length, kilograms (kg) measure mass, seconds (s) measure time, and newtons (N) measure force.
 
[[File:2d3dvec.png|2D vector vs 3D vector]][[File:smallvector.png]]
 
==Unit Vector==
 
A **unit vector** is a vector whose magnitude is exactly 1 (one unit) but that still points in a particular direction. Unit vectors are useful for representing direction independently of size. They are often used to define coordinate directions (such as the x, y, and z axes) and to rewrite any vector as “magnitude × direction.
 
[[File:unitvecexp.png]]
 
==Magnitude==
 
The **magnitude** of a vector is the length or size of the vector. For a vector <math>\vec{v}</math>, the magnitude is written as <math>|\vec{v}|</math>. Magnitude is always a non-negative scalar. In 2D and 3D, it is usually computed with the Pythagorean theorem, using the vector’s components.
 
[[File:vec3.png]]
 
==Direction==
 
The **direction** of a vector describes how it is oriented in space. It can be specified relative to axes (such as the angle from the positive x-axis), using unit vectors, or using geometric descriptions (like “30° above the horizontal” or “to the south”).
 
[[File:directionvec.png]]
[[File:vec10.png]]
 
==Addition and Subtraction==
 
Vectors can be added or subtracted to form new vectors. Geometrically, we often use the **head-to-tail method** or the **parallelogram rule**. In component form, vector addition and subtraction are done by adding or subtracting corresponding components.
 
[[File:vec4.png]]
 
==Scalar Multiplication==
 
**Scalar multiplication** means multiplying a vector by a scalar (a regular number). This produces a new vector in the same or opposite direction, but with its magnitude scaled by the scalar. This is used to stretch, shrink, or reverse vectors in many physical and mathematical problems.
 
[[File:vec5.png]]
 
==Dot Product==
 
The **dot product** (or scalar product) of two vectors produces a scalar. It can be written in terms of components or in terms of magnitudes and the cosine of the angle between the vectors. Dot products are used to find angles between vectors, project one vector onto another, and calculate physical quantities such as work.
 
[[File:vec7.png]]
 
==Cross Product==
 
The **cross product** (or vector product) of two vectors in 3D produces a new vector that is perpendicular to both original vectors. Its magnitude equals the product of the magnitudes of the two vectors times the sine of the angle between them. Cross products appear in torque, angular momentum, and magnetic force, among other topics in rotational and field-based physics.
 
[[File:vec8.png]]
 
For two vectors <math>\vec{A}</math> and <math>\vec{B}</math>, the magnitude of the cross product is
<math>|\vec{A}\times\vec{B}| = |\vec{A}|\;|\vec{B}|\sin(\theta)</math>, 
where <math>\theta</math> is the angle between them. The direction follows the **right-hand rule**.
 
Some useful properties of the cross product:
 
* It is **not commutative**: <math>\vec{A}\times\vec{B} \neq \vec{B}\times\vec{A}</math>. In fact, <math>\vec{A}\times\vec{B} = -(\vec{B}\times\vec{A})</math>.
* It is **distributive** over addition: <math>\vec{A}\times(\vec{B} + \vec{C}) = \vec{A}\times\vec{B} + \vec{A}\times\vec{C}</math>.
* The cross product of a vector with itself is zero: <math>\vec{A}\times\vec{A} = \vec{0}</math>, since the angle between a vector and itself is 0 and <math>\sin(0) = 0</math>.
 
==SI Units==
 
The **International System of Units (SI)** is the main measurement system used in science and engineering. It specifies seven base units from which all other units are built:
 
* meter (m) – length 
* kilogram (kg) – mass 
* second (s) – time 
* ampere (A) – electric current 
* kelvin (K) – temperature 
* mole (mol) – amount of substance 
* candela (cd) – luminous intensity 
 
All physical vector quantities you encounter in this class will use combinations of these units.
 
[[File:vec11.png]]
 
==Derived Units==
 
**Derived units** are units formed by combining base units through multiplication and division. For example:
 
* newton (N) = kg·m/s<sup>2</sup> (force) 
* joule (J) = N·m (energy) 
* watt (W) = J/s (power) 
 
These units describe more complex physical quantities but are always traceable back to the SI base units.
 
==Conversion==
 
**Unit conversion** means changing a quantity from one set of units to another while representing the same physical amount. For example, converting from centimeters to meters or from kilometers per hour to meters per second. In multi-step physics problems, careful unit conversion is essential to avoid errors and to match the units expected in formulas.
 
==Applications==
 
Vectors and units appear in many areas:
 
* **Physics:** describing motion, forces, fields (electric, magnetic, gravitational), and momentum. 
* **Engineering:** analyzing structures, designing mechanical systems, working with fluid flow, and modeling electrical circuits. 
* **Computer Graphics:** representing positions, directions, lighting, and transformations in 2D and 3D scenes. 
* **Navigation:** expressing position, velocity, and direction in GPS systems and for aircraft or ships.
 
Understanding how vectors and units work together lets us build accurate models and interpret real-world data correctly.
 
_________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
 
==What is a Vector?==
 
In mathematics and physics, a **vector** is a quantity that has both a magnitude and a direction.
 
In coordinates, we often write a vector as a list of components. For example, in a 3D coordinate system, we might write:
<math>\vec{v} = \langle v_x, v_y, v_z \rangle</math> 
 
Here:
 
* <math>v_x</math> is the x-component of the vector, 
* <math>v_y</math> is the y-component, 
* <math>v_z</math> is the z-component.
 
A vector can also be written as a boldface letter, such as '''a''', or with an arrow, like <math>\vec{a}</math>. The specific letter used often reflects the quantity: <math>\vec{v}</math> for velocity, <math>\vec{r}</math> for position, etc. Individual components of a vector are written with subscripts, such as <math>c_x</math> or <math>q_y</math>.
 
====Example of a Simple Vector====
 
<math>\vec{v} = \langle 1, 0, 0 \rangle</math>
 
This vector has magnitude 1 and points along the positive x-direction in 3D space.
 
===Magnitude===
 
The **magnitude** (or length) of a vector tells us how large the vector is.
 
We denote the magnitude of <math>\vec{v}</math> using vertical bars:
<math>|\vec{v}|</math>. You might also see notations such as <math>\overline{v}</math> or <math>\lVert\vec{v}\rVert_2</math> (the Euclidean norm).
 
In a 3D system, if
<math>\vec{v} = \langle v_x, v_y, v_z \rangle</math>, 
then its magnitude is
 
<math>\lVert \vec{v} \rVert = \sqrt{v_x^2 + v_y^2 + v_z^2}.</math>
 
More generally, in n dimensions,
<math>\lVert \vec{v} \rVert = \sqrt{v_1^2 + v_2^2 + \cdots + v_n^2}.</math>
 
The magnitude carries the units of the quantity being represented. For example, the magnitude of a velocity vector is speed and has units of m/s.
 
Note that a vector does not always represent a literal “arrow in space” between two locations. Often, a vector describes a property at a single point (like electric field at a location) or in an abstract space, even though the mathematics is the same.
 
[[File:IMG_0325613.jpg|400px|Image: 400 pixels]]
 
====Unit Vector====
 
If we divide a nonzero vector by its magnitude, we obtain a **unit vector** in the same direction:
 
<math>\hat{v} = \frac{\vec{v}}{\lVert \vec{v} \rVert}</math>.
 
For example, if <math>\vec{v} = \langle v_x, v_y, v_z \rangle</math>, then
 
<math>\hat{v} = \frac{1}{\lVert\vec{v}\rVert}\langle v_x, v_y, v_z \rangle.</math>
 
Unit vectors are written with a “hat,” such as <math>\hat{v}</math>. In many coordinate systems, there are standard unit vectors. In 3D Cartesian coordinates, the unit vectors along the axes are
 
<math>\hat{x} = \langle 1, 0, 0 \rangle, \quad \hat{y} = \langle 0, 1, 0 \rangle, \quad \hat{z} = \langle 0, 0, 1 \rangle.</math>
 
Other coordinate systems use different unit vectors, like <math>\hat{r}</math> and <math>\hat{\theta}</math> in polar coordinates.
 
===Direction===
 
The **direction** of a vector tells us which way it points.
 
In 2D, we usually measure direction by an angle from the positive x-axis. For a vector <math>\vec{v} = \langle v_x, v_y \rangle</math>, the direction angle <math>\theta</math> can be computed as
 
<math>\theta = \arctan\left(\frac{v_y}{v_x}\right)</math>,
 
keeping track of the correct quadrant.


===Simple Examples of Vector Quantities===
===Simple Examples of Vector Quantities===


To understand what it means for a vector to have both a magnitude and a direction, and to understand why the magnitude and direction together are often considered a single quantity, it can be helpful to consider an example. The [[Velocity]] of an object is an example of a vector quantity. The speed of the 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. Another example of a vector is position; the distance of a point from the origin of a coordinate system can be represented as the magnitude of a vector, and this distance together with a direction describes exactly where a point can be found.
====Position====
 
A point’s position can be written as a vector. If we have two position vectors, subtracting them gives the **relative position** from one point to the other. The magnitude of this relative position vector gives the straight-line distance between the two points. A common special case is the position relative to the origin, where the origin is at <math>\langle 0,0,0\rangle</math>.


===Unit Vectors===
====Velocity====


A unit vector is a vector whose magnitude is 1 by design.
**Velocity** is a vector that describes how fast and in what direction an object moves. Its magnitude is the **speed**, and it is usually measured in m/s. The velocity vector can be found by differentiating the position vector with respect to time.


Some unit vectors are normalized regular vectors. For example, <math>\hat{r}</math> is the normalized version of some vector <math>\vec{r}</math>. Normalization is the process of setting a vector's magnitude to 1. This is done to discard information about the vector's magnitude while retaining information about its direction. To normalize a vector, the following formula can be used: <math>\hat{a} = \frac{\vec{a}}{|\vec{a}|}</math>
For example, let <math>\vec{r}(t) = \langle t, 1, 0 \rangle\ \text{m}</math>. Then the velocity is


Certain letters represent specific unit vectors. For example, <math>\hat{i}</math>, <math>\hat{j}</math>, and <math>\hat{k}</math> (alternatively, <math>\hat{x}</math>, <math>\hat{y}</math>, and <math>\hat{z}</math>) are unit vectors pointing in the +x, +y, and +z directions respectively. Non-Cartesian coordinate systems often have their own unit vectors; for example, 2D polar coordinates make use of the <math>\hat{r}</math> and <math>\hat{\theta}</math> unit vectors.
<math>\vec{v}(t) = \frac{d\vec{r}}{dt} = \langle 1, 0, 0 \rangle\ \text{m/s}.</math>


===Notation===
The speed is the magnitude of <math>\vec{v}</math>, which in this case is 1 m/s.


A variable representing a vector is typically written as a letter with an arrow over it: <math>\vec{a}</math>. The arrow may one-sided to make it easier to write. Alternatively, a vector variable might simply be written as a boldface letter: <b>a</b>. Which letter is used depends on the context; for example, <math>\vec{v}</math> represents velocity.
[[File:Velwiki.png]]


Surrounding a vector by | symbols denotes its magnitude: <math>|\vec{b}|</math>.
====Weight (Force of Gravity)====


A specific component of a vector (see the section titled "forms") is denoted by a subscript: c<sub>x</sub>. For example, q<sub>y</sub> represents the y component of some vector <math>\vec{q}</math>.
Weight is the gravitational force acting on an object; it is a vector that typically points downward. We often write the gravitational force as <math>\vec{F_g}</math>. In a coordinate system where +y is upward, we can write:


A unit vector is denoted by a letter with a ^ symbol (called a "hat") written over it: <math>\hat{d}</math> (read as "d-hat").
<math>\vec{F_g} = \langle 0, -mg, 0 \rangle,</math>
 
where <math>m</math> is the mass of the object and <math>g = 9.8~\text{m/s}^2</math> is the magnitude of the gravitational field near Earth’s surface. The magnitude <math>|\vec{F_g}| = mg</math> is the weight of the object.


===Visually Representing Vectors===
===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 (the end without the V shape) should be placed at that point.
Vectors are often drawn as **arrows**. The length of the arrow represents the magnitude, and the direction of the arrow shows which way the vector points. If a vector is tied to a particular location, the tail of the arrow is drawn 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 5m/s.
The example below shows a velocity vector for a ball moving to the right at 5 m/s.


[[File:Vectorvisualrepresentation.png]]
[[File:Vectorvisualrepresentation.png]]


===Forms===
==Vector Operations==


The information necessary to describe a specific vector can be presented in several forms.
We can perform several operations on vectors, both with other vectors and with scalars. These operations are used constantly in physics and engineering. To keep the notation simple, we will describe them for 3D vectors, but they generalize naturally to higher dimensions.


'''Magnitude and direction form'''
===Addition===


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>^\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 for humans to understand.
For vectors <math>\vec{a} = \langle a_x, a_y, a_z \rangle</math> and <math>\vec{b} = \langle b_x, b_y, b_z \rangle</math>,


'''Component form'''
<math>\vec{a} + \vec{b} = \langle a_x + b_x,\; a_y + b_y,\; a_z + b_z \rangle.</math>


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 <2,0,-3> describes a vector that extends 2 units in the +x direction, 0 units in the y direction, and 3 units in the -z direction. Most vector operations described below can only be performed if the vectors are in component form, so this form may be necessary to do math for certain problems. Furthermore, programming languages store vectors in component form.
Geometrically, we place the tail of <math>\vec{b}</math> at the head of <math>\vec{a}</math>. The vector from the tail of <math>\vec{a}</math> to the head of <math>\vec{b}</math> is the **resultant** <math>\vec{a} + \vec{b}</math>.


'''Unit vector form'''
[[File:Vectoraddition.png|600px]]
 
In this form, the vector is expressed as a sum of unit vectors, each corresponding to a different coordinate direction. The symbols <math>\hat{i}</math>, <math>\hat{j}</math>, and <math>\hat{k}</math> OR the symbols <math>\hat{x}</math>, <math>\hat{y}</math>, and <math>\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>2\hat{i} - 3\hat{k}</math>, meaning 2 times the x direction unit vector minus 3 times the z direction unit vector (see vector operations). 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.
 
[[File:Vectorsdifferentforms.png]]


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>\theta</math> and its azimuthal angle <math>\phi</math>).
===Subtraction===


'''Converting between forms'''
Vector subtraction can be viewed as adding the negative of a vector. We have


It is possible to convert vectors from one form to another using simple trigonometry.
<math>\vec{a} - \vec{b} = \vec{a} + (-\vec{b}) = \langle a_x - b_x,\; a_y - b_y,\; a_z - b_z \rangle.</math>


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>|\vec{a}| = \sqrt{a_x^2 + a_y^2}</math>.
Component-wise, we subtract each component of <math>\vec{b}</math> from the corresponding component of <math>\vec{a}</math>.


To find the direction of a vector in component form, use inverse trigonometric functions. For a 2D vector, <math>\theta = \tan^{-1}(\frac{a_y}{a_x})</math>, where <math>\theta</math> is the angle vector <math>\vec{a}</math> makes with the x axis in the counterclockwise direction.
[[File:IMG_0326.jpg|500px|Image: 500 pixels]]


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


===Vector Operations===
If <math>k</math> is a scalar and <math>\vec{a} = \langle a_x, a_y, a_z \rangle</math>, then


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.
<math>k \vec{a} = \langle k a_x,\; k a_y,\; k a_z \rangle.</math>


'''Addition:'''
Multiplying by a positive scalar changes the magnitude but keeps the direction the same. Multiplying by a negative scalar flips the direction as well.


<math>\vec{a} + \vec{b} = (a_x + b_x)\hat{i} + (a_y + b_y)\hat{j} + (a_z + b_z)\hat{k}</math>.
[[File:Vectorscalarmultiplication.png|400px]]                          [[File:IMG_0327.jpg|400px|Image: 400 pixels]]


In other words, to add two vectors, simply add their like components to form the new components. The new vector is called the resultant of the other two. Visually, if the tail of one vector is placed at the tip of another, their resultant will extend from the tail of the second vector to the tip of the first:
===Division by Scalar===


[[File:Vectoraddition.png|600px]]
Dividing a vector by a nonzero scalar is equivalent to multiplying by its reciprocal:


'''Subtraction:'''
<math>\frac{\vec{a}}{k} = \langle \frac{a_x}{k},\; \frac{a_y}{k},\; \frac{a_z}{k} \rangle.</math>


<math>\vec{a} - \vec{b} = (a_x - b_x)\hat{i} + (a_y - b_y)\hat{j} + (a_z - b_z)\hat{k}</math>.
This operation shrinks or enlarges the vector’s magnitude while preserving (or reversing, if k is negative) its direction.


In other words, to subtract two vectors, simply subtract their like components to form the new components.
===Dot Product (also called Scalar Product)===


'''Multiplication by scalar:'''
For <math>\vec{a} = \langle a_x, a_y, a_z \rangle</math> and <math>\vec{b} = \langle b_x, b_y, b_z \rangle</math>, the dot product is


<math>k \vec{a} = ka_x\hat{i} + ka_y\hat{j} + ka_z\hat{k}</math>.
<math>\vec{a}\cdot\vec{b} = a_x b_x + a_y b_y + a_z b_z.</math>


In other words, multiplying a vector by a scalar multiplies each of that vector's components by that scalar. Multiplying a vector by a scalar multiplies its magnitude by that scalar and does not affect its direction, unless the scalar is negative, in which case the direction of the vector is reversed.
The result is a scalar. The dot product measures how much two vectors “line up” with each other. A key property is


'''Division by scalar:'''
<math>\vec{a}\cdot\vec{b} = |\vec{a}|\;|\vec{b}|\cos(\theta),</math>


<math>\frac{\vec{a}}{k} = \frac{a_x}{k}\hat{i} + \frac{a_y}{k}\hat{j} + \frac{a_z}{k}\hat{k}</math>.
where <math>\theta</math> is the angle between <math>\vec{a}</math> and <math>\vec{b}</math>. If the dot product is zero, the vectors are perpendicular.


In other words, dividing a vector by a scalar divides each of that vector's components by that scalar. Dividing a vector by a scalar divides its magnitude by that scalar and does not affect its direction, unless the scalar is negative, in which case the direction of the vector is reversed.
[[File:IMG_0328.jpg|400px|Image: 400 pixels]]


'''Dot product (also called scalar product):'''
===Cross Product (also called Vector Product)===


<math>\vec{a}\cdot\vec{b} = a_xb_x + a_yb_y + a_zb_z</math>.
One component-based definition of the cross product (the one often found on formula sheets) is:


In other words, the dot product of two vectors is the sum of the products of their like components. Note that this is a scalar value.
<math>\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.</math>


It is important to note that the dot product of two vectors has a specific value: <math>\vec{a}\cdot\vec{b} = |\vec{a}||\vec{b}|\cos\theta</math>, where <math>\theta</math> is the angle between the vectors.
You may also see it written as


'''Cross product (also called vector product):'''
<math>\vec{a} \times \vec{b} = (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>


<math>\vec{a}\times\vec{b} = (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>.
Although this looks complicated, the key idea is that the cross product of two 3D vectors is a new vector that is orthogonal to both of them. The order matters: changing the order flips the sign.


This is equivalent to the following matrix determinant, which may be easier to remember:
A common way to remember the formula is through the determinant of a 3×3 matrix:


<math>\begin{vmatrix}
<math>\begin{vmatrix}
Line 113: Line 286:
a_x & a_y & a_z \\
a_x & a_y & a_z \\
b_x & b_y & b_z
b_x & b_y & b_z
\end{vmatrix}</math>
\end{vmatrix}.</math>
 
You can expand this determinant using cofactor expansion. Remember that the <math>\hat{j}</math> term has a minus sign.
 
[[File:Expansionbyminors.png|400px]]
 
You can also use online tools or videos to check your work:
 
* Cross product step-by-step calculator: [https://www.symbolab.com/solver/vector-cross-product-calculator  https://www.symbolab.com/solver/vector-cross-product-calculator] 
* Video explanation: [https://www.youtube.com/watch?v=e9T5p_Jwv5c https://www.youtube.com/watch?v=e9T5p_Jwv5c]
 
The magnitude of the cross product satisfies
 
<math>|\vec{a}\times\vec{b}| = |\vec{a}|\;|\vec{b}|\sin(\theta)</math>,
 
where <math>\theta</math> is the angle between <math>\vec{a}</math> and <math>\vec{b}</math>. Its direction is perpendicular to the plane of <math>\vec{a}</math> and <math>\vec{b}</math> and is chosen using the [[Right Hand Rule]]. In 2D, the usual cross product is not defined.
 
<b>For more mathematically-advanced students</b>, we can connect this to linear algebra. Let <math>A \in \mathbb{R}^{m \times n}</math> be a matrix, and consider its **null space**:
 
<math>\operatorname{Null}(A) = \{ \vec{v} \in \mathbb{R}^n \mid A\vec{v} = \vec{0} \}.</math>
 
The null space is the set of all vectors that are orthogonal to every row of <math>A</math>. Writing the rows as <math>\vec{a}_1,\ldots,\vec{a}_m</math>, the equation <math>A\vec{v}=\vec{0}</math> expands to
 
<math>\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 \\ \vdots \\ 0\end{bmatrix}.</math>
 
So every vector in the null space is perpendicular to each row, and therefore to the whole row space.
 
For two vectors <math>\vec{a}, \vec{b} \in \mathbb{R}^3</math> that are not multiples of each other, think of them as the rows of a 2×3 matrix <math>A</math>. The null space of <math>A</math> consists of all vectors orthogonal to both <math>\vec{a}</math> and <math>\vec{b}</math>. The cross product <math>\vec{a}\times\vec{b}</math> is (up to scaling and orientation) the unique nonzero vector in this null space once we fix the magnitude and choose a direction using the right-hand rule. This is another way to see why the cross product is perpendicular to both original vectors. In higher dimensions, the null space can have more than one dimension, so there isn’t a single unique “cross product direction” in the same way.
 
====Another Cross Product Trick====
 
Here is a pattern-based way to compute the cross product quickly, using components.
 
Suppose
 
<math>\vec{a} = \langle 3, -2, 4 \rangle, \quad \vec{b} = \langle -1, 6, 3 \rangle.</math>
 
We want <math>\vec{c} = \vec{a} \times \vec{b} = \langle c_x, c_y, c_z \rangle.</math>
 
Arrange the components vertically and repeat the first component at the bottom:
 
<math>\begin{vmatrix}
a_x \\
a_y \\
a_z \\
a_x
\end{vmatrix}
=
\begin{vmatrix}
3 \\
-2 \\
4 \\
3
\end{vmatrix}</math>,
<math>\begin{vmatrix}
b_x \\
b_y \\
b_z \\
b_x
\end{vmatrix}
=
\begin{vmatrix}
-1 \\
6 \\
3 \\
-1
\end{vmatrix}</math>.
 
To find <math>c_x</math>, draw an “X” connecting <math>a_y</math> with <math>b_z</math> and <math>a_z</math> with <math>b_y</math>:
 
[[File:Cx.png]]
 
Then compute
 
<math>c_x = a_y b_z - a_z b_y = (-2)(3) - (4)(6) = -6 - 24 = -30.</math>
 
For <math>c_y</math>, use <math>a_z</math> with the bottom <math>b_x</math> and the bottom <math>a_x</math> with <math>b_z</math>:
 
[[File:Cy.png]]
 
So
 
<math>c_y = a_z b_x - a_x b_z = (4)(-1) - (3)(3) = -4 - 9 = -13.</math>
 
For <math>c_z</math>, connect <math>a_x</math> with <math>b_y</math> and <math>a_y</math> with <math>b_x</math>:
 
[[File:Cz.png]]
 
Then
 
<math>c_z = a_x b_y - a_y b_x = (3)(6) - (-2)(-1) = 18 - 2 = 16.</math>
 
Thus
 
<math>\vec{a}\times\vec{b} = \langle -30, -13, 16 \rangle.</math>
 
With practice, you may not need to draw the X each time and can compute the components directly from the pattern.
 
==Equations Involving Vector Operations==
 
You may sometimes encounter equations that mix dot products and cross products. Two useful facts:
 
<ol>
<li><math>(\vec{w} \times \vec{v}) \cdot \vec{v} = 0</math>, because <math>\vec{w} \times \vec{v}</math> is perpendicular to both <math>\vec{w}</math> and <math>\vec{v}</math>, so its dot product with either original vector is zero.</li>
<li><math>\vec{a} \cdot (\vec{b} \times \vec{c}) = (\vec{a} \times \vec{b}) \cdot \vec{c}</math>. This identity, called the scalar triple product identity, can be useful if one cross product is easier to compute than the other. Note that the cross product part is still order-sensitive, while the dot product is commutative.</li>
</ol>
 
==Forms==
 
There are several common ways to describe a vector, all containing the same information.
 
===Magnitude and Direction Form===
 
In this form, we specify:
 
* The magnitude (length), and 
* A description of the direction (cardinal direction, angle, or axis).
 
For example, “a 5 m vector at 60° above the horizontal” is in magnitude and direction form. This form is intuitive and often used in word problems and real-life descriptions.
 
===Component Form===
 
Here, we break the vector into components along the coordinate axes. In 3D, a vector is written as
 
<math>\langle a_x, a_y, a_z \rangle.</math>
 
For example, <math>\langle 2, 0, -3 \rangle</math> means the vector extends 2 units in +x, 0 units in y, and 3 units in -z. Most algebraic operations (like dot and cross products) are done using component form. Programming languages also typically store vectors in this way.
 
===Unit Vector Form===
 
In unit vector form, we write a vector as a combination of unit vectors:
 
<math>\hat{i}</math>, <math>\hat{j}</math>, <math>\hat{k}</math> or <math>\hat{x}</math>, <math>\hat{y}</math>, <math>\hat{z}</math>.
 
For instance, the vector <math>\langle 2, 0, -3 \rangle</math> can be written as
 
<math>2\hat{i} - 3\hat{k}.</math>
 
Unit vector form and component form contain the same numerical information; they just use different notation.
 
[[File:Vectorsdifferentforms.png]]
 
In n dimensions, a vector always needs n numbers to describe it fully. In 3D, magnitude–direction form uses 1 number for magnitude and 2 angles for direction, while component or unit-vector form uses 3 components.
 
===Converting Between Forms===
 
We can move between forms using trigonometry and the Pythagorean theorem.
 
* For a 2D vector <math>\vec{a} = \langle a_x, a_y \rangle</math>, the magnitude is
  <math>|\vec{a}| = \sqrt{a_x^2 + a_y^2}.</math>
 
* The direction angle from the positive x-axis is
  <math>\theta = \tan^{-1}\left(\frac{a_y}{a_x}\right)</math> (with quadrant checks).
 
* Given magnitude <math>|\vec{a}|</math> and angle <math>\theta</math>, the components are
  <math>a_x = |\vec{a}|\cos\theta</math>,
  <math>a_y = |\vec{a}|\sin\theta</math>.
 
==Vectors in VPython==
 
In VPython (used in GlowScript), vectors are represented by the type <code>vec</code> or <code>vector</code>. The constructor takes three arguments: the x, y, and z components.
 
Example:
 
<code>velocity = vec(3, -1, 2)</code>
 
This creates a vector called <code>velocity</code> with components (3, -1, 2).
 
In VPython’s default view, +x points to the right, +y points upward, and +z points out of the screen toward the viewer.
 
===Modifying Vectors===
 
You can access or modify individual components using <code>.x</code>, <code>.y</code>, and <code>.z</code>. For example:
 
<code>velocity.x = 5</code>
 
changes the x-component from 3 to 5.
 
===Helpful Vector Functions===
 
====Magnitude====
 
VPython provides the <code>mag</code> function to compute the magnitude of a vector:


Note that this is a vector quantity. It is important to note that the magnitude of the cross product of two vectors has a specific value: <math>|\vec{a}\times\vec{b}| = |\vec{a}||\vec{b}|\sin\theta</math>, where <math>\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 (where the associative property is defined), and distributive over addition; cross product multiplication is not associative and is anticommutative (<math>\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.
<code>
velocity = vec(3, -1, 2)
speed = mag(velocity) # magnitude of velocity
</code>


'''Transformations'''
====Normalize====


A variety of transformations are defined for vectors, including multiplication by matrices and projection onto spaces. These transformations use a combination of the six basic operations above to manipulate vectors in more complex ways. These transformations lie outside of the scope of this page and this course due to their complexity and irrelevance to introductory physics.
To obtain a unit vector in the same direction (normalize a vector), use <code>norm</code>:


===A Computational Model===
<code>
v = vec(5, 0, 0)
v_hat = norm(v)  # v_hat = <1, 0, 0>
</code>


====Dot and Cross Product====


[[File:glowscript_ide11.jpg|200px|thumb|left|Vectors in GlowScript]]
The functions <code>dot</code> and <code>cross</code> compute dot and cross products:


VIDLE is an interactive editor for VPython, a programming language that is commonly used in Physics to create 3D displays and animations. It is also used to perform iterative calculations using fundamental principles. Codes on VIDLE are instructions for a computer to follow to make these calculations.
<code>
a = vec(1, 2, 3)
b = vec(4, 5, 6)
dot_prod = dot(a, b)      # a · b
cross_prod = cross(a, b)  # a × b
</code>


===Visualization===


In VIDLE code, arrow objects usually represent vector components. Arrows can be defined by their position, axis, and color. Each part can be manipulated to achieve different results. The position and axis of arrows are vectors, so they can be scaled by multiplying by a scalar. Arrows are often used to represent relative position vectors, starting at position A and ending at position B or by finding the "final minus initial" (B-A) position vector. In the image, the relative position vector is of the tennis ball with respect to the baseball, so the arrow points from the baseball to the tennis ball. If a relative position vector is in the 3D-plane, three further arrows can be used to denote the x, y, and z components. The ''z'' component vector is referenced using the formula ''vectorname.z''.
To visualize vectors, VPython provides the <code>arrow</code> object. You specify:


* <code>pos</code> – tail position, 
* <code>axis</code> – direction and length of the arrow (a vector).


In Physics 2, you will learn that a vector always starts at a source and points to the observation location at which physical quantities such as the electric or magnetic fields need to be found. Furthermore, it is important to be able to calculate the magnitude and direction of a vector in 3D space. [https://trinket.io/embed/glowscript/e17d933a59?outputOnly=true Here] is an example of a VPython model that computationally calculates such values. The green arrow represents the position vector which starts from a proton (red ball) to the arbitrary observation location. Click 'Run' on the upper-left corner in order to display the model.
Optional parameters include <code>shaftwidth</code>, <code>headwidth</code>, and <code>headlength</code>. You can also change attributes like <code>color</code>. See more details [https://www.glowscript.org/docs/VPythonDocs/arrow.html here].


Example of a velocity vector arrow at the origin:


<code>
velocity = vec(1, 1, 0)
origin = vec(0, 0, 0)
shaftwidth = 0.1
vel_arrow = arrow(pos=origin, axis=velocity,
                  shaftwidth=shaftwidth, color=color.red)
</code>


[[File:Arrow_viz.png]]
''Output in VPython of Visualized Vector''


--[[User:Htaghian3|Htaghian3]] ([[User talk:Htaghian3|talk]]) 01:54, 16 September 2018 (EDT)
==A Computational Model==
 
[https://trinket.io/glowscript/3d7c75ed91 Click here to run the interactive computational model.]
 
This model walks through basic vector operations step by step. It starts by defining vectors as arrows, then explores:
 
* Addition and subtraction 
* Scalar multiplication 
* Magnitude and unit vectors 
* Dot and cross products 
 
Each operation is shown both in formula form and using VPython shortcut functions. You can edit the vector values and rerun the code to see how the results change. Commenting out parts of the script can help you focus on one type of operation at a time.


==Examples==
==Examples==
===Very Simple===
Vector <math>\vec{a} = \langle 2.5, 7.4, 8.0 \rangle</math>. Find its magnitude and a unit vector in its direction.
**Solution:**
First, find the magnitude:
<math>|\vec{a}| = \sqrt{2.5^2 + 7.4^2 + 8.0^2}</math>
<math>= \sqrt{6.25 + 54.76 + 64}</math>
<math>= \sqrt{125.01} \approx 11.18.</math>
Now form the unit vector:
<math>\hat{a} = \frac{\vec{a}}{|\vec{a}|} = \left\langle \frac{2.5}{11.18}, \frac{7.4}{11.18}, \frac{8.0}{11.18} \right\rangle \approx \langle 0.224, 0.662, 0.716 \rangle.</math>
So the magnitude is about 11.18, and the direction can be described by the unit vector <math>\langle 0.224, 0.662, 0.716 \rangle</math>.


===Simple===
===Simple===
Which of the following statements is correct? (Can be more than one)


[[File:simproblem.jpg|275px|thumb|center]]
Let <math>\vec{a} = \langle 2, 4, 2 \rangle</math> and <math>\vec{b} = \langle -1, 1, 3 \rangle</math>. Find the magnitude of <math>\vec{a} - 2\vec{b}</math>.


**Solution:**


1. <math>\overrightarrow{c} = \overrightarrow{a} + \overrightarrow{b}</math>
Compute the combination:


2. <math>\overrightarrow{a} = \overrightarrow{b} - \overrightarrow{c}</math>
<math>\vec{a} - 2\vec{b} = \langle 2, 4, 2 \rangle - 2\langle -1, 1, 3 \rangle</math>


3. <math>\overrightarrow{a} = \overrightarrow{c} + \overrightarrow{b}</math>
<math>= \langle 2, 4, 2 \rangle - \langle -2, 2, 6 \rangle</math>


4. <math>\overrightarrow{b} = \overrightarrow{c} + \overrightarrow{a}</math>
<math>= \langle 4, 2, -4 \rangle.</math>


Now find the magnitude:


The answer is option number 2 and option number 4.
<math>|\langle 4, 2, -4 \rangle| = \sqrt{4^2 + 2^2 + (-4)^2} = \sqrt{16 + 4 + 16} = \sqrt{36} = 6.</math>


===Intermediate===
===Intermediate===
1. What is the magnitude of the vector C = A - B if A = <10, 5, 8> and B = <9, 4, 3>?


First we need to find the vector C:
An airplane is flying in still air at 240 m/s, 35° south of west. A wind blows at 80 m/s, 15° east of north. What must the plane’s new velocity relative to the air be in order to keep the same overall trajectory? Give your answer in components (with +x east and +y north).
A - B = <math> <(10-9), (5-4), (8-3)> = <1, 1, 5> = C</math>
 
[[File:Vectorsplaneproblem.png]]
 
**Solution:**
 
Let
 
* <math>\vec{v_{p,0}}</math> = original velocity of the plane (relative to air),
* <math>\vec{v_w}</math> = wind velocity (relative to ground),
* <math>\vec{v_{p,1}}</math> = new plane velocity (relative to air).
 
We want the **resultant ground velocity** of the plane to stay equal to <math>\vec{v_{p,0}}</math>. The velocity relative to the ground is
 
<math>\vec{v_{p,1}} + \vec{v_w}.</math>
 
So we require
 
<math>\vec{v_{p,1}} + \vec{v_w} = \vec{v_{p,0}}</math> 
<math>\Rightarrow \vec{v_{p,1}} = \vec{v_{p,0}} - \vec{v_w}.</math>
 
Express everything in components:
 
Take +x as east and +y as north.
 
35° south of west corresponds to 215° from the +x-axis:
 
<math>\vec{v_{p,0}} = \langle 240\cos(215^\circ),\; 240\sin(215^\circ) \rangle \approx \langle -196.6,\; -137.7 \rangle\ \text{m/s}.</math>


<math>\sqrt{(1)^2 + 1^2 + 5^2} = 5.196</math>
15° east of north corresponds to 75° from the +x-axis:


2. What is the cross product of A = <1,2,3> and B = <9,4,5>?
<math>\vec{v_w} = \langle 80\cos(75^\circ),\; 80\sin(75^\circ) \rangle \approx \langle 20.7,\; 77.3 \rangle\ \text{m/s}.</math>
Use the equation for cross product: a x b= <a1, a2, a3> x <b1, b2, b3> = <a2*b3 - a3*b2> i - <a1*b3 - a3*b1> j + <a1*b2 - a2*b1> k


A x B<math>=<2*5 - 3*4, 1*5 - 3*9, 1*4 - 2*9> = <-2, -22, -14></math>
Now subtract:
 
<math>\vec{v_{p,1}} = \vec{v_{p,0}} - \vec{v_w} = \langle -196.6, -137.7 \rangle - \langle 20.7, 77.3 \rangle</math>
 
<math>= \langle -217.3,\; -214.9 \rangle\ \text{m/s}.</math>
 
So the plane must adjust its airspeed to approximately <math>\langle -217.3,\; -214.9 \rangle</math> m/s relative to the air to keep its original track.


===Difficult===
===Difficult===
What is the unit vector in the direction of the vector <10, 5, 8>?
First you have to find the magnitude of the vector given:
<math>\sqrt{10^2 + (5)^2 + 8^2} = 13.74</math>


Finally divide the vector by its magnitude to get the unit vector:
Find the angle between the vectors <math>\langle 2, 5, -2 \rangle</math> and <math>\langle 3, -4, -1 \rangle</math>.
 
**Solution:**
 
Use the dot product formula:
 
<math>\vec{a}\cdot\vec{b} = |\vec{a}|\;|\vec{b}|\cos\theta.</math>
 
So
 
<math>\theta = \cos^{-1}\left(\frac{\vec{a}\cdot\vec{b}}{|\vec{a}|\;|\vec{b}|}\right).</math>
 
Compute the numerator:
 
<math>\vec{a}\cdot\vec{b} = 2(3) + 5(-4) + (-2)(-1) = 6 - 20 + 2 = -12.</math>
 
Compute the magnitudes:
 
<math>|\vec{a}| = \sqrt{2^2 + 5^2 + (-2)^2} = \sqrt{4 + 25 + 4} = \sqrt{33},</math>
 
<math>|\vec{b}| = \sqrt{3^2 + (-4)^2 + (-1)^2} = \sqrt{9 + 16 + 1} = \sqrt{26}.</math>


<math>\tfrac{<10, 5, 8>}{13.74}</math>
So


= <.727, .364, .582>
<math>\theta = \cos^{-1}\left(\frac{-12}{\sqrt{33}\sqrt{26}}\right) = \cos^{-1}\left(\frac{-12}{\sqrt{858}}\right) \approx 114^\circ.</math>
Notice that the magnitude of the unit vector is equal to 1


==Connectedness==
==Connectedness==
1.Vectors will be used in many applications in most calculation based fields when movement and position are involved. Vectors can be two dimensional or three dimensional. Vectors are used to represent forces, fields, and momentum.


2.Vectors has been used in many application problems in engineering majors. In engineering applications, vectors are used to a lot of quantities which have both magnitude and direction. Dividing a magnitude into vector quantities in the x,y, and z directions clarify which components of a vector have quantity. For example, in Biomedical Engineering applications, vectors are used to represent the velocity of a flow to further calculate the flow rate and some other related quantities.
Vectors appear in many everyday and engineering contexts.


3. Vectors play a huge part in industry. For example, in process flow, vectors play a huge part in most calculations. For example, many calculations in different fields of science and math use vector components and direction. Our car's GPS uses vectors even if we don't realize it!
Consider a desk. Its weight is a force vector pointing downward, the normal force from the floor is a vector pointing upward, and the forces among the desk’s parts can all be represented as vectors. Measurements such as the diagonal distance across the desktop can also be seen as vectors from one corner to another.
 
Your motion can be described using vectors as well. Your **position** relative to some reference point can be written as a position vector. The difference between two position vectors is a displacement vector. **Velocity** describes how your position changes over time; it is the time derivative of the position vector, and its magnitude is your speed. **Acceleration** is the time derivative of velocity. All of these quantities can be broken into components, which makes it easier to analyze motion in each direction separately.
 
In Physics 2 and beyond, vectors are everywhere. The electric field, magnetic field, many forces, and other quantities are all vector fields. For example, the magnetic force on a charged particle is
 
<math>\vec{F} = q\;\vec{v} \times \vec{B},</math>
 
which combines a cross product of two vectors and a scalar multiplication.
 
Even outside physics, vectors are central. In engineering, they are used for stress analysis, fluid flow, and control systems. In computer science, vectors appear in graphics, simulations, robotics, and machine learning (where data points are often vectors in high-dimensional spaces). Virtually any physical or abstract quantity that has both “how much” and “which way” can be modeled as a vector.


==History==
==History==
The discovery and use of vectors can date back to the ancient philosophers, Aristotle and Heron. The theory can also be found in the first article of Newtons Principia Mathematica. In the early 19th century Caspar Wessel, Jean Robert Argand, Carl Friedrich Gauss, and a few more depicted and worked with complex numbers as points on a 2D plane. in 1827, August Ferdinand published a book introducing line segments labelled with letters. he wrote about vectors without the name "vector".


In 1835, Giusto Bellavitis abstracted the basic idea of a vector while establishing the concept of equipollence. He called any pair of line segments of the same length and orientation equipollent (meaning equal length). He found a relationship and created the first set of vectors.  
Ideas similar to vectors go back many centuries. Early uses treated them as directed line segments rather than abstract quantities. Hero of Alexandria’s work <i>Mechanics</i> in the first century AD contains one of the earliest known discussions of adding such directed segments.
Also in 1835 Hamilton founded "quaternions", which were 4D planes and equations with vectors.
 
In the 18th and 19th centuries, several mathematicians used 2D vectors to represent complex numbers. Caspar Wessel, Jean-Robert Argand, Carl Friedrich Gauss, and William Rowan Hamilton all contributed to this viewpoint. One component represented the real part, and the other represented the imaginary part. Hamilton also introduced the term “vector.
 
August Ferdinand Möbius, in his 1827 book <i>The Barycentric Calculus</i>, formalized many vector ideas, including labeling vectors with letters and defining scalar multiplication. Hermann Grassmann, in his 1844 work <i>Ausdehnungslehre</i> (“The Calculus of Extension”), developed a more general theory of vectors in spaces of arbitrary dimension and laid foundations for linear algebra.


William Rowan Hamilton devised the name "vector" as part of his system of quaternions consisting of three dimensional vectors.  
The modern vector notation and conventions used in physics owe a lot to J. Willard Gibbs and Oliver Heaviside in the late 19th century. They refined vector methods and used them to express Maxwell’s equations of electromagnetism in the compact form we study today.


Several other mathematicians developed similar vector systems to those of Bellavitis and Hamilton in the 19th century. The system used by Herman Grassman is the one that is most similar to the one used today.
==See Also==


VPython was released by David Scherer in the year 2000. He came up with the idea after taking a physics class at Carnegie Mellon University. Previous programs only allowed for 2D modeling, so he took it upon himself to make something better. VPython, also known as Visual Python, allows for 3D modeling.
===External Links===
== See also ==


===External links===
Mathematical computations on vectors (MIT OCW notes):
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 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]
[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:
Computational work with vectors in VPython:
[http://vpython.org/contents/docs/vector.html]
[http://vpython.org/contents/docs/vector.html http://vpython.org/contents/docs/vector.html]


Basics of Vectors:
Basic vector introduction:
[https://www.physics.uoguelph.ca/tutorials/vectors/vectors.html]
[https://www.physics.uoguelph.ca/tutorials/vectors/vectors.html https://www.physics.uoguelph.ca/tutorials/vectors/vectors.html]


===Further Reading===
===Further Reading===


Vector Analysis by Josiah Willard Gibbs
* *Vector Analysis* – Josiah Willard Gibbs
 
* *Introduction to Matrices and Vectors* – Jacob T. Schwartz
Introduction to Matrices and Vectors by Jacob T. Schwartz


==References==
==References==
[https://www.mathsisfun.com/algebra/vectors.html https://www.mathsisfun.com/algebra/vectors.html]
[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 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 ]
[http://mathinsight.org/vector_introduction]


[[Category:Which Category did you place this in?]]
[https://mathinsight.org/definition/magnitude_vector https://mathinsight.org/definition/magnitude_vector] 
[https://www.mathsisfun.com/algebra/vectors.html https://www.mathsisfun.com/algebra/vectors.html] 
[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 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] 
[http://mathinsight.org/vector_introduction http://mathinsight.org/vector_introduction]
[http://www.math.mcgill.ca/labute/courses/133f03/VectorHistory.html http://www.math.mcgill.ca/labute/courses/133f03/VectorHistory.html] 
[https://www.glowscript.org/docs/VPythonDocs/vector.html https://www.glowscript.org/docs/VPythonDocs/vector.html] 
[https://www.glowscript.org/docs/VPythonDocs/arrow.html https://www.glowscript.org/docs/VPythonDocs/arrow.html] 
[https://www.britannica.com/science/vector-mathematics https://www.britannica.com/science/vector-mathematics] 
[https://www.grc.nasa.gov/www/k-12/rocket/vectcomp.html https://www.grc.nasa.gov/www/k-12/rocket/vectcomp.html] 
[https://www.onlinemathlearning.com/dot-product.html https://www.onlinemathlearning.com/dot-product.html]


[https://hijabersea.com/posts/intro-to-glowscript.html]
[[Category: Geometry]]

Latest revision as of 22:52, 2 December 2025

Aditya Verma – Fall 2025

Vectors and Units Introduction

Vectors and units are core tools for describing the physical world in a precise, quantitative way. A vector is a quantity that has both **magnitude** (how big) and **direction** (which way). Many important physical quantities are vectors: displacement, velocity, acceleration, and force all need both size and direction to be completely specified. By representing these quantities as vectors, we can keep track of how they combine, cancel, and interact in one, two, or three dimensions.

Units, meanwhile, tell us **what** we are measuring. A number by itself has no physical meaning until we attach a unit such as meters (m), seconds (s), or newtons (N). Consistent use of units helps us spot mistakes, compare results, and communicate clearly. Together, vectors and units allow scientists, engineers, and programmers to build models that match real-world behavior and to carry out calculations that remain physically meaningful.

In physics and engineering, vectors show up whenever we track motion, balance forces, or work with fields such as electric and magnetic fields. In computer science and related fields, vectors appear in computer graphics, simulations, game physics, machine learning, and data representation. Units ensure that all of these computations line up with real measurements rather than just abstract numbers. A strong grasp of both vectors and units is essential for solving problems, interpreting formulas, and understanding how different parts of a system relate to each other.

Vectors are usually written using boldface letters or an arrow, such as v or [math]\displaystyle{ \vec{v} }[/math]. You may also see a vector written as a directed segment like [math]\displaystyle{ \overrightarrow{AB} }[/math]. Common vector quantities include displacement, velocity, force, and acceleration. Units provide the scale for these quantities and are based on standard systems like SI. For example, meters (m) measure length, kilograms (kg) measure mass, seconds (s) measure time, and newtons (N) measure force.

2D vector vs 3D vector

Unit Vector

A **unit vector** is a vector whose magnitude is exactly 1 (one unit) but that still points in a particular direction. Unit vectors are useful for representing direction independently of size. They are often used to define coordinate directions (such as the x, y, and z axes) and to rewrite any vector as “magnitude × direction.”

Magnitude

The **magnitude** of a vector is the length or size of the vector. For a vector [math]\displaystyle{ \vec{v} }[/math], the magnitude is written as [math]\displaystyle{ |\vec{v}| }[/math]. Magnitude is always a non-negative scalar. In 2D and 3D, it is usually computed with the Pythagorean theorem, using the vector’s components.

Direction

The **direction** of a vector describes how it is oriented in space. It can be specified relative to axes (such as the angle from the positive x-axis), using unit vectors, or using geometric descriptions (like “30° above the horizontal” or “to the south”).

Addition and Subtraction

Vectors can be added or subtracted to form new vectors. Geometrically, we often use the **head-to-tail method** or the **parallelogram rule**. In component form, vector addition and subtraction are done by adding or subtracting corresponding components.

Scalar Multiplication

    • Scalar multiplication** means multiplying a vector by a scalar (a regular number). This produces a new vector in the same or opposite direction, but with its magnitude scaled by the scalar. This is used to stretch, shrink, or reverse vectors in many physical and mathematical problems.

Dot Product

The **dot product** (or scalar product) of two vectors produces a scalar. It can be written in terms of components or in terms of magnitudes and the cosine of the angle between the vectors. Dot products are used to find angles between vectors, project one vector onto another, and calculate physical quantities such as work.

Cross Product

The **cross product** (or vector product) of two vectors in 3D produces a new vector that is perpendicular to both original vectors. Its magnitude equals the product of the magnitudes of the two vectors times the sine of the angle between them. Cross products appear in torque, angular momentum, and magnetic force, among other topics in rotational and field-based physics.

For two vectors [math]\displaystyle{ \vec{A} }[/math] and [math]\displaystyle{ \vec{B} }[/math], the magnitude of the cross product is [math]\displaystyle{ |\vec{A}\times\vec{B}| = |\vec{A}|\;|\vec{B}|\sin(\theta) }[/math], where [math]\displaystyle{ \theta }[/math] is the angle between them. The direction follows the **right-hand rule**.

Some useful properties of the cross product:

  • It is **not commutative**: [math]\displaystyle{ \vec{A}\times\vec{B} \neq \vec{B}\times\vec{A} }[/math]. In fact, [math]\displaystyle{ \vec{A}\times\vec{B} = -(\vec{B}\times\vec{A}) }[/math].
  • It is **distributive** over addition: [math]\displaystyle{ \vec{A}\times(\vec{B} + \vec{C}) = \vec{A}\times\vec{B} + \vec{A}\times\vec{C} }[/math].
  • The cross product of a vector with itself is zero: [math]\displaystyle{ \vec{A}\times\vec{A} = \vec{0} }[/math], since the angle between a vector and itself is 0 and [math]\displaystyle{ \sin(0) = 0 }[/math].

SI Units

The **International System of Units (SI)** is the main measurement system used in science and engineering. It specifies seven base units from which all other units are built:

  • meter (m) – length
  • kilogram (kg) – mass
  • second (s) – time
  • ampere (A) – electric current
  • kelvin (K) – temperature
  • mole (mol) – amount of substance
  • candela (cd) – luminous intensity

All physical vector quantities you encounter in this class will use combinations of these units.

Derived Units

    • Derived units** are units formed by combining base units through multiplication and division. For example:
  • newton (N) = kg·m/s2 (force)
  • joule (J) = N·m (energy)
  • watt (W) = J/s (power)

These units describe more complex physical quantities but are always traceable back to the SI base units.

Conversion

    • Unit conversion** means changing a quantity from one set of units to another while representing the same physical amount. For example, converting from centimeters to meters or from kilometers per hour to meters per second. In multi-step physics problems, careful unit conversion is essential to avoid errors and to match the units expected in formulas.

Applications

Vectors and units appear in many areas:

  • **Physics:** describing motion, forces, fields (electric, magnetic, gravitational), and momentum.
  • **Engineering:** analyzing structures, designing mechanical systems, working with fluid flow, and modeling electrical circuits.
  • **Computer Graphics:** representing positions, directions, lighting, and transformations in 2D and 3D scenes.
  • **Navigation:** expressing position, velocity, and direction in GPS systems and for aircraft or ships.

Understanding how vectors and units work together lets us build accurate models and interpret real-world data correctly.

_________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________

What is a Vector?

In mathematics and physics, a **vector** is a quantity that has both a magnitude and a direction.

In coordinates, we often write a vector as a list of components. For example, in a 3D coordinate system, we might write: [math]\displaystyle{ \vec{v} = \langle v_x, v_y, v_z \rangle }[/math]

Here:

  • [math]\displaystyle{ v_x }[/math] is the x-component of the vector,
  • [math]\displaystyle{ v_y }[/math] is the y-component,
  • [math]\displaystyle{ v_z }[/math] is the z-component.

A vector can also be written as a boldface letter, such as a, or with an arrow, like [math]\displaystyle{ \vec{a} }[/math]. The specific letter used often reflects the quantity: [math]\displaystyle{ \vec{v} }[/math] for velocity, [math]\displaystyle{ \vec{r} }[/math] for position, etc. Individual components of a vector are written with subscripts, such as [math]\displaystyle{ c_x }[/math] or [math]\displaystyle{ q_y }[/math].

Example of a Simple Vector

[math]\displaystyle{ \vec{v} = \langle 1, 0, 0 \rangle }[/math]

This vector has magnitude 1 and points along the positive x-direction in 3D space.

Magnitude

The **magnitude** (or length) of a vector tells us how large the vector is.

We denote the magnitude of [math]\displaystyle{ \vec{v} }[/math] using vertical bars: [math]\displaystyle{ |\vec{v}| }[/math]. You might also see notations such as [math]\displaystyle{ \overline{v} }[/math] or [math]\displaystyle{ \lVert\vec{v}\rVert_2 }[/math] (the Euclidean norm).

In a 3D system, if [math]\displaystyle{ \vec{v} = \langle v_x, v_y, v_z \rangle }[/math], then its magnitude is

[math]\displaystyle{ \lVert \vec{v} \rVert = \sqrt{v_x^2 + v_y^2 + v_z^2}. }[/math]

More generally, in n dimensions, [math]\displaystyle{ \lVert \vec{v} \rVert = \sqrt{v_1^2 + v_2^2 + \cdots + v_n^2}. }[/math]

The magnitude carries the units of the quantity being represented. For example, the magnitude of a velocity vector is speed and has units of m/s.

Note that a vector does not always represent a literal “arrow in space” between two locations. Often, a vector describes a property at a single point (like electric field at a location) or in an abstract space, even though the mathematics is the same.

Image: 400 pixels

Unit Vector

If we divide a nonzero vector by its magnitude, we obtain a **unit vector** in the same direction:

[math]\displaystyle{ \hat{v} = \frac{\vec{v}}{\lVert \vec{v} \rVert} }[/math].

For example, if [math]\displaystyle{ \vec{v} = \langle v_x, v_y, v_z \rangle }[/math], then

[math]\displaystyle{ \hat{v} = \frac{1}{\lVert\vec{v}\rVert}\langle v_x, v_y, v_z \rangle. }[/math]

Unit vectors are written with a “hat,” such as [math]\displaystyle{ \hat{v} }[/math]. In many coordinate systems, there are standard unit vectors. In 3D Cartesian coordinates, the unit vectors along the axes are

[math]\displaystyle{ \hat{x} = \langle 1, 0, 0 \rangle, \quad \hat{y} = \langle 0, 1, 0 \rangle, \quad \hat{z} = \langle 0, 0, 1 \rangle. }[/math]

Other coordinate systems use different unit vectors, like [math]\displaystyle{ \hat{r} }[/math] and [math]\displaystyle{ \hat{\theta} }[/math] in polar coordinates.

Direction

The **direction** of a vector tells us which way it points.

In 2D, we usually measure direction by an angle from the positive x-axis. For a vector [math]\displaystyle{ \vec{v} = \langle v_x, v_y \rangle }[/math], the direction angle [math]\displaystyle{ \theta }[/math] can be computed as

[math]\displaystyle{ \theta = \arctan\left(\frac{v_y}{v_x}\right) }[/math],

keeping track of the correct quadrant.

Simple Examples of Vector Quantities

Position

A point’s position can be written as a vector. If we have two position vectors, subtracting them gives the **relative position** from one point to the other. The magnitude of this relative position vector gives the straight-line distance between the two points. A common special case is the position relative to the origin, where the origin is at [math]\displaystyle{ \langle 0,0,0\rangle }[/math].

Velocity

    • Velocity** is a vector that describes how fast and in what direction an object moves. Its magnitude is the **speed**, and it is usually measured in m/s. The velocity vector can be found by differentiating the position vector with respect to time.

For example, let [math]\displaystyle{ \vec{r}(t) = \langle t, 1, 0 \rangle\ \text{m} }[/math]. Then the velocity is

[math]\displaystyle{ \vec{v}(t) = \frac{d\vec{r}}{dt} = \langle 1, 0, 0 \rangle\ \text{m/s}. }[/math]

The speed is the magnitude of [math]\displaystyle{ \vec{v} }[/math], which in this case is 1 m/s.

Weight (Force of Gravity)

Weight is the gravitational force acting on an object; it is a vector that typically points downward. We often write the gravitational force as [math]\displaystyle{ \vec{F_g} }[/math]. In a coordinate system where +y is upward, we can write:

[math]\displaystyle{ \vec{F_g} = \langle 0, -mg, 0 \rangle, }[/math]

where [math]\displaystyle{ m }[/math] is the mass of the object and [math]\displaystyle{ g = 9.8~\text{m/s}^2 }[/math] is the magnitude of the gravitational field near Earth’s surface. The magnitude [math]\displaystyle{ |\vec{F_g}| = mg }[/math] is the weight of the object.

Visually Representing Vectors

Vectors are often drawn as **arrows**. The length of the arrow represents the magnitude, and the direction of the arrow shows which way the vector points. If a vector is tied to a particular location, the tail of the arrow is drawn at that point.

The example below shows a velocity vector for a ball moving to the right at 5 m/s.

Vector Operations

We can perform several operations on vectors, both with other vectors and with scalars. These operations are used constantly in physics and engineering. To keep the notation simple, we will describe them for 3D vectors, but they generalize naturally to higher dimensions.

Addition

For vectors [math]\displaystyle{ \vec{a} = \langle a_x, a_y, a_z \rangle }[/math] and [math]\displaystyle{ \vec{b} = \langle b_x, b_y, b_z \rangle }[/math],

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

Geometrically, we place the tail of [math]\displaystyle{ \vec{b} }[/math] at the head of [math]\displaystyle{ \vec{a} }[/math]. The vector from the tail of [math]\displaystyle{ \vec{a} }[/math] to the head of [math]\displaystyle{ \vec{b} }[/math] is the **resultant** [math]\displaystyle{ \vec{a} + \vec{b} }[/math].

Subtraction

Vector subtraction can be viewed as adding the negative of a vector. We have

[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]

Component-wise, we subtract each component of [math]\displaystyle{ \vec{b} }[/math] from the corresponding component of [math]\displaystyle{ \vec{a} }[/math].

Image: 500 pixels

Multiplication by Scalar

If [math]\displaystyle{ k }[/math] is a scalar and [math]\displaystyle{ \vec{a} = \langle a_x, a_y, a_z \rangle }[/math], then

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

Multiplying by a positive scalar changes the magnitude but keeps the direction the same. Multiplying by a negative scalar flips the direction as well.

Image: 400 pixels

Division by Scalar

Dividing a vector by a nonzero scalar is equivalent to multiplying by its reciprocal:

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

This operation shrinks or enlarges the vector’s magnitude while preserving (or reversing, if k is negative) its direction.

Dot Product (also called Scalar Product)

For [math]\displaystyle{ \vec{a} = \langle a_x, a_y, a_z \rangle }[/math] and [math]\displaystyle{ \vec{b} = \langle b_x, b_y, b_z \rangle }[/math], the dot product is

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

The result is a scalar. The dot product measures how much two vectors “line up” with each other. A key property is

[math]\displaystyle{ \vec{a}\cdot\vec{b} = |\vec{a}|\;|\vec{b}|\cos(\theta), }[/math]

where [math]\displaystyle{ \theta }[/math] is the angle between [math]\displaystyle{ \vec{a} }[/math] and [math]\displaystyle{ \vec{b} }[/math]. If the dot product is zero, the vectors are perpendicular.

Image: 400 pixels

Cross Product (also called Vector Product)

One component-based definition of the cross product (the one often found on formula sheets) 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. }[/math]

You may also see it written as

[math]\displaystyle{ \vec{a} \times \vec{b} = (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]

Although this looks complicated, the key idea is that the cross product of two 3D vectors is a new vector that is orthogonal to both of them. The order matters: changing the order flips the sign.

A common way to remember the formula is through the determinant of a 3×3 matrix:

[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]

You can expand this determinant using cofactor expansion. Remember that the [math]\displaystyle{ \hat{j} }[/math] term has a minus sign.

You can also use online tools or videos to check your work:

The magnitude of the cross product satisfies

[math]\displaystyle{ |\vec{a}\times\vec{b}| = |\vec{a}|\;|\vec{b}|\sin(\theta) }[/math],

where [math]\displaystyle{ \theta }[/math] is the angle between [math]\displaystyle{ \vec{a} }[/math] and [math]\displaystyle{ \vec{b} }[/math]. Its direction is perpendicular to the plane of [math]\displaystyle{ \vec{a} }[/math] and [math]\displaystyle{ \vec{b} }[/math] and is chosen using the Right Hand Rule. In 2D, the usual cross product is not defined.

For more mathematically-advanced students, we can connect this to linear algebra. Let [math]\displaystyle{ A \in \mathbb{R}^{m \times n} }[/math] be a matrix, and consider its **null space**:

[math]\displaystyle{ \operatorname{Null}(A) = \{ \vec{v} \in \mathbb{R}^n \mid A\vec{v} = \vec{0} \}. }[/math]

The null space is the set of all vectors that are orthogonal to every row of [math]\displaystyle{ A }[/math]. Writing the rows as [math]\displaystyle{ \vec{a}_1,\ldots,\vec{a}_m }[/math], the equation [math]\displaystyle{ A\vec{v}=\vec{0} }[/math] expands to

[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 \\ \vdots \\ 0\end{bmatrix}. }[/math]

So every vector in the null space is perpendicular to each row, and therefore to the whole row space.

For two vectors [math]\displaystyle{ \vec{a}, \vec{b} \in \mathbb{R}^3 }[/math] that are not multiples of each other, think of them as the rows of a 2×3 matrix [math]\displaystyle{ A }[/math]. The null space of [math]\displaystyle{ A }[/math] consists of all vectors orthogonal to both [math]\displaystyle{ \vec{a} }[/math] and [math]\displaystyle{ \vec{b} }[/math]. The cross product [math]\displaystyle{ \vec{a}\times\vec{b} }[/math] is (up to scaling and orientation) the unique nonzero vector in this null space once we fix the magnitude and choose a direction using the right-hand rule. This is another way to see why the cross product is perpendicular to both original vectors. In higher dimensions, the null space can have more than one dimension, so there isn’t a single unique “cross product direction” in the same way.

Another Cross Product Trick

Here is a pattern-based way to compute the cross product quickly, using components.

Suppose

[math]\displaystyle{ \vec{a} = \langle 3, -2, 4 \rangle, \quad \vec{b} = \langle -1, 6, 3 \rangle. }[/math]

We want [math]\displaystyle{ \vec{c} = \vec{a} \times \vec{b} = \langle c_x, c_y, c_z \rangle. }[/math]

Arrange the components vertically and repeat the first component at the bottom:

[math]\displaystyle{ \begin{vmatrix} a_x \\ a_y \\ a_z \\ a_x \end{vmatrix} = \begin{vmatrix} 3 \\ -2 \\ 4 \\ 3 \end{vmatrix} }[/math], [math]\displaystyle{ \begin{vmatrix} b_x \\ b_y \\ b_z \\ b_x \end{vmatrix} = \begin{vmatrix} -1 \\ 6 \\ 3 \\ -1 \end{vmatrix} }[/math].

To find [math]\displaystyle{ c_x }[/math], draw an “X” connecting [math]\displaystyle{ a_y }[/math] with [math]\displaystyle{ b_z }[/math] and [math]\displaystyle{ a_z }[/math] with [math]\displaystyle{ b_y }[/math]:

Then compute

[math]\displaystyle{ c_x = a_y b_z - a_z b_y = (-2)(3) - (4)(6) = -6 - 24 = -30. }[/math]

For [math]\displaystyle{ c_y }[/math], use [math]\displaystyle{ a_z }[/math] with the bottom [math]\displaystyle{ b_x }[/math] and the bottom [math]\displaystyle{ a_x }[/math] with [math]\displaystyle{ b_z }[/math]:

So

[math]\displaystyle{ c_y = a_z b_x - a_x b_z = (4)(-1) - (3)(3) = -4 - 9 = -13. }[/math]

For [math]\displaystyle{ c_z }[/math], connect [math]\displaystyle{ a_x }[/math] with [math]\displaystyle{ b_y }[/math] and [math]\displaystyle{ a_y }[/math] with [math]\displaystyle{ b_x }[/math]:

Then

[math]\displaystyle{ c_z = a_x b_y - a_y b_x = (3)(6) - (-2)(-1) = 18 - 2 = 16. }[/math]

Thus

[math]\displaystyle{ \vec{a}\times\vec{b} = \langle -30, -13, 16 \rangle. }[/math]

With practice, you may not need to draw the X each time and can compute the components directly from the pattern.

Equations Involving Vector Operations

You may sometimes encounter equations that mix dot products and cross products. Two useful facts:

  1. [math]\displaystyle{ (\vec{w} \times \vec{v}) \cdot \vec{v} = 0 }[/math], because [math]\displaystyle{ \vec{w} \times \vec{v} }[/math] is perpendicular to both [math]\displaystyle{ \vec{w} }[/math] and [math]\displaystyle{ \vec{v} }[/math], so its dot product with either original vector is zero.
  2. [math]\displaystyle{ \vec{a} \cdot (\vec{b} \times \vec{c}) = (\vec{a} \times \vec{b}) \cdot \vec{c} }[/math]. This identity, called the scalar triple product identity, can be useful if one cross product is easier to compute than the other. Note that the cross product part is still order-sensitive, while the dot product is commutative.

Forms

There are several common ways to describe a vector, all containing the same information.

Magnitude and Direction Form

In this form, we specify:

  • The magnitude (length), and
  • A description of the direction (cardinal direction, angle, or axis).

For example, “a 5 m vector at 60° above the horizontal” is in magnitude and direction form. This form is intuitive and often used in word problems and real-life descriptions.

Component Form

Here, we break the vector into components along the coordinate axes. In 3D, a vector is written as

[math]\displaystyle{ \langle a_x, a_y, a_z \rangle. }[/math]

For example, [math]\displaystyle{ \langle 2, 0, -3 \rangle }[/math] means the vector extends 2 units in +x, 0 units in y, and 3 units in -z. Most algebraic operations (like dot and cross products) are done using component form. Programming languages also typically store vectors in this way.

Unit Vector Form

In unit vector form, we write a vector as a combination of unit vectors:

[math]\displaystyle{ \hat{i} }[/math], [math]\displaystyle{ \hat{j} }[/math], [math]\displaystyle{ \hat{k} }[/math] or [math]\displaystyle{ \hat{x} }[/math], [math]\displaystyle{ \hat{y} }[/math], [math]\displaystyle{ \hat{z} }[/math].

For instance, the vector [math]\displaystyle{ \langle 2, 0, -3 \rangle }[/math] can be written as

[math]\displaystyle{ 2\hat{i} - 3\hat{k}. }[/math]

Unit vector form and component form contain the same numerical information; they just use different notation.

In n dimensions, a vector always needs n numbers to describe it fully. In 3D, magnitude–direction form uses 1 number for magnitude and 2 angles for direction, while component or unit-vector form uses 3 components.

Converting Between Forms

We can move between forms using trigonometry and the Pythagorean theorem.

  • For a 2D vector [math]\displaystyle{ \vec{a} = \langle a_x, a_y \rangle }[/math], the magnitude is
 [math]\displaystyle{ |\vec{a}| = \sqrt{a_x^2 + a_y^2}. }[/math]
  • The direction angle from the positive x-axis is
 [math]\displaystyle{ \theta = \tan^{-1}\left(\frac{a_y}{a_x}\right) }[/math] (with quadrant checks).
  • Given magnitude [math]\displaystyle{ |\vec{a}| }[/math] and angle [math]\displaystyle{ \theta }[/math], the components are
 [math]\displaystyle{ a_x = |\vec{a}|\cos\theta }[/math],
 [math]\displaystyle{ a_y = |\vec{a}|\sin\theta }[/math].

Vectors in VPython

In VPython (used in GlowScript), vectors are represented by the type vec or vector. The constructor takes three arguments: the x, y, and z components.

Example:

velocity = vec(3, -1, 2)

This creates a vector called velocity with components (3, -1, 2).

In VPython’s default view, +x points to the right, +y points upward, and +z points out of the screen toward the viewer.

Modifying Vectors

You can access or modify individual components using .x, .y, and .z. For example:

velocity.x = 5

changes the x-component from 3 to 5.

Helpful Vector Functions

Magnitude

VPython provides the mag function to compute the magnitude of a vector:

velocity = vec(3, -1, 2) speed = mag(velocity) # magnitude of velocity

Normalize

To obtain a unit vector in the same direction (normalize a vector), use norm:

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

Dot and Cross Product

The functions dot and cross compute dot and cross products:

a = vec(1, 2, 3) b = vec(4, 5, 6) dot_prod = dot(a, b) # a · b cross_prod = cross(a, b) # a × b

Visualization

To visualize vectors, VPython provides the arrow object. You specify:

  • pos – tail position,
  • axis – direction and length of the arrow (a vector).

Optional parameters include shaftwidth, headwidth, and headlength. You can also change attributes like color. See more details here.

Example of a velocity vector arrow at the origin:

velocity = vec(1, 1, 0) origin = vec(0, 0, 0) shaftwidth = 0.1 vel_arrow = arrow(pos=origin, axis=velocity,

                 shaftwidth=shaftwidth, color=color.red)

Output in VPython of Visualized Vector

A Computational Model

Click here to run the interactive computational model.

This model walks through basic vector operations step by step. It starts by defining vectors as arrows, then explores:

  • Addition and subtraction
  • Scalar multiplication
  • Magnitude and unit vectors
  • Dot and cross products

Each operation is shown both in formula form and using VPython shortcut functions. You can edit the vector values and rerun the code to see how the results change. Commenting out parts of the script can help you focus on one type of operation at a time.

Examples

Very Simple

Vector [math]\displaystyle{ \vec{a} = \langle 2.5, 7.4, 8.0 \rangle }[/math]. Find its magnitude and a unit vector in its direction.

    • Solution:**

First, find the magnitude:

[math]\displaystyle{ |\vec{a}| = \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} \approx 11.18. }[/math]

Now form the unit vector:

[math]\displaystyle{ \hat{a} = \frac{\vec{a}}{|\vec{a}|} = \left\langle \frac{2.5}{11.18}, \frac{7.4}{11.18}, \frac{8.0}{11.18} \right\rangle \approx \langle 0.224, 0.662, 0.716 \rangle. }[/math]

So the magnitude is about 11.18, and the direction can be described by the unit vector [math]\displaystyle{ \langle 0.224, 0.662, 0.716 \rangle }[/math].

Simple

Let [math]\displaystyle{ \vec{a} = \langle 2, 4, 2 \rangle }[/math] and [math]\displaystyle{ \vec{b} = \langle -1, 1, 3 \rangle }[/math]. Find the magnitude of [math]\displaystyle{ \vec{a} - 2\vec{b} }[/math].

    • Solution:**

Compute the combination:

[math]\displaystyle{ \vec{a} - 2\vec{b} = \langle 2, 4, 2 \rangle - 2\langle -1, 1, 3 \rangle }[/math]

[math]\displaystyle{ = \langle 2, 4, 2 \rangle - \langle -2, 2, 6 \rangle }[/math]

[math]\displaystyle{ = \langle 4, 2, -4 \rangle. }[/math]

Now find the magnitude:

[math]\displaystyle{ |\langle 4, 2, -4 \rangle| = \sqrt{4^2 + 2^2 + (-4)^2} = \sqrt{16 + 4 + 16} = \sqrt{36} = 6. }[/math]

Intermediate

An airplane is flying in still air at 240 m/s, 35° south of west. A wind blows at 80 m/s, 15° east of north. What must the plane’s new velocity relative to the air be in order to keep the same overall trajectory? Give your answer in components (with +x east and +y north).

    • Solution:**

Let

  • [math]\displaystyle{ \vec{v_{p,0}} }[/math] = original velocity of the plane (relative to air),
  • [math]\displaystyle{ \vec{v_w} }[/math] = wind velocity (relative to ground),
  • [math]\displaystyle{ \vec{v_{p,1}} }[/math] = new plane velocity (relative to air).

We want the **resultant ground velocity** of the plane to stay equal to [math]\displaystyle{ \vec{v_{p,0}} }[/math]. The velocity relative to the ground is

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

So we require

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

Express everything in components:

Take +x as east and +y as north.

35° south of west corresponds to 215° from the +x-axis:

[math]\displaystyle{ \vec{v_{p,0}} = \langle 240\cos(215^\circ),\; 240\sin(215^\circ) \rangle \approx \langle -196.6,\; -137.7 \rangle\ \text{m/s}. }[/math]

15° east of north corresponds to 75° from the +x-axis:

[math]\displaystyle{ \vec{v_w} = \langle 80\cos(75^\circ),\; 80\sin(75^\circ) \rangle \approx \langle 20.7,\; 77.3 \rangle\ \text{m/s}. }[/math]

Now subtract:

[math]\displaystyle{ \vec{v_{p,1}} = \vec{v_{p,0}} - \vec{v_w} = \langle -196.6, -137.7 \rangle - \langle 20.7, 77.3 \rangle }[/math]

[math]\displaystyle{ = \langle -217.3,\; -214.9 \rangle\ \text{m/s}. }[/math]

So the plane must adjust its airspeed to approximately [math]\displaystyle{ \langle -217.3,\; -214.9 \rangle }[/math] m/s relative to the air to keep its original track.

Difficult

Find the angle between the vectors [math]\displaystyle{ \langle 2, 5, -2 \rangle }[/math] and [math]\displaystyle{ \langle 3, -4, -1 \rangle }[/math].

    • Solution:**

Use the dot product formula:

[math]\displaystyle{ \vec{a}\cdot\vec{b} = |\vec{a}|\;|\vec{b}|\cos\theta. }[/math]

So

[math]\displaystyle{ \theta = \cos^{-1}\left(\frac{\vec{a}\cdot\vec{b}}{|\vec{a}|\;|\vec{b}|}\right). }[/math]

Compute the numerator:

[math]\displaystyle{ \vec{a}\cdot\vec{b} = 2(3) + 5(-4) + (-2)(-1) = 6 - 20 + 2 = -12. }[/math]

Compute the magnitudes:

[math]\displaystyle{ |\vec{a}| = \sqrt{2^2 + 5^2 + (-2)^2} = \sqrt{4 + 25 + 4} = \sqrt{33}, }[/math]

[math]\displaystyle{ |\vec{b}| = \sqrt{3^2 + (-4)^2 + (-1)^2} = \sqrt{9 + 16 + 1} = \sqrt{26}. }[/math]

So

[math]\displaystyle{ \theta = \cos^{-1}\left(\frac{-12}{\sqrt{33}\sqrt{26}}\right) = \cos^{-1}\left(\frac{-12}{\sqrt{858}}\right) \approx 114^\circ. }[/math]

Connectedness

Vectors appear in many everyday and engineering contexts.

Consider a desk. Its weight is a force vector pointing downward, the normal force from the floor is a vector pointing upward, and the forces among the desk’s parts can all be represented as vectors. Measurements such as the diagonal distance across the desktop can also be seen as vectors from one corner to another.

Your motion can be described using vectors as well. Your **position** relative to some reference point can be written as a position vector. The difference between two position vectors is a displacement vector. **Velocity** describes how your position changes over time; it is the time derivative of the position vector, and its magnitude is your speed. **Acceleration** is the time derivative of velocity. All of these quantities can be broken into components, which makes it easier to analyze motion in each direction separately.

In Physics 2 and beyond, vectors are everywhere. The electric field, magnetic field, many forces, and other quantities are all vector fields. For example, the magnetic force on a charged particle is

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

which combines a cross product of two vectors and a scalar multiplication.

Even outside physics, vectors are central. In engineering, they are used for stress analysis, fluid flow, and control systems. In computer science, vectors appear in graphics, simulations, robotics, and machine learning (where data points are often vectors in high-dimensional spaces). Virtually any physical or abstract quantity that has both “how much” and “which way” can be modeled as a vector.

History

Ideas similar to vectors go back many centuries. Early uses treated them as directed line segments rather than abstract quantities. Hero of Alexandria’s work Mechanics in the first century AD contains one of the earliest known discussions of adding such directed segments.

In the 18th and 19th centuries, several mathematicians used 2D vectors to represent complex numbers. Caspar Wessel, Jean-Robert Argand, Carl Friedrich Gauss, and William Rowan Hamilton all contributed to this viewpoint. One component represented the real part, and the other represented the imaginary part. Hamilton also introduced the term “vector.”

August Ferdinand Möbius, in his 1827 book The Barycentric Calculus, formalized many vector ideas, including labeling vectors with letters and defining scalar multiplication. Hermann Grassmann, in his 1844 work Ausdehnungslehre (“The Calculus of Extension”), developed a more general theory of vectors in spaces of arbitrary dimension and laid foundations for linear algebra.

The modern vector notation and conventions used in physics owe a lot to J. Willard Gibbs and Oliver Heaviside in the late 19th century. They refined vector methods and used them to express Maxwell’s equations of electromagnetism in the compact form we study today.

See Also

External Links

Mathematical computations on vectors (MIT OCW notes): 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 in VPython: http://vpython.org/contents/docs/vector.html

Basic vector introduction: https://www.physics.uoguelph.ca/tutorials/vectors/vectors.html

Further Reading

  • *Vector Analysis* – Josiah Willard Gibbs
  • *Introduction to Matrices and Vectors* – Jacob T. Schwartz

References

https://mathinsight.org/definition/magnitude_vector https://www.mathsisfun.com/algebra/vectors.html 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 http://mathinsight.org/vector_introduction http://www.math.mcgill.ca/labute/courses/133f03/VectorHistory.html https://www.glowscript.org/docs/VPythonDocs/vector.html https://www.glowscript.org/docs/VPythonDocs/arrow.html https://www.britannica.com/science/vector-mathematics https://www.grc.nasa.gov/www/k-12/rocket/vectcomp.html https://www.onlinemathlearning.com/dot-product.html