Thanks to David Eberly for teaching me.

The cross product comes from the determinant.

Let’s take a step back.

Say we have 2D vector a = ( Xa, Ya ), and we want to find a vector perpendicular to it. If we stick the X basis vector, Y basis vector, and a into a 2×2 matrix, the determinant resultsĀ in a vector perpendicular to a.

X = ( 1, 0 )

Y = ( 0, 1 )

a = ( Xa, Ya )

det| X Y | = X * Ya -

| Xa Ya | Y * Xa

= ( 1, 0 ) * Ya -

( 0, 1 ) * Xa

= ( Ya, -Xa )

As you can see, thisĀ is a clockwise rotation by 90 degrees.

Moving to 3D, in order to have a 3×3 matrix, we need another vector.

Sticking the basis vectors X, Y, and Z into our matrix along with a = ( Xa, Ya, Za ) and b = ( Xb, Yb, Zb ) and taking the determinant results in a vector perpendicular to both a and b – our friend the cross product.

let X = ( 1 , 0 , 0 )

let Y = ( 0 , 1 , 0 )

let Z = ( 0 , 0 , 1 )

let a = ( Xa, Ya, Za )

let b = ( Xb, Yb, Zb )

det| X Y Z | = X * ( Ya * Zb - Za * Yb ) -

| Xa Ya Za | Y * ( Xa * Zb - Za * Xb ) +

| Xb Yb Zb | Z * ( Xa * Yb - Ya * Xb )

= ( 1, 0, 0 ) * ( Ya * Zb - Za * Yb ) -

( 0, 1, 0 ) * ( Xa * Zb - Za * Xb ) +

( 0, 0, 1 ) * ( Xa * Yb - Ya * Xb )

= ( Ya * Zb - Za * Yb,

Za * Xb - Xa * Zb,

Xa * Yb - Ya * Xb )