Mathematical concepts
Vector magnitude and direction
Also called: polar form · resolving a vector · unit vector · atan2
Definition
A 2D vector can be written as components (x, y) or as a magnitude and a direction angle; cosine and sine convert between the two.
Picture it
Resolving a force means asking how much of it acts along each axis. The magnitude is the arrow's length and the angle is where it points. Use atan2(y, x) rather than atan(y / x) so the angle lands in the correct quadrant.
The maths
x = r cos θ, y = r sin θ r = √(x² + y²) θ = atan2(y, x)
| Quantity | Unit | Symbol |
|---|---|---|
| length | metre | m |
| angle | radian | rad |
| angle | degree | ° |
Worked example
A rope pulls with 50 N at 40° above horizontal. What are the horizontal and vertical components?
- F_x = 50 cos 40° = 50 × 0.766 = 38.3 N
- F_y = 50 sin 40° = 50 × 0.643 = 32.1 N
AnswerAbout 38.3 N horizontal and 32.1 N vertical.
✓ The 2 numbers in this answer are recomputed from scratch by an automated test.
tip to tail
Vector adder
a = (6, 0), b = (1.53e-16, 2.5)
a + b = (6, 2.5): length 6.5 at 22.6°
a + b = (6, 2.5): length 6.5 at 22.6°
2D vectors; angles measured anticlockwise from the +x axis.
Common misconceptions
- Misconception: atan(y/x) cannot tell (1, 1) from (−1, −1); atan2 can.
- Misconception: Calculators and Python's math module may be in radians: check before taking sin 40.