cross

cross(A, B)

Try it yourself:

See also:

Find a perpendicular vector with cross

cross(A, B) calculates the cross product of two three-dimensional vectors. The result is perpendicular to both inputs, with direction determined by the right-hand rule and magnitude equal to the area of the parallelogram they span.

Example and interpretation

cross([1, 0, 0], [0, 1, 0]) returns [0, 0, 1]. Reversing the inputs reverses the result, so order matters. The magnitude is zero for parallel vectors. Use norm to measure the output length, and dot to check perpendicularity: the dot product of the cross result with either original vector is zero.

Applications

Cross products produce surface normals in 3D graphics, torque in mechanics, and oriented area in geometry. Normalize the result when only direction is required. For matrix and vector multiplication, use multiply; a cross product is a specific geometric operation, not general multiplication.

Input requirements

Both inputs must represent compatible three-component vectors. Do not use cross for two-dimensional vectors unless you deliberately embed them in 3D with a zero z-component. Check shapes with size, and use subtract to form direction vectors from pairs of points before applying cross.

Try Cross in Calcul.io

Start with one of the editable examples above, then replace its arguments with your own values. Keeping the function on a separate calculator line makes the input and result easy to compare. For a longer workflow, assign the result to a variable or reference that line in the next expression.

Check the shown signature before adding optional arguments, and use the related-function links to compare operations with similar purposes.

All functions