• Practice
  • About 22 min
  • 5 practice questions

Matrices: order, types and operations

Write the order of a matrix and its elements aᵢⱼ, recognise the types of matrices including the transpose, use equality of matrices, and add, subtract, multiply by a scalar and multiply two matrices, knowing which properties hold.

If something looks wrong, please tell us.

By the end of this lesson you can

  • State the order m × n of a matrix, name its element aᵢⱼ and construct a matrix from a rule.
  • Recognise row, column, square, diagonal, scalar, identity, zero and triangular matrices and find a transpose.
  • Add, subtract and multiply matrices, and use the properties AB ≠ BA in general, (AB)C = A(BC) and (AB)ᵀ = BᵀAᵀ.

A table of how many story books, notebooks and pencils four friends own is already a matrix: numbers arranged in rows and columns. Matrices are used in computer graphics, coding and decoding messages, and solving equations. In this lesson a matrix is written row by row inside square brackets, with a semicolon between rows: A = [1 2; 3 4] has first row 1, 2 and second row 3, 4.

Order and elements

A matrix is a rectangular array of elements arranged in rows (horizontal) and columns (vertical). A matrix with m rows and n columns has order m × n (read 'm by n'); this is not the product of m and n, though it has mn elements. The element in row i and column j is written aᵢⱼ. Always give the number of rows first.

Worked example 1: constructing a matrix and counting orders

(i) Construct the 2 × 3 matrix with aᵢⱼ = i + 2j. Working: row 1: a₁₁ = 1 + 2 = 3, a₁₂ = 1 + 4 = 5, a₁₃ = 1 + 6 = 7; row 2: a₂₁ = 4, a₂₂ = 6, a₂₃ = 8. So A = [3 5 7; 4 6 8]. (ii) What orders can a matrix with 12 elements have? Each order m × n needs mn = 12: 1 × 12, 12 × 1, 2 × 6, 6 × 2, 3 × 4, 4 × 3, six possible orders.

Types of matrices

Types of matrices
TypeDescriptionExample
Row matrix (row vector)Only one row, order 1 × n[8 9 4 3]
Column matrix (column vector)Only one column, order m × 1[2; −1; 5]
Square matrixNumber of rows = number of columns[1 3; 2 5]
Diagonal matrixSquare; every element off the leading diagonal (a₁₁, a₂₂, …) is 0[4 0; 0 −2]
Scalar matrixDiagonal matrix with all diagonal elements equal[5 0; 0 5]
Identity (unit) matrix IₙDiagonal elements 1, all others 0I₂ = [1 0; 0 1]
Zero (null) matrix OEvery element is 0[0 0 0; 0 0 0]
Upper / lower triangularSquare; zeros below / above the leading diagonal[1 7; 0 2] is upper triangular

The transpose Aᵀ is formed by interchanging rows and columns: the first row of A becomes the first column of Aᵀ. If A is m × n, then Aᵀ is n × m, and (Aᵀ)ᵀ = A. For example, the transpose of [1 2 3; 4 5 6] is [1 4; 2 5; 3 6].

Equal matrices

Two matrices are equal if they have the same order and their corresponding elements are equal. Example: if [x + y 2; 5 x − y] = [7 2; 5 3], then x + y = 7 and x − y = 3, so 2x = 10, x = 5 and y = 2.

Addition, subtraction and scalar multiplication

Matrices of the same order are added or subtracted by adding or subtracting corresponding elements. Multiplying a matrix by a number k (a scalar) multiplies every element by k. Matrix addition is commutative and associative, the zero matrix O is the additive identity (A + O = A), and −A is the additive inverse (A + (−A) = O). Also k(A + B) = kA + kB and (p + q)A = pA + qA.

Worked example 2: A = [1 2; 3 4] and B = [0 1; 2 −1]

Working: A + B = [1 + 0 2 + 1; 3 + 2 4 − 1] = [1 3; 5 3]. 2A = [2 4; 6 8], so 2A − B = [2 − 0 4 − 1; 6 − 2 8 + 1] = [2 3; 4 9].

Multiplication of matrices

The product AB is defined only when the number of columns of A equals the number of rows of B. If A is m × n and B is n × p, then AB is m × p. Each element of AB is found by multiplying the elements of a row of A by the corresponding elements of a column of B and adding.

Finding the element in row i, column j of AB

  1. Check the orders (m × n)(n × p): the inner numbers must match; the answer is m × p.
  2. Take row i of A Its n elements, left to right.
  3. Take column j of B Its n elements, top to bottom.
  4. Multiply in pairs and add First × first + second × second + …

Worked example 3: AB and BA for the same A and B

