Subtraction and Scalar Multiplication
Vector addition combines matching coordinates. Two more operations complete the basic arithmetic: subtraction and scalar multiplication.
Subtraction answers:
what change takes one vector to another?
Scalar multiplication answers:
what happens if we stretch,
shrink, or flip a vector?
Subtraction
Subtract vectors coordinate by coordinate.
If:
a = [5, 6]
b = [2, 1]
then:
Read it aloud:
subtract matching entries
Subtraction is useful because it gives a difference vector. If a and b are
positions, then describes how to move from to .
If and , what is ?
Compute it first, then check your number.
HintCoordinate-wise subtraction
The first coordinate is . The second coordinate is .
SolutionDifference vector
Subtract matching coordinates:
If the vectors are positions, this difference describes the move from
[2, 1] to [5, 6]: three units in the first coordinate and five units in
the second.
Direction of the Difference
The order matters.
describes the change from to .
points the other way.
For the same vectors:
If , what is ?
Compute it first, then check your number.
HintOpposite direction
If one direction is , the opposite direction is .
SolutionOpposite difference
Reversing the order changes the sign:
The size of the change is the same, but the direction is reversed.
Scalar Multiplication
A scalar is a single number.
Multiplying a vector by a scalar multiplies every coordinate by that number.
If:
then:
The vector keeps the same basic direction when the scalar is positive. Its length changes.
If the scalar is negative, the vector flips direction.
In the diagram, b = [4, 6] is twice a = [2, 3]. It points the same way and
is twice as long.
If , what is ?
Compute it first, then check your number.
HintMultiply each coordinate
The scalar 2 multiplies both coordinates.
SolutionCoordinate-wise scaling
Multiply each coordinate by 2:
A positive scalar stretches the vector without flipping its direction.
Negative Scaling
Multiplying by -1 flips a vector through the origin:
The length stays the same, but the direction reverses.
What is ?
Compute it first, then check your number.
HintMultiply by -1
Change the sign of each coordinate.
SolutionFlipped vector
Multiplying by -1 changes the sign of every coordinate:
The vector has the same length as before, but it points through the origin in the opposite direction.
Code Mirror
NumPy mirrors the formula:
import numpy as np
v = np.array([2, 4])
print(3 * v)
The output is:
[ 6 12]
Next, we multiply two vectors in a different way: the dot product.