MathLabs

Algebra

Matrices and determinants

Rectangular arrays of numbers and the scalar that measures how they scale volume.

IntuitionIntuition: a matrix as a machine that reshapes space

A matrix is a rectangular table of numbers, but it is most useful as a rule for turning one vector into another by a fixed linear recipe: stretch here, rotate there, maybe flip. The determinant is a single number attached to a square matrix that answers one very concrete question: by what factor does this matrix scale areas (in the plane) or volumes (in space), and does it flip orientation (left-handed becomes right-handed) along the way? A determinant of 00 means the matrix squashes space flat, losing a dimension entirely — that single fact turns out to control almost everything else about the matrix, including whether it can be undone.

Interactive rotating projection of a 4D hypercube illustrating a linear transformation.
How the 2×22\times 2 matrix A=(a11a12a21a22)A = \begin{pmatrix}a_{11}&a_{12}\\a_{21}&a_{22}\end{pmatrix} deforms the plane: the unit square becomes a parallelogram of signed area det⁡A=a11a22−a12a21\det A = a_{11}a_{22} - a_{12}a_{21}.

SchoolMatrix multiplication and the determinant formula

Definition: Matrix multiplication

If AA is m×nm\times n and BB is n×pn\times p, their product C=ABC=AB is the m×pm\times p matrix whose entries are Cij=∑k=1nAikBkjC_{ij} = \sum_{k=1}^{n} A_{ik}B_{kj}: entry (i,j)(i,j) of CC is the dot product of row ii of AA with column jj of BB.

Cij=∑k=1nAikBkjC_{ij} = \sum_{k=1}^{n} A_{ik}B_{kj}

Here AikA_{ik} is the entry in row ii, column kk of AA, and BkjB_{kj} is the entry in row kk, column jj of BB; the sum runs over the shared inner index kk, which is why AA's column count must equal BB's row count for the product to be defined at all.

Definition: Determinant (Leibniz formula)

For a square n×nn\times n matrix AA, the determinant is defined by det⁡(A)=∑σ∈Snsgn⁡(σ)∏i=1nai,σ(i)\det(A)=\sum_{\sigma\in S_n}\operatorname{sgn}(\sigma)\prod_{i=1}^n a_{i,\sigma(i)}, summing over every permutation σ\sigma of {1,…,n}\{1,\dots,n\}, with sgn⁡(σ)=+1\operatorname{sgn}(\sigma)=+1 or −1-1 depending on whether σ\sigma is even or odd. For n=2,3n=2,3 this expands into the familiar cofactor formulas below.

det⁡(abcd)=ad−bc\det\begin{pmatrix}a&b\\ c&d\end{pmatrix}=ad-bc

For a 2×22\times 2 matrix, det⁡(abcd)=ad−bc\det\begin{pmatrix}a&b\\ c&d\end{pmatrix}=ad-bc is exactly the signed area of the parallelogram spanned by the row vectors (a,b)(a,b) and (c,d)(c,d): the two permutations of {1,2}\{1,2\} are the identity (contributing +ad+ad) and the swap (contributing −bc-bc).

det⁡(a11a12a13a21a22a23a31a32a33)=a11(a22a33−a23a32)−a12(a21a33−a23a31)+a13(a21a32−a22a31)\det\begin{pmatrix}a_{11}&a_{12}&a_{13}\\ a_{21}&a_{22}&a_{23}\\ a_{31}&a_{32}&a_{33}\end{pmatrix}=a_{11}(a_{22}a_{33}-a_{23}a_{32})-a_{12}(a_{21}a_{33}-a_{23}a_{31})+a_{13}(a_{21}a_{32}-a_{22}a_{31})

For a 3×33\times 3 matrix, det⁡(a11a12a13a21a22a23a31a32a33)=a11(a22a33−a23a32)−a12(a21a33−a23a31)+a13(a21a32−a22a31)\det\begin{pmatrix}a_{11}&a_{12}&a_{13}\\ a_{21}&a_{22}&a_{23}\\ a_{31}&a_{32}&a_{33}\end{pmatrix}=a_{11}(a_{22}a_{33}-a_{23}a_{32})-a_{12}(a_{21}a_{33}-a_{23}a_{31})+a_{13}(a_{21}a_{32}-a_{22}a_{31}) is the cofactor expansion along the first row: expand along row 11, multiply each entry a1ja_{1j} by the 2×22\times 2 determinant of the matrix left after deleting row 11 and column jj, and alternate the sign +,−,++,-,+ across j=1,2,3j=1,2,3.

