Linear algebra review

Sep 25, 20264 min

A self-contained guide to basic linear algebra ideas that commonly come up in robotics.

Basics

A matrix A∈Rm×nA \in \mathbb{R}^{m \times n} represents a linear map A:Rn→RmA: \mathbb{R}^n \rightarrow \mathbb{R}^m.

For example, a robot Jacobian J∈Rm×nJ \in \mathbb{R}^{m \times n} maps joint velocity q˙∈Rn\dot{q} \in \mathbb{R}^n to task-space velocity x˙∈Rm\dot{x} \in \mathbb{R}^m, x˙=Jq˙.\dot{x} = J \dot{q}.

Transpose

The transpose of matrix A∈Rm×nA \in \mathbb{R}^{m \times n} satisfies:

  • A⊤∈Rn×mA^\top \in \mathbb{R}^{n \times m}
  • (A⊤)ij=Aji(A^\top)_{ij} = A_{ji}
  • 💡 Fact: (AB)⊤=B⊤A⊤(AB)^\top = B^\top A^\top.

Proof: The (i,j)(i, j)-entry of (AB)⊤(AB)^\top is: (AB)ij⊤=(AB)ji(AB)_{ij}^\top = (AB)_{ji}. By matrix multiplication, (AB)ji=∑kAjkBki.(AB)_{ji} = \sum_k A_{jk} B_{ki}. Also, (B⊤A⊤)ij=∑k(B⊤)ik(A⊤)kj=∑kBkiAjk=(AB)ji.(B^\top A^\top)_{ij} = \sum_k (B^\top)_{ik} (A^\top )_{kj} = \sum_k B_{ki} A_{jk} = (AB)_{ji}.

Column space

Suppose AA is a matrix with a1,a2,…,ana_1, a_2, \ldots, a_n as its column vectors. Then Ax=x1a1+⋯+xnan.Ax = x_1 a_1 + \cdots + x_n a_n.So every possible output AxAx is a linear combination of the columns of AA.

The column space is Col(A)={Ax:x∈Rn}\text{Col}(A) = \{A x: x \in \mathbb{R}^n\}.

Intuitively, the column space tells us which output directions the matrix can generate.

  • 🔑 For a Jacobian, Col(J)\text{Col}(J) is the set of task-space velocities that the robot can instantaneously produce.

Rank

The rank of AA is the dimension of its column space: rank(A)=dim⁡Col(A).\text{rank}(A) = \dim \text{Col}(A). i.e. it is the number of linearly independent columns.

There is a theorem that says column rank(A)=row rank(A)\text{column rank}(A) = \text{row rank}(A).

  • 🔑 Intuitively, rank measures "how many independent directions" a matrix contains.

Theorem. The rank cannot exceed the number of rows or columns, i.e. rank(A)≤min⁡(m,n)\text{rank}(A) \leq \min(m, n) for A∈Rm×nA \in \mathbb{R}^{m \times n}.

This makes sense: we cannot have more than mm linearly independent vectors in Rm\mathbb{R}^m, and the columns of AA live in Rm\mathbb{R}^m.

Null space

The null space of Null(A)={x:Ax=0}\text{Null}(A) = \{x : Ax = 0\}. It is also referred to as the kernel, i.e. ker⁡(A)\ker(A).

These are the input directions that the matrix "kills."

  • 💡 For a robot Jacobian, Jq˙=0J\dot{q} = 0 means the joints can move with velocity q˙\dot{q} while producing no instantaneous end-effector motion (redundancy!)

The dimension of the null space is called the nullity: nullity(A)=dim⁡Null(A)\text{nullity}(A) = \dim \text{Null}(A).

Rank-nullity theorem

For A∈Rm×nA \in \mathbb{R}^{m \times n}, rank(A)+nullity(A)=n\text{rank}(A) + \text{nullity}(A) = n.

Proof: Fill in later.

Invertibility and full rank

For a square matrix A∈Rn×nA \in \mathbb{R}^{n \times n}, the following statements are equivalent: A invertible  ⟺  rank(A)=n  ⟺  Null(A)={0}.A \text{ invertible} \iff \text{rank}(A)= n \iff \text{Null}(A) = \{0\}.

  • Invertibility implies trivial null space: Ax=0  ⟹  A−1Ax=A−10  ⟹  x=0.Ax = 0 \implies A^{-1}A x = A^{-1} 0 \implies x = 0.Thus Null(A)={0}\text{Null}(A) = \{0\}.
  • Trivial null space implies full rank: rank(A)+nullity(A)⏟0=n  ⟹  rank(A)=n.\text{rank}(A) + \underbrace{\text{nullity}(A)}_0 =n \implies \text{rank}(A) = n.
  • Full rank implies invertibility: For every n×nn \times n matrix, rank nn means its nn columns are linearly independent. They therefore form a basis of Rn\mathbb{R}^n. Thus, for every bb, Ax=bAx = b has exactly one solution, i.e. A−1Ax=A−1bA^{-1} A x = A^{-1} b exists and is unique.

