Mathematics.

matrix algebra

Matrices

Linear Algebra45 minDifficulty4 out of 10

You should know: vectors

Overview

A matrix is a rectangular array of numbers arranged in rows and columns. Matrices are the workhorse data structure of linear algebra: they encode systems of linear equations, represent linear transformations between vector spaces, and store data (images, graphs, networks) in a form that algebraic operations can act on directly. Every matrix has a shape — m rows by n columns, written m × n — and the entry in row i, column j is written aᵢⱼ.

Intuition

Think of a matrix as a machine: feed it a vector, and it hands back a new vector, produced by a fixed recipe of scaling and combining the input's components. A spreadsheet is a good mental model too — rows and columns of numbers you can add to another same-shaped spreadsheet, scale by a constant, or (with the right rule) multiply against another spreadsheet to combine two sets of linear relationships into one. The power of matrices is that this single rectangular object can represent a rotation, a system of equations, a graph's connections, or a black-and-white image, all manipulated by the same small set of algebraic rules.

Formal Definition

Definition

An m × n matrix A over a field (typically ℝ) is a rectangular array with m rows and n columns, indexed so that aᵢⱼ denotes the entry in row i and column j:

A=[a11a12a1na21a22a2nam1am2amn]=(aij)1im, 1jn\mathbf{A} = \begin{bmatrix} a_{11} & a_{12} & \cdots & a_{1n} \\ a_{21} & a_{22} & \cdots & a_{2n} \\ \vdots & \vdots & \ddots & \vdots \\ a_{m1} & a_{m2} & \cdots & a_{mn} \end{bmatrix} = (a_{ij})_{1 \le i \le m,\ 1 \le j \le n}

An m×n matrix indexed by row i and column j

Definition
(A+B)ij=aij+bij(A + B)_{ij} = a_{ij} + b_{ij}

Matrix addition — entrywise, requires A and B to have the same shape

(cA)ij=caij(cA)_{ij} = c\, a_{ij}

Scalar multiplication — every entry scaled by c

Notation

NotationMeaning
A\mathbf{A}A matrix, typically denoted by an uppercase bold or italic letter
aija_{ij}The entry in row i, column j of A
AT\mathbf{A}^{\mathsf{T}}Transpose of A — rows and columns swapped, (Aᵀ)ᵢⱼ = Aⱼᵢ
In\mathbf{I}_nThe n×n identity matrix — 1s on the diagonal, 0 elsewhere
0\mathbf{0}The zero matrix — every entry is 0
Mm×n(R)M_{m \times n}(\mathbb{R})The set of all m×n matrices with real entries

Derivation

A matrix arises naturally when writing a system of m linear equations in n unknowns. Consider the system a₁₁x₁ + a₁₂x₂ + … + a₁ₙxₙ = b₁, and similarly for rows 2 through m. Separating the coefficients from the unknowns and constants gives exactly the matrix equation Ax = b — the matrix A is literally 'the array of coefficients', and matrix-vector multiplication is defined precisely so that Ax reproduces the left-hand sides of the original equations:

ai1x1+ai2x2++ainxn=bi(i=1,,m)a_{i1}x_1 + a_{i2}x_2 + \cdots + a_{in}x_n = b_i \quad (i = 1, \ldots, m)

The i-th linear equation in the system

Ax=b,(Ax)i:=j=1naijxj\mathbf{A}\mathbf{x} = \mathbf{b},\quad (\mathbf{A}\mathbf{x})_i := \sum_{j=1}^n a_{ij} x_j

Rewriting the whole system as one matrix equation, defining matrix-vector multiplication

A=[475020118191312]\mathbf{A} = \begin{bmatrix} 4 & -7 & 5 & 0 \\ -2 & 0 & 11 & 8 \\ 19 & 1 & -3 & 12 \end{bmatrix}

A concrete 3×4 coefficient matrix

Properties

Addition is commutative and associative

A+B=B+A,(A+B)+C=A+(B+C)A + B = B + A,\quad (A+B)+C = A+(B+C)

Scalar multiplication distributes

c(A+B)=cA+cB,(c+d)A=cA+dAc(A+B) = cA + cB,\quad (c+d)A = cA + dA

Transpose of a transpose

(AT)T=A(A^{\mathsf T})^{\mathsf T} = A

Transpose of a sum

(A+B)T=AT+BT(A+B)^{\mathsf T} = A^{\mathsf T} + B^{\mathsf T}

