Vector Calculator
This vector calculator adds and subtracts 2D or 3D vectors and finds the dot product, cross product, magnitudes and the angle between them. For (1, 2, 2) and (2, −1, 2) the dot product is 4 and the angle is 63.61°.
Sources: OpenStax Calculus Volume 3 Updated
Vector 1
Vector 2
Operations
Result
Vector formulas
For v1 = (x₁, y₁, z₁) and v2 = (x₂, y₂, z₂), as defined in OpenStax Calculus:
| Operation | Formula |
|---|---|
| Sum | (x₁ + x₂, y₁ + y₂, z₁ + z₂) |
| Magnitude | |v| = √(x² + y² + z²) |
| Dot product | x₁x₂ + y₁y₂ + z₁z₂ |
| Angle | cos θ = (v1 · v2) ÷ (|v1| × |v2|) |
| Cross product | (y₁z₂ − z₁y₂, z₁x₂ − x₁z₂, x₁y₂ − y₁x₂) |
| Unit vector | v ÷ |v| |
How to find the angle between two vectors
Set 3D mode with v1 = (1, 2, 2) and v2 = (2, −1, 2).
- Magnitudes: |v1| = √(1 + 4 + 4) = 3 and |v2| = √(4 + 1 + 4) = 3.
- Dot product: (1 × 2) + (2 × −1) + (2 × 2) = 2 − 2 + 4 = 4.
- Cosine of the angle: 4 ÷ (3 × 3) = 0.4444.
- Angle: arccos(0.4444) = 1.1102 radians, or 63.61°.
This angle formula comes from the geometric meaning of the dot product. The dot product calculator works out the dot product on its own, with each multiplication shown.
The cross product of the example
For the same two vectors the cross product is (2 × 2 − 2 × (−1), 2 × 2 − 1 × 2, 1 × (−1) − 2 × 2) = (6, 2, −5). It is at right angles to both: (1, 2, 2) · (6, 2, −5) = 6 + 4 − 10 = 0.
The cross product calculator shows each component's working and the area the two vectors span.
2D mode and 3D mode
In 2D mode the z input is hidden and set to 0, so every formula above still applies with a zero third component. The cross product button is hidden in 2D, because the cross product of two flat vectors points out of the plane.
The magnitude of v2 − v1 is the distance between the two points the vectors end at, the same result as the distance between two points calculator.
Unit vectors and the zero vector
Normalising divides each component by the magnitude and gives a vector of length 1 in the same direction: (1, 2, 2) becomes (1/3, 2/3, 2/3). The zero vector has no direction, so the calculator shows an error instead of dividing by zero.
To describe a vector by its length and angles instead of x, y and z, use the vector coordinate converter.
Questions about vectors
How do you find the magnitude of a vector?
Square each component, add the squares and take the square root. For (1, 2, 2): √(1 + 4 + 4) = √9 = 3.
How do you find the angle between two vectors?
Divide the dot product by the product of the two magnitudes, then take the inverse cosine. For (1, 2, 2) and (2, −1, 2): cos θ = 4 ÷ (3 × 3) = 0.4444, so θ = 63.61°.
What does a dot product of 0 mean?
The vectors are perpendicular: cos 90° = 0. A positive dot product means the angle is less than 90°, and a negative one means it is more.
Sources
- OpenStax Calculus Volume 3, 2.2 Vectors in Three Dimensions — vector addition, magnitude and unit vectors in three dimensions (checked October 16, 2026)
- OpenStax Calculus Volume 3, 2.3 The Dot Product — the dot product and the angle between two vectors (checked October 16, 2026)