For a square matrix, singular means not invertible.

Key identities

  • 🔑 x⊤A⊤Ax=∣∣Ax∣∣2x^\top A^\top Ax = ||Ax||^2
    • Proof: Using (Ax)⊤=x⊤A⊤(Ax)^\top = x^\top A^\top, we get x⊤A⊤Ax=(Ax)⊤(Ax).x^\top A^\top Ax = (Ax)^\top (Ax).For any vector yy, y⊤y=∣∣y∣∣2y^\top y = ||y||^2. Hence x⊤A⊤Ax=∣∣Ax∣∣2x^\top A^\top Ax = ||Ax||^2.
  • 🔑 Null(A⊤A)=Null(A)\text{Null}(A^\top A) = \text{Null}(A)
    • Proof: We prove both inclusions.
      • Direction 1: Suppose x∈Null(A)x \in \text{Null}(A). Then Ax=0Ax = 0. Therefore A⊤Ax=A⊤0=0  ⟹  x∈Null(A⊤A)  ⟹  Null(A)⊆Null(A⊤A).A^\top Ax = A^\top 0 = 0 \implies x \in \text{Null}(A^\top A) \implies \text{Null}(A) \subseteq \text{Null}(A^\top A).
      • Direction 2: Suppose x∈Null(A⊤A)x \in \text{Null}(A^\top A). Then A⊤Ax=0A^\top Ax = 0. Multiply on the left by x⊤x^\top: x⊤A⊤Ax=(Ax)⊤Ax=∣∣Ax∣∣2=0  ⟹  Ax=0  ⟹  x∈Null(A)  ⟹  Null(A⊤A)=Null(A).x^\top A^\top Ax = (Ax)^\top Ax = ||Ax||^2 = 0 \implies Ax = 0\implies x \in \text{Null}(A) \implies \text{Null}(A^\top A) = \text{Null}(A).This uses the fact that a vector has norm zero only if it is the zero vector.
    • Hence Null(A⊤A)=Null(A)\text{Null}(A^\top A) = \text{Null}(A).
  • 🔑 rank(A⊤A)=rank(A)\text{rank}(A^\top A) = \text{rank}(A)
    • Proof: Both A:Rn→RmA: \mathbb{R}^n \to \mathbb{R}^m and A⊤A:Rn→RnA^\top A : \mathbb{R}^n \to \mathbb{R}^n have the same domain dimension nn. We just proved that they have the same null space, so they have the same nullity. Therefore: rank(A)=n−nullity(A)=n−nullity(A⊤A)=rank(A⊤A).\text{rank}(A) = n - \text{nullity}(A) = n - \text{nullity}(A^\top A) = \text{rank}(A^\top A).
  • 🔑 rank(AA⊤)=rank(A)\text{rank}(AA^\top) = \text{rank}(A)
    • Proof: Applying the above fact, rank(AA⊤)=rank(A⊤)=rank(A).\text{rank}(AA^\top ) = \text{rank}(A^\top) = \text{rank}(A).This uses the fact that rank(A⊤)=rank(A)\text{rank}(A^\top) = \text{rank}(A), which follows directly from the theorem that row rank(A)=column rank(A)\text{row rank}(A) = \text{column rank}(A).

Relevant definitions used in this section

The squared norm of a vector is the sum of the squares of its entries. If y=[y1y2⋯yn]y = \begin{bmatrix} y_1 & y_2 & \cdots & y_n \end{bmatrix}, then its Euclidean norm is ∣∣y∣∣=y12+y22+⋯+yn2||y|| = \sqrt{y_1^2 + y_2^2 + \cdots + y_n^2}. So its squared norm is ∣∣y∣∣2=y12+⋯+yn2||y||^2 = y_1^2 + \cdots + y_n^2.

General rank inequality

rank(AB)≤min⁡(rank(A),rank(B))\text{rank}(AB) \leq \min (\text{rank}(A), \text{rank}(B))

Symmetric matrices

Positive semidefinite matrices

Jacobian facts

Now that we've established some basic linear algebra facts, we can apply them to the robot Jacobian!

  • 🔖 J⊤JJ^\top J is always singular for a redundant Jacobian.
    • Proof:
  • 💡 JJ⊤JJ^\top can be invertible for a redundant robot.