Calculate the dot product, cross product, magnitude, angle, projection and sum of two 2D or 3D vectors, with the step-by-step working for each.
Homework on vectors rarely asks for one thing. A question wants the dot product, then the angle, then whether the two are perpendicular, and a physics problem adds a projection on top. Doing each by hand means repeating the same components four times, with four chances to drop a minus sign.
Type the components of A and B once, in 2D or 3D, and every result appears together: dot and cross product, both magnitudes and unit vectors, the angle in degrees and radians, sum, difference, a scalar multiple, scalar and vector projection, and the areas the two vectors span. Components can be whole numbers, decimals or fractions like 2/3.
The page opens on these two vectors with the scalar k = 2:
Load Sample moves on to a perpendicular pair in 2D, (3, 4) and (4, −3); a parallel pair, (1, 2, 3) and (2, 4, 6); the unit vectors î × ĵ = k̂; and the projection of (5, 2) onto (1, 1). The Step-by-step working panel writes out each product with the real numbers in brackets, ready to copy into a solution. Swap A and B shows at once that the cross product flips sign while the dot product stays the same.
A·B = a₁b₁ + a₂b₂ + a₃b₃, and the angle follows from cos θ = A·B ÷ (|A| |B|). The cross product is (a₂b₃ − a₃b₂, a₃b₁ − a₁b₃, a₁b₂ − a₂b₁); its length is the area of the parallelogram the vectors span, and half of it is the triangle. In 2D the vectors are treated as (x, y, 0), so the cross product is the single z value a₁b₂ − a₂b₁. The vector projection of A on B is (A·B ÷ |B|²) B.
Results show up to 6 significant figures. A pair counts as perpendicular when A·B is within one billionth of |A| |B| of zero, so rounding in a typed decimal does not hide a right angle; the same tolerance on the cross product decides parallel and antiparallel. With a zero vector the angle, unit vector and projection are shown as undefined instead of a division by zero. A decimal comma is refused with “A's x component has a comma. Use a dot for decimals, such as 2.5.” and a blank k is read as 1.
Dimensions
Components can be whole numbers, decimals or fractions: 3, -1.5, 2/3.
A = (2, -1, 3) · B = (4, 0, -2)
A·B = 2A×B = (2, 16, 4)
Neither parallel nor perpendicular.
| A · B (dot product) | 2 |
| A × B (cross product) | (2, 16, 4) |
| |A| | 3.74166 |
| |B| | 4.47214 |
| Angle between | 83.1354° (1.45099 rad) |
| A + B | (6, -1, 1) |
| A − B | (-2, -1, 5) |
| 2 · A | (4, -2, 6) |
| Unit vector of A | (0.534522, -0.267261, 0.801784) |
| Unit vector of B | (0.894427, 0, -0.447214) |
| Scalar projection of A on B | 0.447214 |
| Vector projection of A on B | (0.4, 0, -0.2) |
| Parallelogram area |A × B| | 16.6132 |
| Triangle area ½|A × B| | 8.30662 |
Dot product: 2 × 4 + (-1) × 0 + 3 × (-2) = 2
Cross product:
x = (-1) × (-2) − 3 × 0 = 2
y = 3 × 4 − 2 × (-2) = 16
z = 2 × 0 − (-1) × 4 = 4
Magnitude: |A| = √(2² + (-1)² + 3²) = √14 = 3.74166
Angle: cos θ = 2 ÷ (3.74166 × 4.47214) = 0.119523, so θ = 83.1354°
Projection: proj = (A·B ÷ |B|²) B = (2 ÷ 20) × (4, 0, -2) = (0.4, 0, -0.2)
Results show up to 6 significant figures; A·B within one billionth of |A||B| of zero counts as perpendicular.