Vector Calculator
Enter two vectors A and B in 2D or 3D and choose an operation. You get the answer with every step worked out using your numbers, plus a table with all the other operations at once and a diagram for 2D vectors.
How to use the Vector Calculator
- Choose 2D or 3D.
- Pick the operation, for example the cross product or the angle between the vectors.
- Enter the components of vector A and vector B.
- Press Calculate to see the result and the steps.
- Check the table for every other operation, or copy the results.
Vector formulas
| Operation | Formula (A = ⟨Aₓ, Aᵧ, A𝓏⟩, B = ⟨Bₓ, Bᵧ, B𝓏⟩) | Result type |
|---|---|---|
| Addition | A + B = ⟨Aₓ + Bₓ, Aᵧ + Bᵧ, A𝓏 + B𝓏⟩ | Vector |
| Subtraction | A − B = ⟨Aₓ − Bₓ, Aᵧ − Bᵧ, A𝓏 − B𝓏⟩ | Vector |
| Scalar multiple | kA = ⟨kAₓ, kAᵧ, kA𝓏⟩ | Vector |
| Magnitude | |A| = √(Aₓ² + Aᵧ² + A𝓏²) | Scalar |
| Dot product | A · B = AₓBₓ + AᵧBᵧ + A𝓏B𝓏 = |A||B| cos θ | Scalar |
| Cross product | A × B = ⟨AᵧB𝓏 − A𝓏Bᵧ, A𝓏Bₓ − AₓB𝓏, AₓBᵧ − AᵧBₓ⟩ | Vector (3D) |
| Angle | θ = arccos((A · B) / (|A||B|)) | 0° to 180° |
| Unit vector | Â = A / |A| | Vector of length 1 |
| Vector projection | proj_B A = (A · B / |B|²) B | Vector |
| Scalar projection | comp_B A = A · B / |B| | Scalar |
Worked example
For A = ⟨3, −2, 5⟩ and B = ⟨1, 4, −1⟩:
- A · B = 3·1 + (−2)·4 + 5·(−1) = −10, so the angle is obtuse.
- |A| = √38 ≈ 6.1644, |B| = √18 ≈ 4.2426, so cos θ = −10 / 26.153 ≈ −0.3824 and θ ≈ 112.48°.
- A × B = ⟨(−2)(−1) − 5·4, 5·1 − 3·(−1), 3·4 − (−2)·1⟩ = ⟨−18, 8, 14⟩, with length √584 ≈ 24.166 (the parallelogram area).
Properties worth remembering
- The dot product is commutative (A · B = B · A); the cross product is anti-commutative (A × B = −(B × A)).
- A · B = 0 means perpendicular; A × B = 0 means parallel (or a zero vector).
- |A × B| = |A||B| sin θ, the area of the parallelogram spanned by A and B; half of it is the triangle area.
- The direction of A × B follows the right-hand rule.
Frequently asked questions
How do you calculate the dot product?
Multiply matching components and add them: A · B = AₓBₓ + AᵧBᵧ + A𝓏B𝓏. For ⟨3, −2, 5⟩ and ⟨1, 4, −1⟩ that is 3 − 8 − 5 = −10. A dot product of 0 means the vectors are perpendicular.
How do you calculate the cross product?
For 3D vectors, A × B = ⟨AᵧB𝓏 − A𝓏Bᵧ, A𝓏Bₓ − AₓB𝓏, AₓBᵧ − AᵧBₓ⟩. The result is perpendicular to both A and B, and its length equals the area of the parallelogram they span.
Is there a cross product in 2D?
Not as a vector, but treating 2D vectors as ⟨x, y, 0⟩ gives ⟨0, 0, AₓBᵧ − AᵧBₓ⟩. The scalar AₓBᵧ − AᵧBₓ is often called the 2D cross product: its sign tells whether B is counter-clockwise (positive) or clockwise (negative) from A.
How do I find the angle between two vectors?
Use cos θ = (A · B) / (|A| |B|), then θ = arccos of that value. The angle is always between 0° and 180°. It is undefined if either vector is the zero vector.
What is a unit vector?
A vector of length 1 pointing in the same direction. Divide each component by the magnitude:  = A / |A|. For ⟨3, 4⟩, |A| = 5 and  = ⟨0.6, 0.8⟩.
What is the projection of A onto B?
The vector projection is proj_B A = (A · B / |B|²) B, the shadow of A along B. The scalar projection A · B / |B| is its signed length. A − proj_B A is the part of A perpendicular to B.
How is the magnitude of a vector calculated?
With the Pythagorean theorem: |A| = √(Aₓ² + Aᵧ² + A𝓏²). For ⟨3, −2, 5⟩ that is √38 ≈ 6.164414.