How elementary row operations affect the determinant
Row operationEffect on det⁡\det
Swap two rowsmultiplies det⁡\det by −1-1
Scale a row by kkmultiplies det⁡\det by kk
Add kk times a row to anotherdet⁡\det unchanged
Two rows equal or proportionaldet⁡=0\det=0

UndergraduateTheorems: multiplicativity and the invertibility criterion

For any two n×nn\times n matrices A,BA,B, det⁡(AB)=det⁡(A)det⁡(B)\det(AB)=\det(A)\det(B).

Why is it true?

Since the determinant measures how much a linear map scales volume, applying map BB first and then map AA should scale volume by BB's factor and then by AA's factor, i.e. by the product of the two factors — multiplicativity is exactly the algebraic statement that composing linear maps composes their volume-scaling factors.

Proof

First recall the effect of the three elementary row operations on the determinant (established directly from the Leibniz sum det⁡(A)=∑σ∈Snsgn⁡(σ)∏i=1nai,σ(i)\det(A)=\sum_{\sigma\in S_n}\operatorname{sgn}(\sigma)\prod_{i=1}^n a_{i,\sigma(i)}, since each term of that sum is linear in each row separately): swapping two rows multiplies det⁡\det by −1-1, scaling one row by kk multiplies det⁡\det by kk, and adding a multiple of one row to another leaves det⁡\det unchanged.

Each elementary row operation on AA is the same as left-multiplying AA by a corresponding elementary matrix EE (obtained by applying that same operation to the identity matrix II). Comparing with the previous paragraph, det⁡(E)\det(E) equals exactly the scaling factor of that operation (−1-1, kk, or 11 respectively), so for every elementary matrix EE, det⁡(EA)=det⁡(E)det⁡(A)\det(EA)=\det(E)\det(A).

Case AA invertible: Gaussian elimination reduces any invertible matrix to the identity using a finite sequence of elementary row operations, i.e. Em⋯E1A=IE_m\cdots E_1A=I for elementary matrices E1,…,EmE_1,\dots,E_m, so A=E1−1⋯Em−1A=E_1^{-1}\cdots E_m^{-1}, itself a product of elementary matrices (the inverse of an elementary matrix is again elementary, of the same type). Applying the previous paragraph's identity repeatedly, det⁡(A)=det⁡(E1−1)⋯det⁡(Em−1)\det(A)=\det(E_1^{-1})\cdots\det(E_m^{-1}), and applying it again to AB=E1−1⋯Em−1BAB=E_1^{-1}\cdots E_m^{-1}B gives det⁡(AB)=det⁡(E1−1)⋯det⁡(Em−1)det⁡(B)=det⁡(A)det⁡(B)\det(AB)=\det(E_1^{-1})\cdots\det(E_m^{-1})\det(B)=\det(A)\det(B).

Case AA singular: then det⁡(A)=0\det(A)=0 (a singular matrix cannot be reduced all the way to the identity, and the row-operation rules above show every reachable row-echelon form still has a zero row, forcing det⁡=0\det=0 by cofactor expansion along that row). Singularity also means rank⁡(A)<n\operatorname{rank}(A)<n, and since rank⁡(AB)≤rank⁡(A)<n\operatorname{rank}(AB)\leq\operatorname{rank}(A)<n for any BB, the product ABAB is singular too, so det⁡(AB)=0\det(AB)=0 as well. Hence det⁡(AB)=0=0⋅det⁡(B)=det⁡(A)det⁡(B)\det(AB)=0=0\cdot\det(B)=\det(A)\det(B), and the identity holds in this case too, completing the proof for every AA.

A square matrix AA is invertible if and only if det⁡(A)≠0\det(A)\neq 0; when it is invertible, A−1=1det⁡(A)adj⁡(A)A^{-1}=\dfrac{1}{\det(A)}\operatorname{adj}(A), where adj⁡(A)\operatorname{adj}(A) is the adjugate (transpose of the cofactor matrix).

