Mathematical Foundations for Robotics
Robotics represents one of the most intellectually demanding fields at the intersection of engineering, computer science, and applied mathematics. To understand how a robot perceives its environment, plans its movements, and executes complex tasks, one must first master the mathematical language that describes these operations. This chapter establishes the essential mathematical toolkit that will accompany us throughout this book—a toolkit that transforms intuitive concepts about space, motion, and uncertainty into precise, computable representations.
The mathematics required for robotics is not merely abstract formalism divorced from practical concerns. Every calculation a robot performs, from determining the position of its gripper relative to an object on a table to fusioning data from multiple sensors to estimate its pose in an unknown environment, relies on these foundational concepts. Understanding why certain mathematical representations are preferred over others, where their limitations lie, and how they connect to physical reality forms the core of what this chapter aims to convey.
We begin our journey with linear algebra, the mathematical framework that underlies virtually every computation in robotics. From the simple concept of a coordinate vector to the more sophisticated notion of matrix transformations, linear algebra provides the language for describing positions, orientations, and the geometric relationships between different parts of a robot and its environment. We then extend these concepts into three-dimensional space, where representing rotations becomes considerably more nuanced than in two dimensions. The mathematics of rotation—covering rotation matrices, Euler angles, and quaternions—constitutes a substantial portion of this chapter, as these representations appear repeatedly in robotic kinematics, perception, and control.
Beyond static geometry, robotics demands an understanding of motion and change. We therefore introduce the fundamentals of differential calculus as they apply to kinematic and dynamic analysis, including derivatives of trigonometric functions that frequently appear in robotic applications. Finally, we address the pervasive role of uncertainty in real-world robotics through an introduction to probability theory, setting the stage for the sensor fusion techniques discussed in later chapters.
Throughout this exposition, we balance mathematical rigor with intuitive understanding. Abstract concepts are grounded in concrete examples drawn from typical robotic scenarios. Historical context illuminates how these mathematical tools developed and why particular representations have endured while others have fallen by the wayside. By the conclusion of this chapter, readers will possess not only the technical facility to manipulate these mathematical objects but also the conceptual framework to understand why they work and when they might fail.
Vectors and the Geometry of Space
The concept of a vector lies at the heart of geometric reasoning in robotics. At its most fundamental level, a vector represents both a magnitude and a direction in space—a quantity that captures how something moves or points without regard to its specific location. This distinction between vectors and points proves crucial in robotics: a displacement vector from position A to position B describes the motion required to go from A to B, independent of where A and B are situated in some absolute sense.
In the Cartesian coordinate system familiar from high school mathematics, we represent vectors as ordered collections of numbers. A vector in two-dimensional space takes the form $\mathbf{v} = (v_x, v_y)$, where $v_x$ and $v_y$ represent the vector's projections onto the x-axis and y-axis respectively. For three-dimensional space, which concerns us most in robotics, we write $\mathbf{v} = (v_x, v_y, v_z)$. These components encode all the geometric information about the vector—its length, its orientation, and everything in between.
The length or norm of a vector $\mathbf{v}$ in three dimensions is computed using the Pythagorean theorem generalized to three dimensions:
$$\|\mathbf{v}\| = \sqrt{v_x^2 + v_y^2 + v_z^2}$$
This formula appears countless times in robotics, from computing distances between points to normalizing direction vectors that should have unit length for certain calculations.
Vector addition and scalar multiplication form the basic algebraic operations on vectors. If a robot moves from position A to position B, and then from B to C, the total displacement from A to C is the sum of the individual displacements. Algebraically, if $\mathbf{v}_1 = (v_{1x}, v_{1y}, v_{1z})$ and $\mathbf{v}_2 = (v_{2x}, v_{2y}, v_{2z})$, then their sum is $\mathbf{v}_1 + \mathbf{v}_2 = (v_{1x} + v_{2x}, v_{1y} + v_{2y}, v_{1z} + v_{2z})$. Scalar multiplication stretches or shrinks a vector while preserving or reversing its direction: if $k$ is a scalar, then $k\mathbf{v} = (kv_x, kv_y, kv_z)$.
The dot product and cross product represent two fundamentally different ways of combining vectors, each with distinct geometric meanings and applications in robotics. The dot product (also called the scalar product) between $\mathbf{v}_1$ and $\mathbf{v}_2$ is defined as:
$$\mathbf{v}_1 \cdot \mathbf{v}_2 = v_{1x}v_{2x} + v_{1y}v_{2y} + v_{1z}v_{2z} = \|\mathbf{v}_1\|\|\mathbf{v}_2\|\cos\theta$$
where $\theta$ is the angle between the vectors. The dot product reveals whether vectors point in similar directions (positive dot product), opposite directions (negative dot product), or are perpendicular (zero dot product). In robotics, dot products appear in determining whether a robot's gripper approaches an object from the correct direction, in computing projections of one vector onto another, and in various optimization formulations.
The cross product $\mathbf{v}_1 \times \mathbf{v}_2$ produces a vector perpendicular to both input vectors, with magnitude equal to $\|\mathbf{v}_1\|\|\mathbf{v}_2\|\sin\theta$. The resulting vector's direction follows the right-hand rule: if the fingers of your right hand curl from $\mathbf{v}_1$ toward $\mathbf{v}_2$, your thumb points in the direction of $\mathbf{v}_1 \times \mathbf{v}_2$. Cross products prove essential for computing torques in robotic dynamics, determining the moment arm of forces, and in algorithms for orientation representation.
Consider a concrete scenario: a robot arm mounted on a table reaches toward an object. The vector from the robot's base to the object tells us the desired displacement. The vector pointing outward from the object's surface (its normal vector) tells us the desired approach direction. The dot product between the robot's approach direction and the object's surface normal tells us whether the robot is approaching from the correct side. The cross product between a reference direction and the object's direction gives us the axis about which to rotate to align with the object. These vector operations encode the geometric reasoning that enables successful manipulation.
Matrices: Linear Transformations and Systems of Equations
While vectors represent points and directions, matrices represent operations that transform vectors into other vectors. In robotics, matrices serve dual roles: they encode geometric transformations (rotations, scalings, shears) and they compactly represent systems of linear equations that arise in kinematics, dynamics, and control.
A matrix is a rectangular array of numbers arranged in rows and columns. An $m \times n$ matrix has $m$ rows and $n$ columns, and can multiply an $n$-dimensional vector to produce an $m$-dimensional vector. The multiplication of a matrix $\mathbf{A}$ by a vector $\mathbf{x}$ follows the rule:
$$(\mathbf{A}\mathbf{x})_i = \sum_{j=1}^{n} a_{ij}x_j$$
Each component of the result equals the dot product of the corresponding row of $\mathbf{A}$ with the vector $\mathbf{x}$. This seemingly simple operation underlies the transformat