Add and scale vectors, measure their lengths, and use a dot product to compare directions.
65 minYou need School algebra and the Pythagorean theorem
In this module you will
Interpret a column of numbers as a displacement or a list of measurements
Use linear combinations to assemble a vector
Compute lengths, angles and dot products
1
From a displacement to a column
Walk three metres east and four metres north. The displacement is the column vector v=(34). Moving the arrow to another starting point leaves the displacement the same. The entries are coordinates relative to two chosen axes.
A vector can also hold data. If the coordinates are temperatures at two stations, subtracting two days gives the change at each station. You can add vectors with the same coordinate convention and multiply a vector by a scalar, a single number. Multiplying by a negative number reverses the direction.
Example 1.1Combining moves✓ Checked
Take u=(2,1)T and v=(−1,3)T. Two copies of u followed by one v give 2u+v=(4,2)T+(−1,3)T=(3,5)T. A sum of scaled vectors is a linear combination.
Try it
Change the components of the two vectors. Compare their sum and dot product. Try perpendicular vectors, then point both in the same direction.
2
Length and angle
The dot productu⋅v pairs corresponding entries and adds their products. The Euclidean norm is ∥v∥=v⋅v. A vector of length one is a unit vector.
For nonzero vectors the angle θ satisfies
cosθ=∥u∥∥v∥u⋅v.
To see why, expand ∥u−v∥2 as a dot product, then compare with the cosine rule for the triangle. At a right angle the dot product is zero. A negative dot product means the angle is obtuse. Two vectors with zero dot product are orthogonal. The zero vector is orthogonal to every vector, but it has no direction and no angle with another vector.
Example 1.2A direction and a length✓ Checked
For u=(1,2)T and v=(2,−1)T, the dot product is 1⋅2+2(−1)=0. Both have length 5, so the nonzero vectors meet at a right angle.
Watch out
The sign of the dot product says something about the angle, not the length. The vector (−3,−4)T still has length 5.
Compute itExact vector arithmetic
SymPy uses a column when you pass a list to Matrix.
Python
from sympy import Matrix
v = Matrix([3, 4])
print(v.norm())
print(list(v / v.norm()))
Output
5
[3/5, 4/5]
3
Exercises
Exercise 1.1★A combination
Find 3(1,−2)T−2(2,1)T.
Show solution✓ Checked
Compute entry by entry. The first coordinate is 3−4=−1 and the second is −6−2=−8.
Exercise 1.2★★Find a perpendicular vector
Find a unit vector perpendicular to (3,4)T.
Show solution✓ Checked
The vector (−4,3)T has dot product −12+12=0 with the original and length 5. Divide it by 5. The opposite unit vector also works.
Exercise 1.3★★★Dot product from lengths
If ∥u∥=2,∥v∥=3 and ∥u+v∥2=7, find the dot product.
Show solution✓ Checked
Expanding the squared norm gives 7=4+2u⋅v+9. Thus u⋅v=−3.
4
Check yourself
1
What is the length of (0,−5)T?
Length is the non-negative square root of the sum of the squared entries.
2
Which vector is orthogonal to (2,1)T?
The dot product is 2(−1)+1⋅2=0.
3
When is v/∥v∥ defined?
The denominator is positive exactly for nonzero vectors.