MathsLinear Algebra

Cross Product
calculator.

Find a × b for two 3D vectors, with its length, the areas and the angle.

How it's worked out

The cross product takes two vectors in three dimensions and gives a third vector at right angles to both. OpenStax writes it as a determinant with i, j and k, the unit vectors along x, y and z, in the top row. Expanding it gives one 2 by 2 determinant for each part.

a×b\displaystyle a \times b=|ijka1a2a3b1b2b3|\displaystyle {}= \begin{vmatrix} i & j & k \\ a_1 & a_2 & a_3 \\ b_1 & b_2 & b_3 \end{vmatrix}
x part\displaystyle x\text{ part}=a2b3−a3b2\displaystyle {}= a_2 b_3 - a_3 b_2
y part\displaystyle y\text{ part}=−(a1b3−a3b1)\displaystyle {}= -(a_1 b_3 - a_3 b_1)
z part\displaystyle z\text{ part}=a1b2−a2b1\displaystyle {}= a_1 b_2 - a_2 b_1

The minus sign on the middle part comes from the sign pattern of a determinant, and it is the step most people drop. For (1, 2, 3) and (4, 5, 6) the three parts are (−3, 6, −3).

The length of the result depends on θ, the angle between a and b. It equals the area of the parallelogram that a and b span, so half of it is the area of the triangle with those two sides.

|a×b|\displaystyle |a \times b|=|a||b|sin⁡θ\displaystyle {}= |a|\,|b| \sin\theta

The angle comes from the length and the dot product together, through atan2. A sine on its own cannot tell 45° from 135°, but the sign of the dot product can.

Cross products of the unit vectors (row × column)
×ijk
i0k−j
j−k0i
kj−i0

Worked examples

Jordan finds the area and normal of a triangle in a 3D model

Jordan has a triangle with corners P(1, 0, 0), Q(0, 1, 0) and R(0, 0, 1), the example OpenStax uses. Two edges from P give the vectors to cross.

PQ→×PR→\displaystyle \overrightarrow{PQ} \times \overrightarrow{PR}=⟨−1,1,0⟩×⟨−1,0,1⟩\displaystyle {}= \langle -1, 1, 0 \rangle \times \langle -1, 0, 1 \rangle=⟨1,1,1⟩\displaystyle {}= \langle 1, 1, 1 \rangle

The result (1, 1, 1) is the normal to the triangle, the direction a renderer needs for lighting. Its length is 1.7321, so the triangle's area is half that, about 0.866 square units.

Open this example in the tool

Ana works out the torque on a wrench

Ana pushes with 20 N straight along y on a wrench 0.5 m long that lies along x. Torque is the cross product of the lever arm and the force, with the arm first.

τ\displaystyle \tau=r×F\displaystyle {}= r \times F=⟨1/2,0,0⟩×⟨0,20,0⟩\displaystyle {}= \langle 1/2, 0, 0 \rangle \times \langle 0, 20, 0 \rangle=⟨0,0,10⟩\displaystyle {}= \langle 0, 0, 10 \rangle

The torque is 10 N·m and points along z, the axis the bolt turns about. Swapping the order to F × r would give (0, 0, −10), the same size the other way round.

Open this example in the tool

Kai checks an angle wider than a right angle

For (1, 0, 0) and (−1, 1, 0), a × b = (0, 0, 1) and the sine of the angle is 0.7071. That sine fits both 45° and 135°.

The dot product is −1, which is below 0, so the vectors point more apart than together. The angle is 135°.

Open this example in the tool

Reading your result

The order sets the direction. OpenStax gives b × a = −(a × b). Point your right hand along a and curl your fingers toward b; your thumb points along a × b. Turn the order round and the thumb points the other way.

Zero means parallel. If one vector is a multiple of the other, they span no area, so the cross product is 0. For (1, 2, 3) and (2, 4, 6) the result is (0, 0, 0).

Flat vectors still work. For two vectors in the xy plane, set the third part to 0. With (3, 1, 0) and (1, 2, 0) the result is (0, 0, 5): only the z part is left, and it equals the area of the parallelogram, with a sign that says which way round they turn.

For a volume, add a dot product. The box with edges (−1, −2, 1), (4, 3, 2) and (0, −5, −2) has u · (v × w) = −40, so its volume is 40 cubic units, the value in OpenStax Example 2.41.

Common mistakes

  • Dropping the minus on the middle part. The y part is minus the 2 by 2 determinant. Skipping that sign gives a vector that is not at right angles to a or b, which the check catches.
  • Mixing up the order. a × b and b × a point opposite ways. For torque the lever arm comes first.
  • Finding the angle with the sine alone. Inverse sine only returns angles up to 90°. Look at the dot product to tell an acute angle from an obtuse one.
  • Using the full length for a triangle. |a × b| is the parallelogram. The triangle is half of it.
  • Mixing units. A lever arm in centimeters with a force in newtons gives N·cm, 100 times the N·m figure.

Questions people ask

Not as they stand: the formula needs three parts each. Add 0 as the third part, and the answer points straight out of the plane, because no direction inside a plane is at right angles to two vectors that are not parallel. Its z part is the signed area, the same number as the 2 by 2 determinant of the two vectors.

Sources