Additive identity

A+0=AA + \mathbf{0} = A

Square, symmetric, diagonal matrices

A is square if m=n; symmetric if A=AT; diagonal if aij=0 for ij\text{A is square if } m=n;\ \text{symmetric if } A = A^{\mathsf T};\ \text{diagonal if } a_{ij}=0 \text{ for } i \neq j

Applications

Adjacency matrices represent graphs; images are stored as matrices of pixel intensities; matrices are the fundamental data structure of numerical computing libraries like NumPy.

Formula Explorer

Explore how matrix entries reshape a set of vectors

Loading visualization…

Worked Examples

  1. Add entrywise.

    A+B=[1+52+63+74+8]=[681012]A+B = \begin{bmatrix} 1+5 & 2+6 \\ 3+7 & 4+8 \end{bmatrix} = \begin{bmatrix} 6 & 8 \\ 10 & 12 \end{bmatrix}
  2. Scale every entry by 2.

    2A=[2468]2A = \begin{bmatrix} 2 & 4 \\ 6 & 8 \end{bmatrix}

Answer: A+B = [[6,8],[10,12]]; 2A = [[2,4],[6,8]]

Practice Problems

Difficulty 3/10

Given A = [[2, -1], [0, 3]] and B = [[1, 4], [-2, 5]], compute A − B.

Difficulty 3/10

If A is a 4×3 matrix, what is the shape of Aᵀ?

Difficulty 5/10

A matrix A is symmetric, meaning A = Aᵀ. If A is 5×7, is this possible?

Common Mistakes

Common Mistake

Trying to add or subtract two matrices of different shapes.

Matrix addition/subtraction is only defined for matrices of identical shape (same number of rows AND columns) — it is entrywise, so mismatched shapes have no corresponding entries to combine.

Common Mistake

Confusing the row/column convention — writing aᵢⱼ but meaning 'column i, row j'.

The universal convention is aᵢⱼ = entry in ROW i, COLUMN j (row index always comes first). An m×n matrix has m rows and n columns — mixing this up is a common source of dimension errors later in matrix multiplication.

Common Mistake

Assuming every square matrix is symmetric or diagonal.

Being square (n×n) is necessary but nowhere near sufficient for symmetry (A=Aᵀ) or diagonality (zero off-diagonal entries) — these are extra, much stronger conditions.

Quiz

What is the shape of the identity matrix I₄?
For matrices A and B of the same shape, which is true?

Flashcards

1 / 4

Historical Background

Arrays of coefficients for solving systems of linear equations appear as early as the Chinese text The Nine Chapters on the Mathematical Art (c. 200 BCE), which describes a method equivalent to Gaussian elimination on such an array. The modern theory of matrices developed in the 19th century: James Joseph Sylvester coined the term 'matrix' (Latin for 'womb', as a matrix 'gives birth to' its determinants) in 1850, and Arthur Cayley developed matrix algebra — including matrix multiplication and inverses — in his 1858 Memoir on the Theory of Matrices, treating matrices as objects in their own right rather than mere bookkeeping for equations.

  1. c. 200 BCE

    The Nine Chapters on the Mathematical Art describes a rectangular-array method for solving linear systems, equivalent to Gaussian elimination

  2. 1850

    Sylvester coins the term 'matrix'

    James Joseph Sylvester

  3. 1858

    Cayley publishes A Memoir on the Theory of Matrices, founding matrix algebra as an independent subject

    Arthur Cayley

  4. 1920s

    Heisenberg's matrix mechanics formulation of quantum mechanics makes matrices central to modern physics

    Werner Heisenberg

Summary

  • A matrix is a rectangular array of numbers, aᵢⱼ denoting the entry in row i, column j.
  • Addition and scalar multiplication are entrywise; addition requires matching shapes.
  • The transpose Aᵀ swaps rows and columns, turning an m×n matrix into an n×m matrix.
  • Matrices arise naturally as the coefficient array of a linear system, giving the compact form Ax = b.
  • Cayley formalized matrix algebra in 1858; matrices now underlie graphics, ML, quantum mechanics, and graph theory alike.

References

  1. BookStrang, G. Introduction to Linear Algebra, 5th ed. Ch. 1.
  2. PaperCayley, A. (1858). A Memoir on the Theory of Matrices. Philosophical Transactions of the Royal Society of London.