Year 1 · Week 05
Chapter 5: Vector Addition and Scalar Multiplication
Last week we learned how to represent vectors as column matrices. This week, we'll discover how to combine vectors together and scale them—essential skills for planning robot movements across a map.
Part 1: Combining Robot Moves
Imagine your robot needs to navigate through a maze. First, it moves 3 units right and 2 units up to avoid an obstacle. Then, it moves 1 unit right and 4 units up to reach a checkpoint. What's the total displacement from where it started?
This is exactly what vector addition does—it combines multiple movements into one total movement.
Adding Vectors Together
To add two vectors, we simply add their corresponding components. Let's represent our robot's two moves as column vectors:
First move:
[3]
[2]
Second move:
[1]
[4]
To find the total displacement, we add the x-components together (horizontal movement) and the y-components together (vertical movement):
Total displacement:
[3 + 1] [4]
[2 + 4] = [6]
The robot ended up 4 units to the right and 6 units up from its starting position. We can verify this makes sense: 3 + 1 = 4 horizontally, and 2 + 4 = 6 vertically.
Why Vector Addition Matters
Vector addition is incredibly useful for robot navigation:
- Path planning: Combine multiple movement segments into a total journey.
- Error correction: Add a correction vector to fix a positioning mistake.
- Force combination: In physics, forces are vectors that add together.
No matter how many moves your robot makes, you can add all the vectors together to find where it ends up relative to where it started.
Part 2: Scaling a Vector
Sometimes we don't want to add vectors—we want to make one bigger or smaller. That's where scalar multiplication comes in.
A "scalar" is just a regular number (not a vector). When we multiply a vector by a number, we stretch or shrink it:
Doubling a vector:
2 × [3] [6]
[2] = [4]
Each component gets multiplied by the scalar! This is like saying "move twice as far in the same direction."
For Loops in Python
This week we'll also learn about for loops in Python. Loops let us repeat code without writing it multiple times.
# Print numbers 1 to 5
for i in range(1, 6):
print(i) This prints: 1, 2, 3, 4, 5
Iterating Through Vector Components
We can use a for loop to go through the components of a vector:
vector = [3, 5, 2]
for component in vector:
print(component) This prints: 3, 5, 2