Module 2: Matrices Lesson 1 of 3

Matrix Fundamentals

Matrices are rectangular arrays of numbers that represent linear transformations, systems of equations, and robot configurations. They’re fundamental to describing how robots move and transform through space.

What is a Matrix?

A matrix is a 2D array of numbers arranged in rows and columns:

A=[a11a12a13a21a22a23]A = \begin{bmatrix} a_{11} & a_{12} & a_{13} \\ a_{21} & a_{22} & a_{23} \end{bmatrix}

This is a 2×3 matrix (2 rows, 3 columns). We denote the element in row i and column j as aij.

Matrix Dimensions

Robot Configuration Matrix Robotics Application

A 6-DOF robot arm’s joint angles can be represented as a column vector (6×1 matrix):

q=[θ1θ2θ3θ4θ5θ6]\mathbf{q} = \begin{bmatrix} \theta_1 \\ \theta_2 \\ \theta_3 \\ \theta_4 \\ \theta_5 \\ \theta_6 \end{bmatrix}

where θ₁ through θ₆ are the joint angles.

Basic Matrix Operations

Matrix Addition

Add corresponding elements. Matrices must have the same dimensions.

[1234]+[5678]=[681012]\begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix} + \begin{bmatrix} 5 & 6 \\ 7 & 8 \end{bmatrix} = \begin{bmatrix} 6 & 8 \\ 10 & 12 \end{bmatrix}

Matrix Subtraction

Subtract corresponding elements (same dimension requirement).

Scalar Multiplication

Multiply every element by a scalar (number):

3×[1234]=[36912]3 \times \begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix} = \begin{bmatrix} 3 & 6 \\ 9 & 12 \end{bmatrix}

Transpose

The transpose of a matrix swaps rows and columns:

A=[123456],AT=[142536]A = \begin{bmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \end{bmatrix}, \quad A^T = \begin{bmatrix} 1 & 4 \\ 2 & 5 \\ 3 & 6 \end{bmatrix}

The element at position (i, j) in A becomes position (j, i) in AT.

Properties of Transpose

  • (AT)T = A
  • (A + B)T = AT + BT
  • (cA)T = c AT (for scalar c)

Special Matrices

Identity Matrix

The identity matrix I is a square matrix with 1s on the diagonal and 0s elsewhere:

I3=[100010001]I_3 = \begin{bmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix}

It acts like the number 1: AI = IA = A.

Zero Matrix

All elements are zero. Acts like the number 0 in addition.

Diagonal Matrix

Non-zero elements only on the diagonal:

D=[d1000d2000d3]D = \begin{bmatrix} d_1 & 0 & 0 \\ 0 & d_2 & 0 \\ 0 & 0 & d_3 \end{bmatrix}

PD Controller Gain Matrix Robotics Application

A diagonal matrix naturally represents proportional gains in a PD controller for a 3-joint robot:

Kp=[500004000030]K_p = \begin{bmatrix} 50 & 0 & 0 \\ 0 & 40 & 0 \\ 0 & 0 & 30 \end{bmatrix}

The control torque is computed as τ=Kpe\boldsymbol{\tau} = K_p \cdot \mathbf{e}, where e\mathbf{e} is the joint angle error vector. Each diagonal entry scales the error for one joint independently — this is a genuine matrix-vector multiplication used in every robot controller.

Linear Independence and Rank

Two concepts that are essential for understanding why matrices sometimes fail to be invertible.

Linear Independence

A set of vectors is linearly independent if no vector in the set can be written as a combination of the others. Intuitively, each vector adds a genuinely new direction.

Independent — each vector points in a distinct direction:

v1=[10],v2=[01]\vec{v}_1 = \begin{bmatrix} 1 \\ 0 \end{bmatrix}, \quad \vec{v}_2 = \begin{bmatrix} 0 \\ 1 \end{bmatrix}

Dependent — one vector is just a scaled version of the other:

v1=[24],v2=[12](v1=2v2)\vec{v}_1 = \begin{bmatrix} 2 \\ 4 \end{bmatrix}, \quad \vec{v}_2 = \begin{bmatrix} 1 \\ 2 \end{bmatrix} \quad (\vec{v}_1 = 2\vec{v}_2)

When vectors are dependent, they span fewer dimensions than you’d expect. Two dependent 2D vectors only cover a line, not the full plane.

Rank

The rank of a matrix is the number of linearly independent columns (equivalently, rows). A matrix is full rank when all its columns are independent.

For an n×n square matrix:

This is why singular matrices collapse space — dependent columns mean redundant directions, so the transformation squashes at least one dimension away.

Rank in Robotics

The Jacobian matrix of a robot maps joint velocities to end-effector velocities. Its rank tells you how many independent directions the end-effector can move:

  • Full rank: The robot can move in all directions — full dexterity
  • Rank drops: The robot loses control in one or more directions — this is a singularity

When we say “the Jacobian is singular,” we mean its columns have become linearly dependent, and the rank has dropped below its maximum value.

Interactive Explorer

Try the basic matrix operations below. Adjust the matrix elements and see how operations work in real-time.

Matrix A

Matrix B

Controls

Show Operations

Results

A + B

6.00 8.00 10.00 12.00

Matrix Operations: Addition and subtraction work element-wise. Scalar multiplication scales all elements. Transpose swaps rows and columns (reflects across diagonal).

Key Takeaways

  1. Matrices represent linear transformations and store robot configurations
  2. Addition/subtraction work element-wise (same dimensions required)
  3. Scalar multiplication scales all elements uniformly
  4. Transpose reflects the matrix across its diagonal
  5. Identity matrix acts as “1” in matrix algebra

Practice Problems

  1. Compute A+BA + B and 3A3A for A=[1230]A = \begin{bmatrix}1 & -2\\3 & 0\end{bmatrix}, B=[4115]B = \begin{bmatrix}4 & 1\\-1 & 5\end{bmatrix}.

  2. Find ATA^T for the 2×3 matrix A=[103251]A = \begin{bmatrix}1 & 0 & -3\\2 & 5 & 1\end{bmatrix}. What are the dimensions of ATA^T?

  3. Are these vectors linearly independent? v1=(1,2,3)\vec{v}_1 = (1, 2, 3), v2=(2,4,6)\vec{v}_2 = (2, 4, 6), v3=(0,1,1)\vec{v}_3 = (0, 1, 1)

  4. A 2-joint robot’s Jacobian has columns (1,0)(1, 0) and (0.5,0)(0.5, 0). What is the rank? Is the robot at a singularity?

Answers
  1. A+B=[5125]A + B = \begin{bmatrix}5 & -1\\2 & 5\end{bmatrix}, 3A=[3690]3A = \begin{bmatrix}3 & -6\\9 & 0\end{bmatrix}

  2. AT=[120531]A^T = \begin{bmatrix}1 & 2\\0 & 5\\-3 & 1\end{bmatrix}. Dimensions: 3×2 (rows and columns swap).

  3. Nov2=2v1\vec{v}_2 = 2\vec{v}_1, so v1\vec{v}_1 and v2\vec{v}_2 are dependent. (Even though v3\vec{v}_3 is independent of v1\vec{v}_1, the set as a whole is dependent.)

  4. Both columns are multiples of (1,0)(1, 0) — they point in the same direction. Rank = 1 (not full rank). Yes, the robot is at a singularity — it can only produce end-effector motion along the x-axis.

Next Steps

Now that you understand basic matrix operations, we’ll explore matrix multiplication — the key operation for composing transformations and understanding robot kinematics.