Module 1: Foundations Lesson 3 of 3

Cross Product

The cross product (or vector product) is a 3D operation that takes two vectors and produces a third vector perpendicular to both. It’s essential for computing torques, angular momentum, and surface normals in robotics.

3D Only!

The cross product is only defined for 3D vectors. There’s no 2D equivalent (though there’s a scalar version in 2D).

What is the Cross Product?

The cross product of two vectors produces a vector:

a×b=[aybzazbyazbxaxbzaxbyaybx]\vec{a} \times \vec{b} = \begin{bmatrix} a_y b_z - a_z b_y \\ a_z b_x - a_x b_z \\ a_x b_y - a_y b_x \end{bmatrix}

Geometric Interpretation

The magnitude of the cross product equals:

a×b=absin(θ)|\vec{a} \times \vec{b}| = |\vec{a}||\vec{b}|\sin(\theta)

where θ\theta is the angle between vectors.

Direction: The result is perpendicular to both a\vec{a} and b\vec{b}, following the right-hand rule.

Interactive Exploration

Explore the cross product in 3D. Notice how the red vector is always perpendicular to both blue and green vectors:

Use mouse to rotate view • Scroll to zoom
Controls

Vector a (blue)

1.000
-22
0.500
-22
0.000
-22

Vector b (green)

0.000
-22
1.000
-22
0.500
-22

Cross Product Results

a × b = (0.250, -0.500, 1.000)
|a| = 1.118
|b| = 1.118
|a × b| = 1.146
θ = 66.42°
sin(θ) = 0.917
Verification:
|a||b|sin(θ) = 1.146
Properties:
a · (a × b) = 0.000000
b · (a × b) = 0.000000
(both should be ≈ 0)

Right-hand rule: Point your fingers along vector a, curl them toward vector b, and your thumb points in the direction of a × b.

Geometric meaning: The magnitude of the cross product equals the area of the parallelogram formed by the two vectors (shown in yellow).

Right-Hand Rule

To find the direction of a×b\vec{a} \times \vec{b}:

  1. Point your fingers along a\vec{a}
  2. Curl them toward b\vec{b}
  3. Your thumb points along a×b\vec{a} \times \vec{b}

Anti-Commutative

Unlike dot product, cross product is not commutative:

b×a=(a×b)\vec{b} \times \vec{a} = -(\vec{a} \times \vec{b})

Swapping order flips the direction!

Geometric Meaning

The magnitude a×b|\vec{a} \times \vec{b}| equals the area of the parallelogram formed by vectors a\vec{a} and b\vec{b}.

Try enabling “Show parallelogram” in the interactive demo to see this!

Special cases:

Torque Calculation

Torque (τ\vec{\tau}) is the rotational equivalent of force. It’s calculated using the cross product:

τ=r×F\vec{\tau} = \vec{r} \times \vec{F}

where:

Robot Gripper Torque Robotics Application

A robot gripper applies force F=(0,10,0)\vec{F} = (0, 10, 0) N at position r=(0.3,0,0)\vec{r} = (0.3, 0, 0) m from the wrist joint.

Torque about the wrist:

τ=r×F=[0.300]×[0100]=[003] N\cdotpm\vec{\tau} = \vec{r} \times \vec{F} = \begin{bmatrix} 0.3 \\ 0 \\ 0 \end{bmatrix} \times \begin{bmatrix} 0 \\ 10 \\ 0 \end{bmatrix} = \begin{bmatrix} 0 \\ 0 \\ 3 \end{bmatrix} \text{ N·m}

The torque is 3 N·m around the z-axis, causing rotation in the xy-plane.

Properties of Cross Product

  1. Anti-commutative: a×b=(b×a)\vec{a} \times \vec{b} = -(\vec{b} \times \vec{a})
  2. Distributive: a×(b+c)=a×b+a×c\vec{a} \times (\vec{b} + \vec{c}) = \vec{a} \times \vec{b} + \vec{a} \times \vec{c}
  3. Scalar multiplication: (ka)×b=k(a×b)(k\vec{a}) \times \vec{b} = k(\vec{a} \times \vec{b})
  4. Self cross product: a×a=0\vec{a} \times \vec{a} = \vec{0}

Perpendicularity Check

If c=a×b\vec{c} = \vec{a} \times \vec{b}, then:

