Cross Product Calculator – 3D Vectors
Calculate the cross product of two 3D vectors with step-by-step solution. Use this free online math calculator for instant, accurate results. No signup.
Cross Product: Definition and Formula
The cross product (also called the vector product) of two 3D vectors A and B produces a third vector that is perpendicular to both input vectors. It is defined only in 3-dimensional space (and 7-dimensional space for a higher-dimensional generalization), unlike the dot product which works in any number of dimensions.
Given A = (Ax, Ay, Az) and B = (Bx, By, Bz), the cross product is:
A × B = (AyBz − AzBy, AzBx − AxBz, AxBy − AyBx)
The magnitude of the cross product: |A × B| = |A||B|sin(θ), where θ is the angle between A and B. This equals the area of the parallelogram formed by the two vectors — a beautiful geometric interpretation. If the vectors are parallel (θ = 0° or 180°), the cross product is the zero vector.
The direction of A × B is determined by the right-hand rule: point your right hand's fingers in the direction of A, curl them toward B, and your thumb points in the direction of A × B. This means cross product is anti-commutative: A × B = −(B × A). The order matters — reversing the operands flips the direction.
The cross product can be computed using a determinant notation: A × B = det([[î, ĵ, k̂], [Ax, Ay, Az], [Bx, By, Bz]]), where î, ĵ, k̂ are the unit vectors in the x, y, z directions. Expanding this determinant gives the component formula above.
Cross Product vs Dot Product: Key Differences
Both the cross product and dot product are fundamental operations on vectors, but they differ profoundly in nature and application. Understanding both operations is essential for physics, engineering, and computer graphics.
| Property | Dot Product (A · B) | Cross Product (A × B) |
|---|---|---|
| Result type | Scalar (a number) | Vector (a 3D vector) |
| Formula | AxBx + AyBy + AzBz | (AyBz−AzBy, AzBx−AxBz, AxBy−AyBx) |
| Geometric meaning | |A||B|cos(θ) — projection/alignment | |A||B|sin(θ) — area of parallelogram |
| Zero when | A ⊥ B (perpendicular) | A ∥ B (parallel) |
| Maximum when | A ∥ B (parallel), max = |A||B| | A ⊥ B (perpendicular), max = |A||B| |
| Commutative? | Yes: A · B = B · A | No (anti-commutative): A × B = −(B × A) |
| Dimensions | Any n dimensions | 3D only (or 7D) |
| Key application | Angles, projections, work | Normals, torque, angular momentum |
A quick way to remember which is which: the dot product measures how much two vectors point in the same direction (think "agreement"). The cross product measures how much they point in different directions and gives the perpendicular axis of their "spin."
Step-by-Step Cross Product Examples
Working through examples with different vector configurations builds intuition for the cross product.
| Vector A | Vector B | A × B | |A × B| | Notes |
|---|---|---|---|---|
| (1, 0, 0) | (0, 1, 0) | (0, 0, 1) | 1 | î × ĵ = k̂ (right-hand rule) |
| (0, 1, 0) | (0, 0, 1) | (1, 0, 0) | 1 | ĵ × k̂ = î |
| (0, 0, 1) | (1, 0, 0) | (0, 1, 0) | 1 | k̂ × î = ĵ |
| (1, 0, 0) | (1, 0, 0) | (0, 0, 0) | 0 | Parallel vectors → zero cross product |
| (2, 3, 4) | (5, 6, 7) | (−3, 6, −3) | 7.35 | Standard 3D example |
| (1, 2, 3) | (4, 5, 6) | (−3, 6, −3) | 7.35 | Same result as row above |
| (3, 0, 0) | (0, 4, 0) | (0, 0, 12) | 12 | Area of 3×4 rectangle = 12 ✓ |
| (1, 1, 0) | (0, 1, 1) | (1, −1, 1) | 1.732 | Area = |A||B|sin(θ) = √2 × √2 × sin(60°) = √3 ≈ 1.732 ✓ |
Step-by-step for A = (2, 3, 4), B = (5, 6, 7):
- x-component: AyBz − AzBy = (3)(7) − (4)(6) = 21 − 24 = −3
- y-component: AzBx − AxBz = (4)(5) − (2)(7) = 20 − 14 = 6
- z-component: AxBy − AyBx = (2)(6) − (3)(5) = 12 − 15 = −3
- Result: A × B = (−3, 6, −3)
Physics Applications: Torque, Angular Momentum, and Magnetic Force
The cross product is indispensable in physics. Its ability to produce a perpendicular vector from two in-plane vectors makes it the natural tool for describing rotational phenomena.
Torque (τ = r × F): Torque is the cross product of position vector r (from pivot to force application point) and force vector F. If you apply a 20 N force perpendicular to a 0.3 m wrench, τ = 0.3 × 20 × sin(90°) = 6 N·m. The cross product gives both magnitude and the axis of rotation. This is exactly what a wrench does: r is the wrench length, F is your hand force, and r × F determines whether the bolt turns clockwise or counterclockwise.
Angular momentum (L = r × p): Angular momentum is the cross product of position and linear momentum (p = mv). For a planet orbiting the Sun, L = r × mv = constant (conservation of angular momentum, from Kepler's second law). The cross product's direction gives the orbital plane's normal vector.
Magnetic force (F = q v × B): The force on a charged particle moving through a magnetic field is F = qv × B, where q is charge, v is velocity, and B is the magnetic field vector. The cross product means the force is always perpendicular to both v and B — this causes circular motion in a uniform magnetic field, the basis of cyclotrons and mass spectrometers.
Electric field of a moving charge: The Biot-Savart law for the magnetic field of a current: dB = (μ₀I/4π) × (dl × r̂/r²). The cross product dl × r̂ ensures the field circles around the current — explaining why current-carrying wires create circular magnetic fields.
Computer Graphics and 3D Applications
The cross product is the workhorse of 3D graphics programming. Nearly every 3D rendering pipeline uses it extensively for lighting, collision detection, and geometry processing.
Surface normals: Given a triangular face with vertices P₁, P₂, P₃: compute edge vectors e₁ = P₂ − P₁ and e₂ = P₃ − P₁. The normal vector n = e₁ × e₂ is perpendicular to the face. Normalize n (divide by |n|) to get the unit normal. This normal is used in lighting calculations (Phong shading): the dot product of the normal and light direction determines surface brightness (diffuse reflection).
Camera and view matrices: In 3D graphics (OpenGL, DirectX, Unity), the camera's view matrix is constructed using cross products. Given a camera position, a look-at target, and an up vector, the right vector = up × forward (or forward × up depending on convention). These three orthogonal vectors define the camera coordinate frame.
Collision detection: In game physics, the Separating Axis Theorem (SAT) uses cross products of edge directions to find potential separating axes between 3D convex shapes. For two boxes, the candidate axes include all edge-edge cross products — up to 9 such axes for two boxes with 3 edges each.
Parallelogram and triangle areas: |A × B| is the area of the parallelogram spanned by A and B. Half of this is the triangle area: Triangle Area = ½|A × B|. This is faster and more numerically stable than Heron's formula for triangles defined by vectors from the origin.
Checking co-planarity: Three points P, Q, R and a fourth point S are co-planar if (Q−P) × (R−P) · (S−P) = 0 (the scalar triple product is zero). This test is used in 3D geometry algorithms and mesh validation.
Properties and Algebraic Rules of the Cross Product
Understanding the algebraic properties of the cross product lets you simplify complex vector expressions efficiently.
| Property | Formula | Note |
|---|---|---|
| Anti-commutativity | A × B = −(B × A) | Order matters — reversing flips direction |
| Distributivity | A × (B + C) = A × B + A × C | Cross product distributes over addition |
| Scalar multiplication | (cA) × B = c(A × B) | Scalars factor out |
| Self-cross-product | A × A = 0 | A vector crossed with itself is zero |
| Zero vector | A × 0 = 0 | Cross product with zero vector is zero |
| NOT associative | (A × B) × C ≠ A × (B × C) | Unlike addition/multiplication |
| Triple product | A · (B × C) = B · (C × A) = C · (A × B) | Scalar triple product = volume of parallelepiped |
| Vector triple product | A × (B × C) = B(A·C) − C(A·B) | BAC-CAB rule |
The scalar triple product A · (B × C) equals the signed volume of the parallelepiped (3D parallelogram) formed by the three vectors. If it equals zero, the three vectors are coplanar. If positive, they form a right-handed system; if negative, a left-handed system. This is computed as the determinant of the 3×3 matrix with rows A, B, C.
The Jacobi identity for cross products: A × (B × C) + B × (C × A) + C × (A × B) = 0. This makes the 3D vector space with the cross product a Lie algebra — a structure important in quantum mechanics and group theory.
Frequently Asked Questions
What is the difference between cross product and dot product?
Dot product (A · B = AxBx + AyBy + AzBz) produces a scalar (number), measures alignment, equals |A||B|cos(θ). Cross product (A × B) produces a vector perpendicular to both, measures the "rotation" between vectors, equals |A||B|sin(θ) in magnitude. Dot product = zero for perpendicular vectors; cross product = zero for parallel vectors.
Is the cross product commutative?
No — it is anti-commutative: A × B = −(B × A). The direction flips when you swap the operands (right-hand rule reversal). The magnitude stays the same: |A × B| = |B × A|. This anti-commutativity reflects the inherent directionality of rotation.
What does a zero cross product mean?
A × B = 0 (zero vector) means the two vectors are parallel (or one is zero). The sine of 0° and 180° is zero, making the cross product zero for parallel or anti-parallel vectors. This can be used as a test for parallelism: if |A × B| = 0, the vectors are parallel (or at least one is zero).
How do I find a vector perpendicular to two given vectors?
Compute the cross product! If you need a vector perpendicular to both A and B, compute n = A × B. Normalize by dividing by magnitude for a unit normal: n̂ = (A × B) / |A × B|. This is used constantly in 3D graphics, physics, and engineering to find surface normals and rotation axes.
What is the right-hand rule and how do I apply it?
Point your right hand's fingers in the direction of the first vector (A). Curl your fingers toward the second vector (B). Your extended thumb points in the direction of A × B. Alternatively: if A points East and B points North, A × B points Up. This rule is consistent across all physics and engineering conventions for cross products.
Can I compute the cross product of 2D vectors?
The standard cross product is defined for 3D vectors only. For 2D vectors A = (a₁, a₂) and B = (b₁, b₂), extend them to 3D with z=0: A = (a₁, a₂, 0) and B = (b₁, b₂, 0). Then A × B = (0, 0, a₁b₂ − a₂b₁). The z-component (a₁b₂ − a₂b₁) is the "2D cross product" scalar, equal to the signed area of the parallelogram and used in computational geometry (e.g., to determine if a point is to the left or right of a line).
What is the scalar triple product?
The scalar triple product is A · (B × C) = det([A, B, C]) — the determinant of the 3×3 matrix with rows A, B, C. It equals the signed volume of the parallelepiped formed by the three vectors. If it's zero, the three vectors are coplanar. It's used in computing the volume of tetrahedra (V = |A · (B × C)| / 6) and in testing 3D geometry.
How is the cross product used to calculate torque?
Torque τ = r × F, where r is the position vector from the pivot to the point of force application, and F is the force vector. For a wrench: if r = 0.3 m along the x-axis (wrench handle) and F = 20 N in the y-direction, τ = (0.3, 0, 0) × (0, 20, 0) = (0·0 − 0·20, 0·0 − 0.3·0, 0.3·20 − 0·0) = (0, 0, 6) N·m. The 6 N·m torque is in the z-direction (rotation axis).
What is the magnitude of the cross product?
|A × B| = |A| × |B| × sin(θ), where θ is the angle between the vectors. This equals the area of the parallelogram formed by A and B. For unit vectors at 90°: |A × B| = 1 × 1 × 1 = 1. At 30°: |A × B| = sin(30°) = 0.5. At 0° or 180° (parallel): |A × B| = 0.
What is the BAC-CAB rule?
The vector triple product identity: A × (B × C) = B(A·C) − C(A·B). Mnemonic: "BAC minus CAB." This expands a vector triple product into a combination of the original vectors weighted by dot products. It's used in electromagnetic theory and vector calculus proofs to simplify complex expressions like the expansion of ∇ × (∇ × F) = ∇(∇·F) − ∇²F.