Learning Objectives
By the end of this section, you will be able to:
- Define vectors as objects with both magnitude and direction
- Represent vectors using component form in 2D and 3D coordinate systems
- Compute vector magnitude (length) using the Pythagorean theorem
- Perform vector addition, subtraction, and scalar multiplication
- Find unit vectors and understand their significance
- Express vectors using standard basis vectors , ,
- Apply vectors to physics, engineering, and machine learning problems
The Big Picture: Why Vectors Matter
"Vectors are the language of physics and the foundation of multivariable calculus." — Richard Feynman
Imagine giving directions to a friend. Saying "walk 100 meters" isn't enough — they need to know which direction. "Walk 100 meters north" provides the complete picture. This combination of magnitude (100 meters) and direction (north) is exactly what vectors capture.
Vectors are everywhere in the physical world. When you throw a ball, it has a velocity — not just a speed, but a speed in a particular direction. Forces, accelerations, electric fields, gravitational pulls — all are vector quantities that combine magnitude with direction.
Scalars vs. Vectors
Scalars are quantities with only magnitude: temperature (25°C), mass (5 kg), time (3 seconds). A single number describes them completely.
Vectors are quantities with both magnitude and direction: velocity (50 m/s north), force (10 N upward), displacement (3 km east). A single number is insufficient — we need direction too.
Where Vectors Appear
Physics
- Velocity and acceleration
- Forces (gravity, friction, tension)
- Electric and magnetic fields
- Momentum and angular momentum
Engineering
- Structural analysis (stress vectors)
- Fluid flow (velocity fields)
- Signal processing
- Robotics (position and orientation)
Computer Graphics
- 3D modeling and animation
- Light and surface normals
- Camera positioning
- Collision detection
Machine Learning
- Feature vectors
- Word embeddings
- Gradient vectors
- Weight vectors
Historical Origins: From Arrows to Algebra
The concept of vectors evolved over centuries, with contributions from mathematicians and physicists working on seemingly different problems.
Early Developments
The idea of combining magnitude and direction appears in ancient mechanics, but the formal mathematical treatment began in the 19th century. Sir William Rowan Hamilton (1805–1865) developed quaternions in 1843, a precursor to modern vector algebra.
Hermann Grassmann (1809–1877) independently created a comprehensive theory of what he called "extension theory" — essentially vector spaces — in 1844, though his work was largely ignored during his lifetime.
The Modern Vector Concept
The modern notation and approach came from Josiah Willard Gibbs (1839–1903) at Yale and Oliver Heaviside (1850–1925) in England. Working independently in the 1880s, both extracted the useful parts of Hamilton's quaternions to create the vector analysis we use today.
Why Vectors Prevailed
Quaternions (4D number systems) were the dominant mathematical tool for physics before vectors. Gibbs and Heaviside showed that for most physical applications, 3D vectors are simpler and more intuitive. Today, quaternions are still used in computer graphics for rotations, but vectors dominate most applications.
What is a Vector?
Definition: Vector
A vector is a mathematical object that has both magnitude (size or length) and direction.
Geometrically, vectors are represented as directed line segments (arrows). The arrow's length represents magnitude; the arrow's orientation represents direction.
Key Terminology
| Term | Definition |
|---|---|
| Magnitude | The length of the vector, always non-negative |
| Direction | The orientation in space (angle or heading) |
| Initial point | Where the arrow starts (often the origin) |
| Terminal point | Where the arrow ends (the tip) |
| Position vector | A vector from the origin to a point P |
| Free vector | A vector that can be moved freely (only magnitude and direction matter) |
Two vectors are considered equal if and only if they have the same magnitude and the same direction. Their position in space doesn't matter — only their length and orientation.
Vector Notation
Vectors are denoted in several ways, depending on context:
| Notation | Usage | Example |
|---|---|---|
| Boldface | Printed text | v, a, F |
| Arrow above | Handwritten | v⃗, a⃗, F⃗ |
| Underline | Some textbooks | v̲ |
| Component form | Calculations | (3, 4) or ⟨3, 4⟩ |
| Basis form | Physics/engineering | 3i + 4j |
The zero vector, denoted or , has magnitude 0. It's the only vector with no defined direction.
Vectors in 2D: The Cartesian Plane
In two dimensions, we describe vectors using components along the x-axis and y-axis.
Component Form in 2D
A vector in 2D can be written as:
where is the horizontal component and is the vertical component.
Position Vectors
If we have a point in the plane, the position vector from the origin to is:
Vector Between Two Points
For points and , the vector from to is:
This is found by "terminal point minus initial point" — subtract coordinates component-wise.
Interactive 2D Vector Visualization
Explore vectors in 2D. Adjust the components of each vector and observe how addition, subtraction, and scalar multiplication work. Notice how the resultant vector (sum) follows the parallelogram law.
Vector Controls
Applied to vector a
Vectors in 3D: Three-Dimensional Space
In three dimensions, we add a third component along the z-axis, giving vectors the ability to point anywhere in space.
Component Form in 3D
A vector in 3D can be written as:
All the operations that work in 2D extend naturally to 3D.
Right-Hand Coordinate System
We use the right-hand coordinate system: if you point your right hand's fingers along the positive x-axis and curl them toward the positive y-axis, your thumb points in the positive z-direction.
Interactive 3D Vector Visualization
Explore vectors in 3D space. Click and drag to rotate the view. Adjust the x, y, and z components of each vector and observe how they combine. Toggle the sum to see vector addition in three dimensions.
3D Vector Controls
Click and drag to rotate. Scroll to zoom.
Applied to vector a
Magnitude and Direction
Magnitude (Length)
The magnitude (or length or norm) of a vector is denoted or .
Magnitude Formulas
In 2D: For :
In 3D: For :
These formulas come from the Pythagorean theorem. In 2D, the vector forms the hypotenuse of a right triangle with legs and .
Direction
In 2D, direction is often specified by an angle measured counterclockwise from the positive x-axis:
Be Careful with arctan
The standard only gives angles in . Use (available in most programming languages) to get the correct angle in all four quadrants.
In 3D, direction is specified by either:
- Direction cosines: The cosines of angles with each axis
- Direction angles: The angles with the x, y, and z axes
- Unit vector: The normalized vector pointing in the same direction
Unit Vectors
Definition: Unit Vector
A unit vector is a vector with magnitude 1. It specifies a direction without regard to length.
Given any non-zero vector , the unit vector in the same direction is:
The "hat" notation () indicates a unit vector.
Finding a unit vector is called normalizing the vector. This process is essential when you need direction without magnitude — for example, when specifying the direction of movement regardless of speed.
Interactive Unit Vector Demonstration
Explore the relationship between a vector and its unit vector. The unit vector (shown dashed in green) always lies on the unit circle and points in the same direction as the original vector.
Unit Vector Explorer
The unit vector v̂ always has magnitude 1 and points in the same direction as v.
v̂ = v / |v| = (cos θ, sin θ)
Computing Unit Vectors
For :
1. Find magnitude:
2. Divide each component:
Verify: ✓
Vector Operations
Vector Addition
Vectors add component-wise:
Geometric interpretation:
- Parallelogram law: Place both vectors at the same starting point; the sum is the diagonal of the parallelogram they form
- Head-to-tail: Place the tail of at the head of ; the sum goes from the tail of to the head of
Vector Subtraction
Vector subtraction is also component-wise:
Geometric interpretation: points from the tip of to the tip of when both start at the origin.
Scalar Multiplication
Multiplying a vector by a scalar scales each component:
Geometric interpretation:
- If : The vector is stretched (lengthened)
- If : The vector is shrunk
- If : The vector is reversed and scaled
- If : The result is the zero vector
Properties of Vector Operations
Vector operations satisfy the same algebraic properties as regular number arithmetic:
| Property | Addition | Scalar Multiplication |
|---|---|---|
| Commutative | a + b = b + a | — |
| Associative | (a + b) + c = a + (b + c) | k(m·v) = (km)v |
| Identity | v + 0 = v | 1·v = v |
| Inverse | v + (−v) = 0 | — |
| Distributive | — | k(a + b) = ka + kb |
| Distributive | — | (k + m)v = kv + mv |
Zero Vector Properties
The zero vector is special:
- (additive identity)
- (scalar multiplication by 0)
- (zero magnitude)
- Direction is undefined
Standard Basis Vectors
The standard basis vectors are unit vectors along each coordinate axis:
Any vector can be written as a linear combination of basis vectors:
For example, .
Why Basis Vectors Matter
Basis vectors are fundamental because they let us decompose any vector into independent components. This decomposition is essential for:
- Computing projections and components along specific directions
- Setting up coordinate systems for physics problems
- Understanding linear independence and span
- Building the foundation for linear algebra
Applications in Science and Engineering
Physics: Forces and Motion
When multiple forces act on an object, we find the net force by vector addition:
Example: A boat travels at 10 m/s east while a river current flows at 3 m/s north.
Velocity vector:
Current vector:
Resultant:
Speed: m/s
Heading: north of east
Computer Graphics: Transformations
In 3D graphics, vectors represent:
- Positions: Vertex locations in 3D models
- Normals: Surface directions for lighting calculations
- Directions: Camera viewing directions, light rays
Navigation: GPS and Aviation
Pilots and navigators use vectors constantly. Wind correction, course plotting, and ground speed calculations all involve vector addition to account for wind vectors affecting aircraft velocity vectors.
Machine Learning Applications
Vectors are the fundamental data structure in machine learning. Understanding vector operations is essential for every ML practitioner.
Feature Vectors
In ML, each data point is represented as a feature vector — a vector in high-dimensional space where each dimension corresponds to a feature.
Example: A house with 1500 sqft, 3 bedrooms, 2 bathrooms, and 10 years old becomes:
x = (1500, 3, 2, 10)
Word Embeddings
Modern NLP represents words as vectors in a high-dimensional space (typically 100-300 dimensions). Similar words have similar vectors, enabling semantic operations:
king − man + woman ≈ queen
Vector arithmetic captures semantic relationships!
Gradient Vectors
In optimization, the gradient is a vector pointing in the direction of steepest increase of a function. For a loss function with parameters :
Gradient descent updates parameters by moving in the opposite direction of the gradient to minimize loss.
Python Implementation
Vector Basics with NumPy
NumPy is the standard library for vector operations in Python. Here's how to work with vectors:
Vectors in Machine Learning
Here's how vectors appear in practical ML applications:
Common Pitfalls
Pitfall 1: Confusing Position and Direction
A vector doesn't represent "the point at (3, 4)" — it represents any arrow with that displacement. The position vector from origin to (3, 4) happens to have these components, but the same vector could start at (1, 1) and end at (4, 5).
Pitfall 2: Adding Scalars and Vectors
You cannot add a scalar to a vector directly. is not defined. You can only add a scalar after appropriate broadcasting in programming contexts.
Pitfall 3: Dividing Vectors
There is no standard vector division operation. is not defined. You can divide by scalars, but not by other vectors.
Pitfall 4: Magnitude is Always Non-negative
Even if a vector has negative components, its magnitude is always . The vector has magnitude 5, not -5.
Test Your Understanding
What is the magnitude of the vector v = (3, 4)?
Summary
Vectors are mathematical objects that capture both magnitude and direction, making them essential for describing physical quantities like velocity, force, and displacement.
Key Concepts
| Concept | Description |
|---|---|
| Vector | An object with magnitude and direction |
| Component form | v = (vₓ, vᵧ) in 2D or (vₓ, vᵧ, vᵤ) in 3D |
| Magnitude | |v| = √(vₓ² + vᵧ²) — the length |
| Unit vector | v̂ = v/|v| — direction with magnitude 1 |
| Vector addition | Component-wise: (a + b) = (aₓ + bₓ, aᵧ + bᵧ) |
| Scalar multiplication | kv = (kvₓ, kvᵧ) — scales the vector |
| Standard basis | i = (1, 0, 0), j = (0, 1, 0), k = (0, 0, 1) |
Key Takeaways
- Vectors combine magnitude (how much) and direction (which way)
- In coordinates, vectors are represented by ordered lists of components
- Vector magnitude is computed using the Pythagorean theorem
- Unit vectors have magnitude 1 and represent pure direction
- Addition and scalar multiplication are performed component-wise
- The standard basis vectors i, j, k allow any vector to be expressed as a linear combination
- Vectors are fundamental in physics, graphics, and machine learning
Coming Next: In the next section, we'll explore the Dot Product — a powerful operation that multiplies two vectors to produce a scalar. The dot product reveals the angle between vectors and enables projections, work calculations, and similarity measurements in machine learning.