Mathematical Methods for Economics · Linear Algebra
Matrices & linear systems
A matrix is the natural container for a system of linear equations — and linear systems are everywhere in economics, from input–output models to the comparative statics of an equilibrium. This page covers matrix algebra, the rank of a matrix via Gaussian elimination, determinants, the inverse, and the two standard ways to solve \(A\mathbf{x}=\mathbf{b}\): inversion and Cramer's rule.
These study notes follow on from vectors and Euclidean spaces and belong to the linear algebra part of a mathematical economics course (module code EC3304). Matrix multiplication is defined entirely in terms of the inner product from that page.
Matrices and the transpose
A matrix \(A\) is an \(m\times n\) rectangular array of real numbers
$$A := \begin{pmatrix} 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{pmatrix} \in \mathbb{R}^{m\times n},$$
sometimes written \((a_{ij})_{m\times n}\), where \(a_{ij}\) is the element in row \(i\), column \(j\). \(A\) is a square matrix if \(m=n\). The transpose \(A^{\top} := (a_{ji})_{n\times m}\) swaps rows and columns.
A vector is just a matrix with a single column (or row). Reading a matrix as a stack of row vectors, or a row of column vectors, is the key to interpreting the operations below.
Addition and scalar multiplication
For \(A:=(a_{ij})_{m\times n}\), \(B:=(b_{ij})_{m\times n}\) and scalar \(k\in\mathbb{R}\):
$$A \pm B := (a_{ij}\pm b_{ij})_{m\times n}, \qquad kA := (ka_{ij})_{m\times n}.$$
Both are componentwise, so they require matrices of the same dimensions. These inherit the familiar arithmetic rules (commutativity and associativity of addition, distributivity of scalars). Multiplication, by contrast, is genuinely different.
Matrix multiplication
For \(A:=(a_{ij})_{m\times n}\) and \(B:=(b_{ij})_{n\times p}\), the product is
$$AB := (c_{ij})_{m\times p} \quad\text{with}\quad c_{ij} := \sum_{r=1}^{n} a_{ir}b_{rj}.$$
\(AB\) is \(m\times p\), and each element \(c_{ij}\) is the inner product of row \(i\) of \(A\) with column \(j\) of \(B\).
The inner dimensions must match (\(A\) has \(n\) columns, \(B\) has \(n\) rows). Unlike scalar multiplication, matrix multiplication is not commutative: in general \(AB\neq BA\).
Let
$$A=\begin{pmatrix}2&1\\0&3\end{pmatrix}, \qquad B=\begin{pmatrix}1&3\\0&-1\end{pmatrix}.$$
Then \(AB\) has entries: \((AB)_{11}=2(1)+1(0)=2\), \((AB)_{12}=2(3)+1(-1)=5\), \((AB)_{21}=0(1)+3(0)=0\), \((AB)_{22}=0(3)+3(-1)=-3\), so
$$AB=\begin{pmatrix}2&5\\0&-3\end{pmatrix}, \qquad BA=\begin{pmatrix}2&10\\0&-3\end{pmatrix}.$$
The off-diagonal entry differs, confirming \(AB\neq BA\).
Special square matrices
Several named square matrices recur throughout economics and econometrics.
- The identity matrix \(I\) has ones on the diagonal and zeros elsewhere; it satisfies \(AI=IA=A\) and plays the role of "1" in matrix multiplication.
- A diagonal matrix has \(a_{ij}=0\) for all \(i\neq j\), written \(\operatorname{diag}(a_{11},\ldots,a_{nn})\).
- An upper triangular matrix has \(a_{ij}=0\) for all \(i>j\); a lower triangular matrix has \(a_{ij}=0\) for all \(i < j\).
- A symmetric matrix satisfies \(A=A^{\top}\). Covariance matrices and the associated matrix of a quadratic form are symmetric.
- An idempotent matrix satisfies \(A^2=A\) — the projection ("hat") and residual-maker matrices of OLS are idempotent.
- An orthogonal matrix satisfies \(AA^{\top}=A^{\top}A=I\), so its transpose is its inverse; its columns are orthonormal.
Rank and Gaussian elimination
The rank of a general \(m\times n\) matrix \(A\) is the maximum number of linearly independent column (equivalently, row) vectors in \(A\).
To find the rank we perform elementary transformations, which do not change it:
- interchanging two rows;
- multiplying one row by a nonzero scalar \(\alpha\);
- adding a scalar multiple of one row to another.
Reducing to row-echelon form this way is Gaussian elimination; the rank is the number of nonzero rows that remain.
Find the rank of
$$\begin{pmatrix}1&2&3&2\\2&3&5&1\\1&3&4&5\end{pmatrix}.$$
Add \((-2)\times\)row 1 to row 2 and \((-1)\times\)row 1 to row 3:
$$\longrightarrow \begin{pmatrix}1&2&3&2\\0&-1&-1&-3\\0&1&1&3\end{pmatrix}.$$
Now add row 2 to row 3:
$$\longrightarrow \begin{pmatrix}1&2&3&2\\0&-1&-1&-3\\0&0&0&0\end{pmatrix}.$$
One row has been eliminated, so there is one linearly dependent combination of rows. Two nonzero rows remain: the rank is 2.
The determinant
The determinant is a single number attached to a square matrix; it is nonzero exactly when the matrix is invertible.
For a \(2\times 2\) matrix, \(\lvert (a_{ij})_{2\times2}\rvert = a_{11}a_{22} - a_{21}a_{12}\). For a general square matrix \(A:=(a_{ij})_{n\times n}\), expand along any row \(i\):
$$\lvert A\rvert := a_{11}\ \text{when } n=1; \qquad \lvert A\rvert := \sum_{j=1}^{n} a_{ij}A_{ij}\ \text{when } n>1,$$
where the cofactor \(A_{ij}\) is \((-1)^{i+j}\) times the determinant of the submatrix obtained by deleting row \(i\) and column \(j\).
Compute the determinant of
$$A=\begin{pmatrix}-2&0&1\\3&2&-1\\1&-4&4\end{pmatrix}$$
by expanding along the first row:
$$\lvert A\rvert = (-1)^{1+1}(-2)\begin{vmatrix}2&-1\\-4&4\end{vmatrix} + (-1)^{1+2}(0)\begin{vmatrix}3&-1\\1&4\end{vmatrix} + (-1)^{1+3}(1)\begin{vmatrix}3&2\\1&-4\end{vmatrix}.$$
The two surviving \(2\times2\) determinants are \(\begin{vmatrix}2&-1\\-4&4\end{vmatrix}=2(4)-(-1)(-4)=4\) and \(\begin{vmatrix}3&2\\1&-4\end{vmatrix}=3(-4)-2(1)=-14\). Hence
$$\lvert A\rvert = (-2)(4) + (1)(-14) = -8 - 14 = -22.$$
The inverse of a square matrix
A square matrix \(A\) has an inverse \(A^{-1}\) if \(A^{-1}A = AA^{-1} = I\). Such an inverse exists if and only if \(\lvert A\rvert \neq 0\).
When it exists, \(\displaystyle A^{-1} = \frac{1}{\lvert A\rvert}\operatorname{adj}(A)\), where the adjugate \(\operatorname{adj}(A):=(\hat a_{ij})_{n\times n}\) has entries \(\hat a_{ij}:=A_{ji}\) — the transpose of the cofactor matrix.
$$\begin{pmatrix}a&b\\c&d\end{pmatrix}^{-1} = \frac{1}{ad-cb}\begin{pmatrix}d&-b\\-c&a\end{pmatrix},$$
valid whenever \(ad-cb\neq 0\). Swap the diagonal entries, negate the off-diagonal ones, and divide by the determinant.
A second, often quicker, route uses elementary transformations. Because each elementary row operation is itself a matrix multiplication, applying a sequence of them that reduces \(A\) to \(I\) applies the same sequence to \(I\), turning it into \(A^{-1}\) — the Gauss–Jordan method. A fully worked \(2\times2\) inversion by this method appears on the worked examples page.
Solving linear systems \(A\mathbf{x}=\mathbf{b}\)
A system of \(n\) equations in \(n\) unknowns
$$\begin{aligned}a_{11}x_1 + a_{12}x_2 + \cdots + a_{1n}x_n &= b_1\\ a_{21}x_1 + a_{22}x_2 + \cdots + a_{2n}x_n &= b_2\\ &\ \ \vdots\\ a_{n1}x_1 + a_{n2}x_2 + \cdots + a_{nn}x_n &= b_n\end{aligned}$$
is written compactly as \(A\mathbf{x}=\mathbf{b}\). If \(A\) is invertible (equivalently, \(\lvert A\rvert\neq 0\), equivalently full rank \(n\)), the system has the unique solution
$$\mathbf{x} = A^{-1}\mathbf{b}.$$
If \(\lvert A\rvert = 0\) the matrix is singular and the system has either no solution or infinitely many, depending on \(\mathbf{b}\).
A textbook macro model links consumption \(C\), income \(Y\), investment \(I\), the interest rate \(r\) and the money market through
$$C = bY, \quad Y = C + I + G, \quad I = I_0 - ar, \quad M^d = mY + M_0 - hr, \quad M^d = M^s.$$
Money demand \(M^d\) rises with income and falls with the interest rate, and in equilibrium it equals the exogenous money supply \(M^s\). Collecting the endogenous variables (\(C\), \(Y\), \(I\), \(r\), \(M^d\)) on the left produces a linear system \(A\mathbf{x}=\mathbf{b}\) whose right-hand side holds the exogenous terms (\(G\), \(I_0\), \(M_0\), \(M^s\)). Solving it by inversion or Cramer’s rule delivers equilibrium \(Y\) and \(r\) as explicit functions of the policy parameters — which is precisely what comparative statics needs.
Cramer's rule
When \(A\) is invertible, the solution to \(A\mathbf{x}=\mathbf{b}\) is
$$x_j = \frac{\lvert A_j\rvert}{\lvert A\rvert} \quad\text{for every } j,$$
where \(A_j\) is the matrix obtained by replacing the \(j\)-th column of \(A\) with \(\mathbf{b}\).
Solve \(2x_1 + x_2 = 4\) and \(3x_1 - x_2 = 1\). Here \(A=\begin{pmatrix}2&1\\3&-1\end{pmatrix}\) with \(\lvert A\rvert = 2(-1)-3(1) = -5\). Then
$$x_1 = \frac{\begin{vmatrix}4&1\\1&-1\end{vmatrix}}{\begin{vmatrix}2&1\\3&-1\end{vmatrix}} = \frac{-4-1}{-5} = \frac{-5}{-5} = 1, \qquad x_2 = \frac{\begin{vmatrix}2&4\\3&1\end{vmatrix}}{-5} = \frac{2-12}{-5} = \frac{-10}{-5} = 2.$$
So \(\mathbf{x}=(1,2)\). Cramer's rule is efficient for small systems and, because it gives each unknown as a ratio of determinants, it is ideal for reading off comparative-statics signs.
A note on matrix powers
For \(k\in\mathbb{N}\), the power \(A^k\) is \(A\) multiplied by itself \(k\) times. If \(A=\operatorname{diag}(a_{11},\ldots,a_{nn})\) then \(A^k=\operatorname{diag}(a_{11}^{k},\ldots,a_{nn}^{k})\) — powers of a diagonal matrix are trivial. When \(A\) is not diagonal, the efficient route is to diagonalise it first, which is the subject of the eigenvalues and diagonalisation notes.
Self-check questions
1. For which values of \(k\) is \(A=\begin{pmatrix}1&2\\3&k\end{pmatrix}\) invertible? Find \(A^{-1}\) when \(k=4\).
\(A\) is invertible iff \(\lvert A\rvert = 1\cdot k - 3\cdot 2 = k-6 \neq 0\), i.e. for all \(k\neq 6\).
With \(k=4\), \(\lvert A\rvert = -2\), so by the \(2\times2\) formula
$$A^{-1} = \frac{1}{-2}\begin{pmatrix}4&-2\\-3&1\end{pmatrix} = \begin{pmatrix}-2&1\\ \tfrac{3}{2}&-\tfrac12\end{pmatrix}.$$
Check: \(AA^{-1}=\begin{pmatrix}1&2\\3&4\end{pmatrix}\begin{pmatrix}-2&1\\1.5&-0.5\end{pmatrix}=\begin{pmatrix}1&0\\0&1\end{pmatrix}\). ✓
2. Solve \(x_1 + x_2 = 3\), \(2x_1 - x_2 = 0\) using Cramer's rule.
\(A=\begin{pmatrix}1&1\\2&-1\end{pmatrix}\), \(\lvert A\rvert = 1(-1)-2(1) = -3\).
$$x_1 = \frac{\begin{vmatrix}3&1\\0&-1\end{vmatrix}}{-3} = \frac{-3}{-3} = 1, \qquad x_2 = \frac{\begin{vmatrix}1&3\\2&0\end{vmatrix}}{-3} = \frac{-6}{-3} = 2.$$
Solution \(\mathbf{x}=(1,2)\); substituting back, \(1+2=3\) and \(2(1)-2=0\). ✓
3. A square matrix \(A\) has \(\lvert A\rvert = 0\). What does this tell you about (a) its columns, (b) its rank, and (c) the number of solutions of \(A\mathbf{x}=\mathbf{b}\)?
(a) The columns are linearly dependent — at least one is a linear combination of the others.
(b) The rank is less than \(n\) (not full rank), because a zero determinant is equivalent to fewer than \(n\) independent columns.
(c) The matrix is singular, so \(A\mathbf{x}=\mathbf{b}\) does not have a unique solution: it has either no solution or infinitely many, depending on whether \(\mathbf{b}\) lies in the span of the columns of \(A\).
Related notes
Studying this for a
university module?
I tutor economics, econometrics and mathematics at university and postgraduate level, from linear algebra and optimisation through to econometric theory. Free 30–45 minute initial consultation.