Matrix Operations

A matrix is a rectangular array of numbers arranged in rows and columns, and matrix operations are the rules that let us combine, scale, and multiply these arrays in meaningful ways. Just as ordinary numbers can be added, subtracted, and multiplied, matrices obey their own carefully defined arithmetic — an arithmetic that turns out to be essential in computer graphics, economics, physics, machine learning, and virtually every branch of modern science and engineering. Three fundamental operations form the backbone of matrix arithmetic: addition, scalar multiplication, and matrix multiplication. Matrix addition combines two matrices of the same size entry by entry. Scalar multiplication stretches or shrinks every entry of a matrix by the same factor. Matrix multiplication, the most subtle of the three, combines rows of one matrix with columns of another to produce a new matrix — and this operation is deliberately not commutative, meaning the order in which you multiply matrices almost always matters. Mastering these operations requires both careful bookkeeping and an understanding of the geometric ideas underneath. When you multiply a matrix by a vector, you are applying a transformation — rotating, reflecting, shearing, or scaling points in space. Understanding matrix operations is therefore not just an algebraic skill but a gateway to understanding how linear transformations work across all of mathematics.

Key takeaways
  • Matrix Addition
  • Scalar Multiplication
  • Matrix Multiplication
  • Dimension Rules at a Glance

Matrix Addition

Two matrices A and B can be added only if they have exactly the same dimensions (same number of rows m and same number of columns n). The sum C = A + B is computed entry by entry: each entry c_{ij} = a_{ij} + b_{ij}. For example, if A and B are both 2×2 matrices, you add the top-left entries together, the top-right entries together, and so on. Matrix addition is commutative (A + B = B + A) and associative ((A + B) + C = A + (B + C)), mirroring ordinary addition of numbers.

Scalar Multiplication

A scalar is just a single number (a real or complex number). Multiplying a matrix A by a scalar k produces a new matrix kA in which every entry has been multiplied by k. If A is an m×n matrix with entries a_{ij}, then kA has entries k·a_{ij}. For example, multiplying a 2×3 matrix by the scalar 3 triples every number in the matrix. Geometrically, if A represents a linear transformation, kA scales the output by a factor of k. Scalar multiplication distributes over matrix addition: k(A + B) = kA + kB.

Matrix Multiplication

Matrix multiplication is more intricate. For the product AB to be defined, the number of columns of A must equal the number of rows of B. If A is m×n and B is n×p, then the product C = AB is an m×p matrix. The entry c_{ij} is computed as the dot product of the i-th row of A with the j-th column of B: c_{ij} = Σ_{k=1}^{n} a_{ik} · b_{kj}. This operation is associative and distributes over addition, but it is NOT commutative in general: AB ≠ BA. The identity matrix I acts like the number 1: AI = IA = A.

Dimension Rules at a Glance

Always check dimensions before performing an operation. Addition: both matrices must be m×n; result is m×n. Scalar multiplication: any matrix m×n; result is m×n. Multiplication: A is m×n, B is n×p; result is m×p. A common memory device is to write the dimensions side by side — (m×n)(n×p) — and notice the inner dimensions n and n must match; the outer dimensions m and p give the size of the result.

The Key Equation

Cij=∑k=1nAik⋅Bkj,where A∈Rm×n, B∈Rn×p, C∈Rm×pC_{ij} = \sum_{k=1}^{n} A_{ik} \cdot B_{kj}, \quad \text{where } A \in \mathbb{R}^{m \times n},\ B \in \mathbb{R}^{n \times p},\ C \in \mathbb{R}^{m \times p}
  • C_{ij} — Entry of the product matrix (dimensionless): The element in row i and column j of the resulting matrix C.
  • A_{ik} — Entry of matrix A (dimensionless): The element in row i and column k of the left-hand matrix A.
  • B_{kj} — Entry of matrix B (dimensionless): The element in row k and column j of the right-hand matrix B.
  • n — Shared inner dimension (dimensionless): The number of columns of A and the number of rows of B; these must be equal for the product to be defined.

Worked Example

Problem. Let A = [[1, 2], [3, 4]] and B = [[5, 6], [7, 8]]. Compute: (a) A + B, (b) 2A, and (c) AB.

A+B=(681012),2A=(2468),AB=(19224350)A+B = \begin{pmatrix}6 & 8\\10 & 12\end{pmatrix},\quad 2A = \begin{pmatrix}2 & 4\\6 & 8\end{pmatrix},\quad AB = \begin{pmatrix}19 & 22\\43 & 50\end{pmatrix}

Answer. A + B = [[6,8],[10,12]]; 2A = [[2,4],[6,8]]; AB = [[19,22],[43,50]]

Figure
Diagram
Matrix Multiplication: C = AB, dimensions (2×3)(3×2) = (2×2)Matrix A (2×3)123456B (3×2)789101112=C (2×2)5864139154c₁₁ = 1·7 + 2·9 + 3·11 = 7+18+33 = 58c₁₂ = 1·8 + 2·10 + 3·12 = 8+20+36 = 64c₂₁ = 4·7 + 5·9 + 6·11 = 28+45+66 = 139c₂₂ = 4·8 + 5·10 + 6·12 = 32+50+72 = 154Inner dimensions must match: (2×3)(3×2) → result is 2×2
Origins · 1 minArthur Cayley and how this was discovered
AC
Arthur Cayley
1821–1895 · British

Arthur Cayley was the first mathematician to publish a systematic theory of matrices. In his 1858 paper 'A Memoir on the Theory of Matrices,' he defined matrix addition and multiplication, showed that the operations obey associative and distributive laws, and proved the Cayley–Hamilton theorem, which states that every square matrix satisfies its own characteristic polynomial. His notation and operational rules are still the ones taught today. Cayley was a lawyer for 14 years while simultaneously producing hundreds of mathematical papers — he published over 900 papers in total during his lifetime, making him one of the most prolific mathematicians in history.

  • Determinants — The determinant is a scalar value computed from a square matrix's entries; understanding it requires fluency with matrix structure and the operations defined here.
  • Matrix Inverse — The inverse of a matrix is defined using matrix multiplication (AA⁻¹ = I), so understanding multiplication is a prerequisite for this concept.
  • Systems of Linear Equations — A system of linear equations can be written as the matrix equation Ax = b, linking matrix multiplication directly to solving real problems.
  • Linear Transformations — Every matrix represents a linear transformation; matrix multiplication corresponds to composing two transformations, giving geometric meaning to the algebra.
  • Dot Product — Each entry of a matrix product is computed as a dot product of a row vector with a column vector, making the dot product the engine inside matrix multiplication.