ac=0andbc=0\vec{a} \cdot \vec{c} = 0 \quad \text{and} \quad \vec{b} \cdot \vec{c} = 0

The result is perpendicular to both input vectors!

Surface Normals

A normal vector is perpendicular to a surface. Given two vectors in the plane, their cross product gives the normal:

Robot Path Planning on Slopes Robotics Application

A robot navigates a sloped surface defined by two edge vectors:

  • e1=(1,0,0.2)\vec{e}_1 = (1, 0, 0.2) (slightly upward)
  • e2=(0,1,0.1)\vec{e}_2 = (0, 1, 0.1) (slightly upward)

Surface normal:

n=e1×e2=[0.20.11]\vec{n} = \vec{e}_1 \times \vec{e}_2 = \begin{bmatrix} -0.2 \\ -0.1 \\ 1 \end{bmatrix}

This tells the robot which way is “up” relative to the surface. The unit normal is:

n^=nn=(0.2,0.1,1)1.025(0.195,0.098,0.976)\hat{n} = \frac{\vec{n}}{|\vec{n}|} = \frac{(-0.2, -0.1, 1)}{1.025} \approx (-0.195, -0.098, 0.976)

Angular Velocity and Momentum

In robotics, angular velocity (ω\vec{\omega}) and angular momentum (L\vec{L}) involve cross products:

v=ω×r\vec{v} = \vec{\omega} \times \vec{r}

This gives the linear velocity of a point at position r\vec{r} on a rotating body.

Rotating Robot Arm Robotics Application

A robot link rotates with angular velocity ω=(0,0,2)\vec{\omega} = (0, 0, 2) rad/s (around z-axis).

A point at r=(0.5,0,0)\vec{r} = (0.5, 0, 0) m on the link has velocity:

v=ω×r=[002]×[0.500]=[010] m/s\vec{v} = \vec{\omega} \times \vec{r} = \begin{bmatrix} 0 \\ 0 \\ 2 \end{bmatrix} \times \begin{bmatrix} 0.5 \\ 0 \\ 0 \end{bmatrix} = \begin{bmatrix} 0 \\ 1 \\ 0 \end{bmatrix} \text{ m/s}

The point moves at 1 m/s in the y-direction (tangent to the rotation).

Coordinate Frame Construction

Given one axis direction, we can construct a full coordinate frame using cross products:

Given: z-axis direction ẑ
Choose: arbitrary vector v (not parallel to ẑ)
Compute:
  x̂ = v × ẑ (normalized)
  ŷ = ẑ × x̂ (normalized)

This creates an orthonormal frame (mutually perpendicular unit vectors).

Robotics Applications

1. Joint Torque Computation

Essential for robot dynamics and control.

2. Collision Detection

Check if objects intersect by testing normal vectors.

3. Camera and Sensor Orientation

Define coordinate frames for vision systems.

4. Path Planning

Compute surface normals for navigation on irregular terrain.

5. Jacobian Matrix

Relates joint velocities to end-effector velocities (covered in Module 5).

Implementation Note

Many robotics libraries (ROS, PyBullet, etc.) have built-in cross product functions. But understanding the math helps you debug and extend these tools!

Key Takeaways

Practice Problems

  1. Calculate a×b\vec{a} \times \vec{b} for a=(1,0,0)\vec{a} = (1, 0, 0) and b=(0,1,0)\vec{b} = (0, 1, 0).

  2. Verify that (1,2,3)×(4,5,6)(1, 2, 3) \times (4, 5, 6) is perpendicular to both input vectors using dot product.

  3. A force of (5,0,0)(5, 0, 0) N is applied at position (0,0.2,0)(0, 0.2, 0) m. What’s the torque about the origin?

  4. Find the unit normal to a surface spanned by (1,0,0.1)(1, 0, 0.1) and (0,1,0.2)(0, 1, 0.2).

  5. If a=3|\vec{a}| = 3, b=4|\vec{b}| = 4, and the angle between them is 30°, what is a×b|\vec{a} \times \vec{b}|?

Module 1 Complete!

Congratulations! You’ve mastered vector fundamentals. You now understand:

  • Vector addition and scalar multiplication
  • Dot product for measuring alignment and computing angles
  • Cross product for perpendicular vectors and torques

Next module: We’ll explore matrices - powerful tools for representing robot transformations and configurations!