Vector calculator with every component worked out
Cross product, dot product, magnitude, unit vector and the angle between two vectors, in two or three dimensions. Each component is calculated in front of you, the sign flip on the j term is shown rather than assumed, and a cross product is checked for perpendicularity before it is reported.
Uses the same cofactor expansion as the matrix solver, because a cross product is a 3×3 determinant.
Two products that answer completely different questions
The two vector products are not variants of the same operation. The dot product takes two vectors and returns a single number, which measures how much they point the same way. The cross product takes two vectors and returns a third vector, perpendicular to both, whose length measures how much they fail to point the same way.
That is why the dot product of perpendicular vectors is zero (no shared direction at all) while the cross product of perpendicular vectors is at its largest. They are complementary measurements, and knowing which one a question wants is most of the work.
A second practical difference: the dot product works in any number of dimensions, while the cross product is only defined in three. A 2D cross product is really a 3D one with both z components set to zero, which is why the answer always comes out along the z axis.
Dot product
a · b = a₁b₁ + a₂b₂ + a₃b₃
A single number. Zero means perpendicular; positive means broadly the same direction; negative means broadly opposite.
Cross product
|a × b| = |a||b| sin θ
A vector perpendicular to both inputs. Its length equals the area of the parallelogram the two vectors span.
Magnitude
|a| = √(a₁² + a₂² + a₃²)
Pythagoras in as many dimensions as you have. The length of the arrow, ignoring direction.
Unit vector
â = a / |a|
The same direction, scaled to length exactly 1. Used whenever direction matters and size does not.
How to work out a cross product by hand
Put i, j, k across the top row, the components of a in the second row, and the components of b in the third. The cross product is the determinant of that 3×3 array.
Each of i, j and k gets the 2×2 determinant of the four numbers not in its row or column. That is the same cofactor expansion the matrix solver uses for any 3×3 determinant.
The middle term carries a negative sign from the cofactor pattern + − +. Losing that sign is the single most common error in the whole calculation, and it produces an answer that is wrong only in one component, which makes it easy to miss.
The result must be perpendicular to both inputs, so a · (a × b) and b · (a × b) should both be exactly zero. This calculator runs that check and shows it.
a × b = −(b × a). Swapping the inputs reverses the result. The dot product, by contrast, is unchanged by swapping.
One of each, the way you would write them out
Cross product in 3D
⟨1, 2, 3⟩ × ⟨4, 5, 6⟩- i component: (2)(6) − (3)(5) = 12 − 15 = −3.
- j component, with the sign flip: −[(1)(6) − (3)(4)] = −[6 − 12] = 6.
- k component: (1)(5) − (2)(4) = 5 − 8 = −3.
- Check: ⟨1,2,3⟩ · ⟨−3,6,−3⟩ = −3 + 12 − 9 = 0, so the result is perpendicular to a as it must be.
Unit vector
⟨3, 4⟩- Magnitude: √(3² + 4²) = √25 = 5.
- Divide each component by 5: ⟨3/5, 4/5⟩.
- Check the length: √((3/5)² + (4/5)²) = √(9/25 + 16/25) = √1 = 1.
- The direction is unchanged; only the length has been normalised.
Angle between two vectors
⟨1, 0, 0⟩ and ⟨0, 1, 0⟩- Dot product: (1)(0) + (0)(1) + (0)(0) = 0.
- Magnitudes: both are 1.
- cos θ = 0 / (1 × 1) = 0.
- θ = cos⁻¹(0) = 90°, which is what a zero dot product always means.
What the cross product is for
The length of a × b is the area of the parallelogram the two vectors span, which makes it the standard way to get the area of a triangle from three points in 3D: take two edge vectors, cross them, and halve the magnitude.
In physics it is torque (τ = r × F), angular momentum, and the magnetic force on a moving charge. In graphics it is how a surface normal is computed from two edges of a polygon, which is what lighting calculations need. In each case the point is the same: you have two directions and you want the direction perpendicular to both.
The unit tangent vector
A unit tangent vector is the ordinary unit vector applied to a derivative: differentiate the position vector to get the velocity r′(t), then divide by its magnitude. The normalising step is exactly the one this calculator performs, so work out r′(t) at your value of t with the derivative calculator, then enter those components here.
The same pattern covers the unit normal and the binormal: differentiate, then normalise, and use a cross product for the third direction.
Vector calculator FAQ
How do you calculate the cross product of two vectors?
Write i, j, k across the top of a 3×3 determinant with the components of a in the second row and b in the third, then expand along the top row. The i component is a₂b₃ − a₃b₂, the j component is −(a₁b₃ − a₃b₁), and the k component is a₁b₂ − a₂b₁. The minus sign on the j term is the part most people forget.
What is the difference between the dot product and the cross product?
The dot product returns a number and measures how much two vectors point the same way; it is zero when they are perpendicular. The cross product returns a vector perpendicular to both, and its length is largest when the inputs are perpendicular. The dot product works in any dimension; the cross product only in three.
Can you take the cross product of 2D vectors?
Not strictly, because the cross product is a three-dimensional operation. In practice a 2D vector is treated as having z = 0, which makes the result point purely along the z axis. Its z component, a₁b₂ − a₂b₁, is the signed area of the parallelogram the two 2D vectors span.
How do you find a unit vector?
Divide every component by the vector's magnitude. For ⟨3, 4⟩ the magnitude is 5, so the unit vector is ⟨3/5, 4/5⟩. Check by confirming the components' squares add to 1. The zero vector has no unit vector, because it has no direction to preserve.
Why is a × b not the same as b × a?
Because the cross product is anticommutative: swapping the inputs reverses the result, so a × b = −(b × a). Geometrically the perpendicular direction flips to the other side of the plane. The dot product has no such property; a · b and b · a are always equal.
How do you find the angle between two vectors?
Use cos θ = (a · b) / (|a| |b|), then take the inverse cosine. The formula always returns an angle between 0° and 180°, which is the angle measured within the plane the two vectors share.
Is this vector calculator free?
Yes, with no account and no limit. Every operation shows its working, including the perpendicularity check on a cross product, and nothing you enter leaves your browser.
Tools that go with vectors
Matrix Solver
Determinants and inverses for 2×2 and 3×3, entry by entry.
Derivative Calculator
Differentiate a position vector's components for tangent vectors.
Trigonometry
The sine and cosine behind the angle-between formula.
Geometry Solver
Areas, volumes and the Pythagorean theorem with steps.
Slope Calculator
The 2D version of direction, with the full line from two points.