 # Math - Scalar Multiplication

In this lecture we look at scalar multiplication and how it can be used to alter the movement speed of the player.

For your challenge, we want to find out where the player will end up after a fixed set of instructions:

1. The player starts at (0, 0)
2. The player moves south (0, -1) at 5 units/second for 10 seconds
3. The player moves east (1, 0) at 2 units/second for 20 seconds
4. Where did they end up?

For some additional hints, watch to the very end of the video.

1 Like

(-50,40)

@EddieRocks, almost but not quite. Double check the order of your elements.

oops… gotcha… just did it in order not paying attention to direction

1 Like

happens to the best of us! I got (40,-50)

1 Like

Start at (0,0)

Move south at 5u/s for 10s = Move down on the y axis 50 units = (0, -50)
Then move east at 2u/s for 20s = Move right on the x axis 40 units = (40, -50)

The player ends up at (40, -50)

1 Like

1). StartPos = (0, 0)
2). PlayerVelocity1 = (0, -5)
- Scalar = 10 (seconds)
- 10(0, -5) = (0, -50)
3). PlayerVelocity2 = (2, 0)
- Scalar - 20 (seconds)
- 20(2, 0) = (40, 0)
4). StartPos + PlayerVelocity1 + PlayerVelocity2 = EndPos
- (0, 0) + (0, -50) + (40, 0) = (40, -50)
EndPos = (40, -50)

1 Like

SOUTH velocity is (0, -1) and the south speed is 5 u/s, which gives us (0, -5). The time he is moving SOUTH is 10 s, which has to be multiplied with the vector (0, -5) resulting in the SOUTH vector (0, -50).
EAST velocity is (1, 0) and the east speed is 2 u/s, which gives us (2, 0). The time the player is moving EAST is 20 s, which has to be multiplied with the vector (2,0) resulting in the EAST vector (40, 0).
Adding now the SOUTH and EAST vector results in (0, -50) + (40, 0) = (40, -50).
So the player ends up at (40, -50).