Add, subtract, and project vectors
2D and 3D vector arithmetic — sum, difference, dot product, magnitude, angle, and the projection of one vector onto another.
Tools used in this guide
The job
Physics homework, game math, and graphics code all need the same handful of vector operations. The tool computes them together so a dot product, angle, and projection stay consistent with one set of inputs.
Enter two vectors
Type the components of a and b in 2D or 3D. Results include a+b, a−b, a·b, a×b (3D), |a| and |b|, the angle between them, the scalar projection of a onto b, and the unit vector of a.
- The angle uses the dot-product definition, so it degenerates to undefined when either vector is zero.
- Scalar projection of a onto b is a·b / |b| — the signed length of a along b.
Worked example
a = (3, 4), b = (1, 0): a·b = 3, |a| = 5, angle = cos⁻¹(3/5) ≈ 53.13°, and the scalar projection of a onto b is exactly 3.
Where it stops
Real vectors in 2D or 3D only — no cross product display for 2D, no matrices, and no complex components. Component magnitudes are capped at 1e12. A zero vector makes angle and projection undefined rather than throwing.