Linear algebra ยท Part 1 of 5
Vectors
Vectors as arrows with magnitude and direction, component form, addition, scaling, and the dot product.
Linear algebra7 min read
A quantity like temperature needs only one number. But a quantity like wind needs two: how fast, and in which direction. A vector is the mathematical object for such quantities โ an arrow with a length (magnitude) and a direction. Vectors let us do arithmetic with direction: add two forces, scale a velocity, measure how much two directions agree.
In this lesson we work with vectors in the plane and in space, written as lists of components like or . Everything you compute with vectors reduces to arithmetic on components, but each operation has a geometric meaning worth keeping in mind.
What a vector is
A vector is a quantity with magnitude and direction. Geometrically, draw it as an arrow: the length is the magnitude, the orientation is the direction. Algebraically, in 2D we write , meaning: go units horizontally and units vertically. In 3D, .
Two vectors are equal exactly when all their components match. A vector with magnitude (all components zero) is the zero vector ; it has no direction.
The magnitude (length) of comes from the Pythagorean theorem:
and in 3D, . A unit vector has magnitude ; dividing a nonzero vector by its magnitude gives a unit vector pointing the same way.
Adding vectors and scaling them
To add vectors, add components: . Geometrically this is the tip-to-tail rule: place the tail of at the tip of ; the sum runs from the tail of to the tip of . Think of walking one displacement, then another โ the sum is the overall displacement.
To scale a vector by a number (a scalar), multiply every component: . Scaling by doubles the length; scaling by flips the direction; scaling by gives the zero vector.
Subtraction is addition of the negated vector: . Geometrically, is the arrow from the tip of to the tip of .
A key consequence: any nonzero vector can be written as magnitude times direction, , where the second factor is a unit vector.
Example 1. Adding and scaling Let and . Compute , , and .
Add component by component:
Scale , then subtract :
Magnitude of :
Example 2. Finding a unit vector Find the unit vector in the direction of .
First compute the magnitude:
Divide each component by :
Check: the magnitude of the result is , as required.
The dot product
The dot product (inner product) of two vectors multiplies matching components and adds:
The result is a scalar, not a vector. Its geometric meaning is the crucial part:
where is the angle between the vectors. So the dot product measures how much the two vectors point the same way: positive when the angle is acute, zero when they are perpendicular, negative when the angle is obtuse. In particular, exactly when .
Two useful special cases: , and the angle between two nonzero vectors is
This connects directly to the gradient from the previous lesson: a directional derivative is the gradient dotted with a unit direction vector, measuring how fast the function changes in that direction.
Worked examples with the dot product
The dot product answers three common questions: are these vectors perpendicular, what is the angle between them, and how long is the projection of one onto the other.
Example 3. Checking perpendicularity Are and perpendicular?
Compute the dot product:
The dot product is , so the vectors are perpendicular.
Example 4. Angle between two vectors Find the angle between and .
Compute the pieces:
Then
so . This matches the picture: sits halfway between the -axis and the -axis.
Example 5. A vector problem combining ideas Find a number such that is perpendicular to , where and .
Perpendicular to means the dot product with is zero:
Compute each piece:
So , giving .
Check by substituting back: , and its dot product with is . โ
Vectors as arrows, vectors as lists
Keep both pictures in mind. The arrow picture explains what operations mean: addition chains displacements, scaling stretches or flips, the dot product measures alignment. The component picture is how you actually compute: everything becomes ordinary arithmetic on coordinates.
One more piece of vocabulary: a vector's components depend on the coordinate system, but the arrow itself does not. Rotating your axes changes the numbers but not the geometric vector. This distinction becomes central when vectors are organized into matrices, which is where the course goes next.
Common mistakes
- Confusing scalars and vectors: adding a plain number to a vector is undefined; scaling a vector means multiplying every component by the number.
- Forgetting that the dot product is a scalar โ writing as a vector, or trying to dot vectors of different dimensions (undefined).
- Computing magnitude as instead of ; e.g. has magnitude , not .
- Thinking a zero dot product means the vectors are zero or parallel; it means they are perpendicular (for nonzero vectors).
- Dividing a vector by its magnitude component-wise but forgetting to divide every component when finding a unit vector.
Practice
- Let and . Compute .
- Compute the magnitude of the vector .
- Find the unit vector in the direction of . Give it with exact fractions.
- Compute the dot product of the vectors and , and use it to decide whether they are perpendicular.
- Find the value of for which the vector is perpendicular to , where and .
Answers
- , since you add component by component: .
- , since .
- , since and each component is divided by .
- , so they are not perpendicular: .
- , from .
Next, matrices collect many vectors into a single object, and the operations you just learned scale up to them โ see Matrices and their operations.