Math
Vector calculator
Enter two vectors in 2D or 3D and pick an operation, or leave it on “Everything” to see every common result at once. Each operation shows its working with your numbers substituted, and answers stay as fractions (−5/7, not −0.714286) where they can.
Two or three components, or i, j, k form.
| Quantity | Result |
|---|---|
| a + b | ⟨4, 2, 3⟩ |
| a − b | ⟨2, −6, 7⟩ |
| a · b | −15 |
| a × b | ⟨−16, 11, 14⟩ |
| |a| | √38 ≈ 6.16441 |
| |b| | √21 ≈ 4.58258 |
| Unit vector â | ⟨0.4867, −0.3244, 0.8111⟩ |
| Angle between | 122.07° |
| projb a | ⟨−5/7, −20/7, 10/7⟩ |
| Scalar projection | −3.27327 |
Show the working, step by step
Dot product: multiply matching components and add.
a · b = 3×1 + (−2)×4 + 5×(−2) = −15
Magnitudes.
|a| = √(3² + (−2)² + 5²) = √38 ≈ 6.16441 |b| = √(1² + 4² + (−2)²) = √21 ≈ 4.58258
Angle from cos θ = a · b ÷ (|a||b|).
θ = arccos(−0.530994) = 122.07°
Projection of a onto b: (a · b / |b|²) b.
(−15/21) ⟨1, 4, −2⟩ = ⟨−5/7, −20/7, 10/7⟩
Choose a single operation above for its full working.
The formulas
For a = ⟨a₁, a₂, a₃⟩ and b = ⟨b₁, b₂, b₃⟩ (drop the third component in 2D):
a ± b = ⟨a₁ ± b₁, a₂ ± b₂, a₃ ± b₃⟩ k·a = ⟨ka₁, ka₂, ka₃⟩ a · b = a₁b₁ + a₂b₂ + a₃b₃ = |a||b| cos θ a × b = ⟨a₂b₃ − a₃b₂, a₃b₁ − a₁b₃, a₁b₂ − a₂b₁⟩ |a| = √(a₁² + a₂² + a₃²) â = a ÷ |a| cos θ = (a · b) ÷ (|a||b|) projb a = (a · b ÷ |b|²) b
A worked example
The calculator starts with a = ⟨3, −2, 5⟩ and b = ⟨1, 4, −2⟩.
- Sum and difference: a + b = ⟨4, 2, 3⟩ and a − b = ⟨2, −6, 7⟩.
- Dot product: 3×1 + (−2)×4 + 5×(−2) = 3 − 8 − 10 = −15.
- Magnitudes: |a| = √(9 + 4 + 25) = √38 ≈ 6.16441, and |b| = √(1 + 16 + 4) = √21 ≈ 4.58258.
- Angle: cos θ = −15 ÷ (6.16441 × 4.58258) = −0.530994, so θ = 122.07°.
- Cross product: ⟨(−2)(−2) − 5×4, 5×1 − 3×(−2), 3×4 − (−2)×1⟩ = ⟨−16, 11, 14⟩.
- Projection of a onto b: (−15 ÷ 21) b = −5/7 × ⟨1, 4, −2⟩ = ⟨−5/7, −20/7, 10/7⟩.
A quick sanity check: the dot product is negative and the angle is over 90°. Those always agree, because |a| and |b| are positive, so a · b takes the sign of cos θ.
What each result tells you
| Operation | Result is a | Use it for |
|---|---|---|
| a + b, a − b | Vector | Combining forces or displacements; the vector from one point to another |
| k·a | Vector | Scaling a velocity or force; k < 0 reverses the direction |
| a · b | Scalar | Work done (force · displacement); testing for perpendicular vectors |
| a × b | Vector (3D) | A normal to a plane; torque; the area of a parallelogram |
| |a|, â | Scalar, vector | Length and pure direction, e.g. speed and heading |
| projb a | Vector | The part of a force acting along a slope or axis |
Common mistakes
- Treating the dot product as a vector. a · b is one number. Writing ⟨3, −8, −10⟩ for the example above is the component-wise product, which has no standard geometric meaning.
- Swapping the order in a cross product. b × a = −(a × b). The dot product does not care about order; the cross product does.
- Projecting the wrong way round. projb a lies along b and divides by |b|². proja b lies along a and gives a different vector.
- Mixing 2D and 3D. Adding ⟨1, 2⟩ to ⟨1, 2, 3⟩ is undefined. The calculator refuses, except for the cross product, where a 2D vector is treated as having z = 0.
- Rounding too early. Keep √38 and √21 exact until the last step. Rounding each magnitude to one decimal place (6.2 and 4.6) moves the angle from 122.07° to 121.73°.
Perpendicular and parallel vectors
Two non-zero vectors are perpendicular exactly when a · b = 0, and parallel exactly when a × b = 0 (in 3D) or when one is a scalar multiple of the other. ⟨2, 1⟩ and ⟨−1, 2⟩ are perpendicular because 2×(−1) + 1×2 = 0. ⟨2, −4, 6⟩ and ⟨−1, 2, −3⟩ are parallel, pointing opposite ways, because the first is −2 times the second.
Common questions
How do I find the dot product of two vectors?
Multiply the matching components and add the results. For a = ⟨3, −2, 5⟩ and b = ⟨1, 4, −2⟩: 3×1 + (−2)×4 + 5×(−2) = 3 − 8 − 10 = −15. The answer is a single number, not a vector. It is negative here, which tells you the angle between the vectors is more than 90°.
What is the difference between the dot product and the cross product?
The dot product gives a scalar, a · b = |a||b| cos θ, and measures how much two vectors point the same way. The cross product gives a vector, perpendicular to both, whose length |a||b| sin θ is the area of the parallelogram they span. The dot product works in any number of dimensions; the cross product is defined only in 3D. See the cross product calculator for the full working.
How do you find the angle between two vectors?
Rearrange the dot product formula: cos θ = (a · b) ÷ (|a||b|), then take the inverse cosine. For the default vectors, cos θ = −15 ÷ (√38 × √21) = −0.530994, so θ = 122.07°. The result always lies between 0° and 180°.
What is a unit vector?
A vector of length 1 pointing the same way as the original. Divide each component by the magnitude: for a = ⟨3, −2, 5⟩, |a| = √38 ≈ 6.16441, so â ≈ ⟨0.486664, −0.324443, 0.811107⟩. The zero vector has no unit vector because it has no direction.
What is the projection of one vector onto another?
The vector projection of a onto b is the “shadow” of a along b: projb a = (a · b ÷ |b|²) b. With a · b = −15 and |b|² = 21 the factor is −5/7, giving ⟨−5/7, −20/7, 10/7⟩. The minus sign means the shadow points opposite to b. The scalar projection, a · b ÷ |b| = −3.27327, is its signed length.
Can I enter vectors in i, j, k notation?
Yes. 3i − 2j + 5k, 3, -2, 5, (3, -2, 5) and
⟨3, −2, 5⟩ are all read the same way. A missing coefficient counts as 1, so
i − k is ⟨1, 0, −1⟩. Leave out k entirely for a 2D vector.
Related calculators
-
Cross product
a × b with the determinant expansion and a perpendicularity check.
-
Magnitude and direction
Length, direction angle, bearing and direction cosines.
-
Vector analysis
Triple products, independence, areas and Gram–Schmidt.
-
Matrix calculator
Determinant, inverse, RREF, rank and eigenvalues.