Skip to content
10 min read

A Guide to Matrix Operations: Addition, Multiplication, and Inverses

Matrices are rectangular arrays of numbers that appear throughout mathematics, physics, computer science, and engineering. They provide a compact way to represent and solve systems of linear equations, perform geometric transformations, and organise data.

This guide covers the fundamental matrix operations you need to know, with clear worked examples for each.

What Is a Matrix?

A matrix is an arrangement of numbers in rows and columns. A matrix with mm rows and nn columns is called an m×nm \times n matrix. For example, this is a 2×32 \times 3 matrix:

A=[147258]A = \begin{bmatrix} 1 & 4 & 7 \\ 2 & 5 & 8 \end{bmatrix}

Matrix Addition and Subtraction

To add or subtract two matrices, they must have the same dimensions. You simply add (or subtract) corresponding entries.

Example 1: Matrix Addition

Add A=[1352]A = \begin{bmatrix} 1 & 3 \\ 5 & 2 \end{bmatrix} and B=[40−16]B = \begin{bmatrix} 4 & 0 \\ -1 & 6 \end{bmatrix}.

A+B=[1+43+05+(−1)2+6]=[5348]A + B = \begin{bmatrix} 1+4 & 3+0 \\ 5+(-1) & 2+6 \end{bmatrix} = \begin{bmatrix} 5 & 3 \\ 4 & 8 \end{bmatrix}

Scalar Multiplication

To multiply a matrix by a scalar (a single number), multiply every entry in the matrix by that scalar.

Example 2: Scalar Multiplication

3⋅[2−104]=[6−3012]3 \cdot \begin{bmatrix} 2 & -1 \\ 0 & 4 \end{bmatrix} = \begin{bmatrix} 6 & -3 \\ 0 & 12 \end{bmatrix}

Matrix Multiplication

To multiply two matrices AA (m×nm \times n) and BB (n×pn \times p), the number of columns in AA must equal the number of rows in BB. The result is an m×pm \times p matrix. Each entry is computed as a dot product:

(AB)ij=∑k=1nAik⋅Bkj(AB)_{ij} = \sum_{k=1}^{n} A_{ik} \cdot B_{kj}

Example 3: Matrix Multiplication

Multiply A=[2314]A = \begin{bmatrix} 2 & 3 \\ 1 & 4 \end{bmatrix} by B=[5102]B = \begin{bmatrix} 5 & 1 \\ 0 & 2 \end{bmatrix}.

AB=[2(5)+3(0)2(1)+3(2)1(5)+4(0)1(1)+4(2)]=[10859]AB = \begin{bmatrix} 2(5)+3(0) & 2(1)+3(2) \\ 1(5)+4(0) & 1(1)+4(2) \end{bmatrix} = \begin{bmatrix} 10 & 8 \\ 5 & 9 \end{bmatrix}

Note that matrix multiplication is not commutative. In general, AB≠BAAB \neq BA.

Determinants

The determinant is a scalar value associated with a square matrix. It tells you whether the matrix is invertible (non-zero determinant) and has geometric significance related to scaling.

For a 2×22 \times 2 matrix:

det⁡[abcd]=ad−bc\det\begin{bmatrix} a & b \\ c & d \end{bmatrix} = ad - bc

Example 4: Computing a Determinant

Find the determinant of A=[3715]A = \begin{bmatrix} 3 & 7 \\ 1 & 5 \end{bmatrix}.

det⁡(A)=3(5)−7(1)=15−7=8\det(A) = 3(5) - 7(1) = 15 - 7 = 8

Since the determinant is non-zero, this matrix is invertible.

Matrix Inverse

The inverse of a square matrix AA is the matrix A−1A^{-1} such that AA−1=A−1A=IAA^{-1} = A^{-1}A = I, where II is the identity matrix.

For a 2×22 \times 2 matrix:

A−1=1det⁡(A)[d−b−ca]A^{-1} = \frac{1}{\det(A)} \begin{bmatrix} d & -b \\ -c & a \end{bmatrix}

Example 5: Finding the Inverse

Find the inverse of A=[3715]A = \begin{bmatrix} 3 & 7 \\ 1 & 5 \end{bmatrix}.

We already found det⁡(A)=8\det(A) = 8.

A−1=18[5−7−13]=[5/8−7/8−1/83/8]A^{-1} = \frac{1}{8} \begin{bmatrix} 5 & -7 \\ -1 & 3 \end{bmatrix} = \begin{bmatrix} 5/8 & -7/8 \\ -1/8 & 3/8 \end{bmatrix}

The Transpose

The transpose of a matrix AA, written ATA^T, swaps its rows and columns. If AA is m×nm \times n, then ATA^T is n×mn \times m.

Example 6: Transpose

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

Key Points

  1. Dimensions matter. Addition requires matching dimensions. Multiplication requires the inner dimensions to match.
  2. Order matters in multiplication. AB≠BAAB \neq BA in general.
  3. Zero determinant means no inverse. Such matrices are called singular.

Try It Yourself

Perform matrix calculations with our free Matrix Calculator. It handles addition, multiplication, determinants, inverses, and more, with step-by-step solutions. For eigenvalue analysis, try our Eigenvalue Calculator as well.

Related Articles