Why is it true?

A linear map can be undone exactly when it does not collapse space to a lower dimension — since the determinant already measures exactly this "does it collapse volume to zero" question, invertibility and det⁡≠0\det\neq 0 are really the same statement seen from two angles: one algebraic (does an inverse matrix exist), one geometric (is the volume-scaling factor nonzero).

Proof

(⇒\Rightarrow) Suppose AA is invertible, so there is a matrix A−1A^{-1} with AA−1=IAA^{-1}=I. Applying the multiplicativity theorem proved above, det⁡(A)det⁡(A−1)=det⁡(AA−1)=det⁡(I)=1\det(A)\det(A^{-1})=\det(AA^{-1})=\det(I)=1. Since the product of the two numbers det⁡(A)\det(A) and det⁡(A−1)\det(A^{-1}) equals 11, neither of them can be 00 — so det⁡(A)≠0\det(A)\neq 0.

(⇐\Leftarrow), worked concretely for 2×22\times 2: suppose A=(abcd)A=\begin{pmatrix}a&b\\ c&d\end{pmatrix} has det⁡(A)=ad−bc≠0\det(A)=ad-bc\neq 0. Define adj⁡(A)=(d−b−ca)\operatorname{adj}(A)=\begin{pmatrix}d&-b\\ -c&a\end{pmatrix}. Multiplying directly, A⋅adj⁡(A)=(abcd)(d−b−ca)=(ad−bc−ab+abcd−cd−cb+ad)=(ad−bc00ad−bc)=det⁡(A) IA\cdot\operatorname{adj}(A)=\begin{pmatrix}a&b\\ c&d\end{pmatrix}\begin{pmatrix}d&-b\\ -c&a\end{pmatrix}=\begin{pmatrix}ad-bc&-ab+ab\\ cd-cd&-cb+ad\end{pmatrix}=\begin{pmatrix}ad-bc&0\\ 0&ad-bc\end{pmatrix}=\det(A)\,I, exactly the identity A⋅adj⁡(A)=det⁡(A) IA\cdot\operatorname{adj}(A)=\det(A)\,I. The same computation in the other order gives adj⁡(A)⋅A=det⁡(A) I\operatorname{adj}(A)\cdot A=\det(A)\,I as well.

Since det⁡(A)≠0\det(A)\neq 0, divide both sides of A⋅adj⁡(A)=det⁡(A)IA\cdot\operatorname{adj}(A)=\det(A)I by the scalar det⁡(A)\det(A) to get A⋅adj⁡(A)det⁡(A)=IA\cdot\dfrac{\operatorname{adj}(A)}{\det(A)}=I, and likewise from the other order adj⁡(A)det⁡(A)⋅A=I\dfrac{\operatorname{adj}(A)}{\det(A)}\cdot A=I. This exhibits an explicit two-sided inverse A−1=1det⁡(A)adj⁡(A)A^{-1}=\dfrac{1}{\det(A)}\operatorname{adj}(A), so AA is invertible.

For general nn (illustrated at n=3n=3), the same argument works because the Laplace cofactor expansion gives ∑jaijCij=det⁡(A)\sum_j a_{ij}C_{ij}=\det(A) (expanding along row ii) while ∑jaijCkj=0\sum_j a_{ij}C_{kj}=0 for i≠ki\neq k (this sum is the cofactor expansion of a matrix with row ii copied into row kk, which has two equal rows and hence determinant 00 by the table above). Assembling these row-by-row identities into matrix form gives exactly A⋅adj⁡(A)=det⁡(A)IA\cdot\operatorname{adj}(A)=\det(A)I for every size nn, so whenever det⁡(A)≠0\det(A)\neq 0 the same division argument as in the 2×22\times 2 case produces A−1=adj⁡(A)/det⁡(A)A^{-1}=\operatorname{adj}(A)/\det(A); conversely, if det⁡(A)=0\det(A)=0, the first paragraph's contrapositive rules out invertibility entirely, since det⁡(A)det⁡(A−1)=1\det(A)\det(A^{-1})=1 would force det⁡(A)≠0\det(A)\neq 0. This proves the criterion in both directions.