Working: AB = [1×0 + 2×2 1×1 + 2×(−1); 3×0 + 4×2 3×1 + 4×(−1)] = [4 −1; 8 −1]. BA = [0×1 + 1×3 0×2 + 1×4; 2×1 + (−1)×3 2×2 + (−1)×4] = [3 4; −1 0]. So AB ≠ BA: matrix multiplication is not commutative in general.

Worked example 4: transpose of a product

Check (AB)ᵀ = BᵀAᵀ for the same A and B. Working: (AB)ᵀ = [4 8; −1 −1]. Bᵀ = [0 2; 1 −1] and Aᵀ = [1 3; 2 4]. BᵀAᵀ = [0×1 + 2×2 0×3 + 2×4; 1×1 + (−1)×2 1×3 + (−1)×4] = [4 8; −1 −1]. They are equal. Note the order reverses.

Properties of matrix multiplication

  • Not commutative in general: AB ≠ BA (sometimes BA is not even defined).
  • Associative: (AB)C = A(BC).
  • Distributive over addition: A(B + C) = AB + AC and (A + B)C = AC + BC.
  • Identity: AI = IA = A for a square matrix A and the identity I of the same order.
  • AB can be the zero matrix when neither A nor B is zero: [1 −1; −1 1][1 1; 1 1] = [0 0; 0 0].
  • (A + B)² ≠ A² + 2AB + B² in general; it holds only when AB = BA.

Worked example 5: equations written as matrices

Solve [3 1; 1 2][x; y] = [7; 4]. Working: multiplying out, 3x + y = 7 and x + 2y = 4. From the second, x = 4 − 2y; substitute: 12 − 6y + y = 7, so 5y = 5 and y = 1, x = 2. Check: 3(2) + 1 = 7 and 2 + 2 = 4.

(m × n) × (n × p) gives m × p. AB ≠ BA in general; (AB)C = A(BC); A(B + C) = AB + AC; AI = IA = A; (AB)ᵀ = BᵀAᵀ.

— Matrix multiplication

Key takeaways: the order is rows × columns, and aᵢⱼ sits in row i, column j. Know the special types and that the transpose swaps rows and columns. Add only matrices of the same order; multiply A by B only when columns of A = rows of B, using row-by-column sums. Multiplication is associative and distributive but not commutative, and (AB)ᵀ = BᵀAᵀ.

Check your understanding

  1. 1. How many different orders can a matrix with 18 elements have?

    1. 4
    2. 6
    3. 3
    4. 18
    Show answer

    Answer: B. We need mn = 18: 1 × 18, 18 × 1, 2 × 9, 9 × 2, 3 × 6 and 6 × 3. That is 6 orders.

  2. 2. Which is the 2 × 2 matrix with aᵢⱼ = 2i − j?

    1. [1 3; 0 2]
    2. [1 2; 3 4]
    3. [2 1; 4 3]
    4. [1 0; 3 2]
    Show answer

    Answer: D. a₁₁ = 2 − 1 = 1, a₁₂ = 2 − 2 = 0, a₂₁ = 4 − 1 = 3, a₂₂ = 4 − 2 = 2. Row 1 is 1, 0 and row 2 is 3, 2, so the matrix is [1 0; 3 2].

  3. 3. A is a 3 × 2 matrix and B is a 2 × 4 matrix. What is the order of AB?

    1. 3 × 4
    2. 2 × 2
    3. 4 × 3
    4. AB is not defined
    Show answer

    Answer: A. The columns of A (2) equal the rows of B (2), so AB is defined, and its order is (rows of A) × (columns of B) = 3 × 4. BA is not defined, since B has 4 columns but A has 3 rows.

  4. 4. If A = [2 1; 0 3] and B = [1 0; 4 2], what is AB?

    1. [2 1; 8 10]
    2. [3 1; 4 5]
    3. [6 2; 12 6]
    4. [2 0; 0 6]
    Show answer

    Answer: C. Row 1 of A with the columns of B: 2×1 + 1×4 = 6 and 2×0 + 1×2 = 2. Row 2: 0×1 + 3×4 = 12 and 0×0 + 3×2 = 6. So AB = [6 2; 12 6]. [2 1; 8 10] is BA and [3 1; 4 5] is A + B.

  5. 5. What is the transpose of [1 2 3; 4 5 6]?

    1. [6 5 4; 3 2 1]
    2. [1 4; 2 5; 3 6]
    3. [1 2; 3 4; 5 6]
    4. [3 2 1; 6 5 4]
    Show answer

    Answer: B. Interchange rows and columns: the first row 1, 2, 3 becomes the first column, and the second row 4, 5, 6 becomes the second column. The result [1 4; 2 5; 3 6] has order 3 × 2.

Sign in to keep track of the lessons you finish.

Next lesson → Final self-assessment: Algebra

Privacy · Terms · Refunds · Delivery