How to use the 2D vector calculator
- Enter vector u as u x and u y.
- Enter vector v as v x and v y.
- Read the Dot product (u·v) first. Below it are the Cross product (2D scalar, u×v), the lengths |u| and |v|, u + v and u − v.
- Read Angle between, Unit vector of u and Projection of u on v.
What it does and when to use it
Vectors describe anything with a size and a direction: a force, a velocity, a displacement on a map, or a direction in a game. The dot product and angle tell you how much two directions agree, which matters for work done by a force or lighting in graphics. The projection splits one vector into the part along another, such as the part of gravity acting down a slope. The cross-product sign tells a program whether to turn left or right.
For vectors with a z component, use the 3D vector calculator. The length |u| is the same calculation as the distance between two points from the origin. The trigonometry calculator helps when you start from a length and an angle.
How it works
For u = (u.x, u.y) and v = (v.x, v.y):
- Dot product: u·v = u.x × v.x + u.y × v.y
- 2D cross product: u×v = u.x × v.y − u.y × v.x
- Magnitude: |u| = √(u.x² + u.y²)
- Sum and difference: add or subtract matching components
- Angle: θ = arccos(u·v ÷ (|u| × |v|))
- Unit vector: u ÷ |u|
- Projection of u on v: (u·v ÷ |v|²) × v
Worked examples
Angle between two vectors, step by step. u = (2, 3) and v = (5, −1).
- Dot product: 2 × 5 + 3 × (−1) = 10 − 3 = 7.
- Lengths: |u| = √(4 + 9) = √13 = 3.605551275 and |v| = √(25 + 1) = √26 = 5.099019514.
- cos θ = 7 ÷ (3.605551275 × 5.099019514) = 7 ÷ 18.38477631 = 0.3807498053.
- θ = arccos(0.3807498053).
The tool shows Angle between: 67.61986495° and Cross product (2D scalar, u×v): -17. The negative sign means v lies clockwise from u.
Splitting a vector. u = (6, 8) and v = (1, 0), a unit vector along the x-axis. The tool gives Projection of u on v: (6, 0), the horizontal part of u. The unit vector of u is (0.6, 0.8), and the angle is 53.13010235°.
Limits and tips
- Only two components per vector. Points are not vectors: subtract start from end first if you have coordinates.
- Results show up to 10 significant figures. Keep extra digits if you reuse a result in a later step.
- There are no units; components can be in any unit, as long as both vectors use the same one.
- Everything runs in your browser.
Frequently asked questions
What does the sign of the dot product mean?
What is a 2D cross product?
Is the angle between vectors always positive?
What if one vector is (0, 0)?
How do we know nothing is uploaded? Test it yourself on the privacy proof page.