UndergraduateReal-World Applications and Worked Examples

Determinants let engineers solve small linear systems by an explicit formula (Cramer's rule) instead of elimination, and let computer graphics programs check in one number whether a transformation preserves or flips orientation and by how much it scales area — both are direct uses of det⁡≠0\det\neq 0 meaning "invertible" and ∣det⁡∣|\det| meaning "scale factor."

Example: Engineering: solving a two-loop circuit with Cramer's rule

Kirchhoff's laws applied to a two-loop circuit give the linear system 3x+y=113x+y=11 and x+2y=8x+2y=8 for the two loop currents x,yx,y (in amperes). Solve for xx and yy using determinants.

Solution

Write the system as a matrix equation (3112)(xy)=(118)\begin{pmatrix}3&1\\1&2\end{pmatrix}\begin{pmatrix}x\\y\end{pmatrix}=\begin{pmatrix}11\\8\end{pmatrix}. The coefficient matrix has det⁡=3×2−1×1=6−1=5≠0\det=3\times2-1\times1=6-1=5\neq 0, so by the invertibility criterion the system has a unique solution, and Cramer's rule applies.

Cramer's rule says x=det⁡(11182)det⁡(3112)x=\dfrac{\det\begin{pmatrix}11&1\\8&2\end{pmatrix}}{\det\begin{pmatrix}3&1\\1&2\end{pmatrix}}: replace the first column of the coefficient matrix by the right-hand side, take its determinant, and divide by the original determinant. The numerator is 11×2−1×8=22−8=1411\times2-1\times8=22-8=14, so x=14/5=2.8x=14/5=2.8 A.

Similarly y=det⁡(31118)5y=\dfrac{\det\begin{pmatrix}3&11\\1&8\end{pmatrix}}{5}: replace the second column instead. The numerator is 3×8−11×1=24−11=133\times8-11\times1=24-11=13, so y=13/5=2.6y=13/5=2.6 A.

Checking: 3(2.8)+2.6=8.4+2.6=113(2.8)+2.6=8.4+2.6=11 ✓ and 2.8+2(2.6)=2.8+5.2=82.8+2(2.6)=2.8+5.2=8 ✓, confirming x=2.8x=2.8 A and y=2.6y=2.6 A solve the circuit equations exactly.

Example: Computer graphics: does a transformation flip a shape, and by how much does it scale area?

A 2D graphics engine applies the transformation matrix M=(2143)M=\begin{pmatrix}2&1\\4&3\end{pmatrix} to every point of a shape of area 55 square units. Determine whether the transformed shape is mirror-flipped compared to the original, and compute the area of the transformed shape.

Solution

Compute the determinant of MM: det⁡(M)=2×3−1×4=6−4=2\det(M)=2\times3-1\times4=6-4=2.

The sign of det⁡(M)\det(M) tells us about orientation: since det⁡(M)=2>0\det(M)=2>0, the transformation preserves orientation, so the shape is not mirror-flipped (a negative determinant would indicate a flip, since it means an odd number of reflections are baked into the matrix).

The magnitude ∣det⁡(M)∣|\det(M)| tells us the area-scaling factor: every region's area gets multiplied by ∣det⁡(M)∣=2|\det(M)|=2 after the transformation, regardless of the region's shape, because this is exactly the geometric meaning of the determinant established earlier.

So the transformed shape has area 5×∣det⁡(M)∣=5×2=105\times|\det(M)|=5\times2=10 square units, and it keeps the same orientation (not flipped) as the original shape.

What is det⁡(2513)\det\begin{pmatrix}2&5\\1&3\end{pmatrix}?

If det⁡(A)=3\det(A)=3 and det⁡(B)=4\det(B)=4 for two n×nn\times n matrices, what is det⁡(AB)\det(AB)?

For which matrix does an inverse fail to exist?

A graphics transformation matrix has det⁡=−3\det=-3. What does this tell us?

References

  1. Eric W. Weisstein (MathWorld) (2024). Determinant
  2. Gilbert Strang (2016). Introduction to Linear Algebra