Stat Trek

Teach yourself statistics

Stat Trek

Teach yourself statistics

What is a Matrix?

This lesson introduces the matrix - the rectangular array at the heart of matrix algebra. Matrix algebra is used quite a bit in advanced statistics, largely because it provides two benefits.

  • Compact notation for describing sets of data and sets of equations.
  • Efficient methods for manipulating sets of data and solving sets of equations.

Matrix Definition

A matrix is a rectangular array of numbers arranged in rows and columns. The array of numbers below is an example of a matrix.

21 62 33 93
44 95 66 13
77 38 79 33

The number of rows and columns that a matrix has is called its dimension or its order. By convention, rows are listed first; and columns, second. Thus, we would say that the dimension (or order) of the above matrix is 3 x 4, meaning that it has 3 rows and 4 columns.

Numbers that appear in the rows and columns of a matrix are called elements of the matrix. In the above matrix, the element in the first column of the first row is 21; the element in the second column of the first row is 62; and so on.

Matrix Notation

Statisticians use symbols to identify matrix elements and matrices.

  • Matrix elements. Consider the matrix below, in which matrix elements are represented entirely by symbols.

    A11 A12 A13 A14
    A21 A22 A23 A24
    By convention, first subscript refers to the row number; and the second subscript, to the column number. Thus, the first element in the first row is represented by A11. The second element in the first row is represented by A12. And so on, until we reach the fourth element in the second row, which is represented by A24.
  • Matrices. There are several ways to represent a matrix symbolically. The simplest is to use a boldface letter, such as A, B, or C. Thus, A might represent a 2 x 4 matrix, as illustrated below.

    A =    
    11 62 33 93
    44 95 66 13

    Another approach for representing matrix A is:

    A = [ Aij ] where i = 1, 2 and j = 1, 2, 3, 4

    This notation indicates that A is a matrix with 2 rows and 4 columns. The actual elements of the array are not displayed; they are represented by the symbol Aij.

Other matrix notation will be introduced as needed. For a description of all the matrix notation used in this tutorial, see the Matrix Notation Appendix.

Matrix Equality

To understand matrix algebra, we need to understand matrix equality. Two matrices are equal if all three of the following conditions are met:

  • Each matrix has the same number of rows.
  • Each matrix has the same number of columns.
  • Corresponding elements within each matrix are equal.

Consider the three matrices shown below.

A =    
111 x
y 444

B =    
111 222
333 444

C =    
 m   n
 p   q

If A = B, we know that x = 222 and y = 333; since corresponding elements of equal matrices are also equal. And we know that matrix C is not equal to A or B, because C has more columns than A or B.

Test Your Understanding

Problem 1

The notation below describes two matrices - matrix A and matrix B.

A = [ Aij ]

where i = 1, 2, 3 and j = 1, 2

B =    
111 222 333 444
555 666 777 888

Which of the following statements about A and B are true?

I. Matrix A has 5 elements.
II. The dimension of matrix B is 4 x 2.
III. In matrix B, element B21 is equal to 222.

(A) I only
(B) II only
(C) III only
(D) All of the above
(E) None of the above


The correct answer is (E).

  • Matrix A has 3 rows and 2 columns; that is, 3 rows, each with 2 elements. This adds up to 6 elements, altogether - not 5.
  • The dimension of matrix B is 2 x 4 - not 4 x 2. That is, matrix B has 2 rows and 4 columns - not 4 rows and 2 columns.
  • And, finally, element B21 refers to the first element in the second row of matrix B, which is equal to 555 - not 222.