Skip to main content

Introduction to matrices

Matrices, by RMIT, licensed under CC BY-NC 4.0

Use this resource to learn about matrices, their order, and the different types of matrices. A sound understanding of matrices is required in a huge range of real-world applications, like machine learning, natural language processing, robotics, image processing, urban planning and infrastructure development.

Matrices

Matrices are arrays of numbers or variables arranged in rows and columns. There are a few key features of matrices that you should understand:

  • A matrix is a rectangular array of elements.
  • Matrices are usually denoted by upper case letters.
  • The elements are usually written within brackets.
  • The order or shape of the matrix is determined by the number of rows and columns of the matrix.
  • The number of rows is always given first, then the number of columns.

An example of a matrix is:

\[A=\left[\begin{array}{ccc} 1 & 2 & -9\\
2 & 5 & -3
\end{array}\right]\]

Matrix \(A\) has \(2\) rows and \(3\) columns. Is it called a \(2\times3\) (or \(2\) by \(3\)) matrix. \(2\times3\) is also the order of matrix \(A\).

Square matrix

A matrix with the same number of rows and columns is called a square matrix. An example is:

\[B =\left[\begin{array}{cc} 2 & 3\\
2 & 5
\end{array}\right]\]

Matrix \(B\) is a square matrix and its order is \(2\times2\).

Unit matrix

A unit (or identity) matrix is a square matrix with diagonal elements equal to \(1\), and all other elements equal to \(0\). The unit matrix is usually denoted by \(I\), with the number of columns/rows indicated by a subscript.

For example, \(I_{3}\) is a \(3\times3\) unit matrix.

\[I_{3}=\left[\begin{array}{ccc} 1 & 0 & 0\\
0 & 1 & 0\\
0 & 0 & 1
\end{array}\right]\]

\(I_{2}\) is a \(2\times2\) unit matrix.

\[I_{2}=\left[\begin{array}{cc} 1 & 0\\
0 & 1
\end{array}\right]\]

Row matrix

A matrix with one row is called a row matrix. For example:

\[D =\left[\begin{array}{cccc} 2 & 1 & 0 & 4\end{array}\right]\]

Matrix \(D\) is a \(1\times4\) row matrix.

Column matrix

A matrix with one column is called a column matrix. For example:

\[E=\left[\begin{array}{c} 2\\
-4\\
1 \end{array}\right]\]

Matrix \(E\) is a \(3\times1\) column matrix.

Zero matrix

A zero matrix has all elements equal to zero. A zero matrix can simply be written as \(0\). For example:

\[0=\left[\begin{array}{cc} 0 & 0\\ 0 & 0 \end{array}\right]\]

This is a \(2\times2\) zero matrix.

A \(3\times3\) zero matrix would also be denoted \(0\).

\[0=\left[\begin{array}{ccc} 0 & 0 & 0\\
0 & 0 & 0\\
0 & 0 & 0
\end{array}\right]\]

Your turn – determining the order of matrices

  1. Determine the order of the following matrices.
    1. \(\left[\begin{array}{ccc} 7 & -5 & 0\\
      6 & 2 & -1
      \end{array}\right]\)
    2. \(\left[\begin{array}{cc} 0 & 2\\
      1 & 1
      \end{array}\right]\)
    3. \(\left[\begin{array}{c} 2\\
      -4\\
      1\\
      1 \end{array}\right]\)
    4. \(\left[\begin{array}{cc} 1 & 1\\
      3 & 0\\
      -2 & 3
      \end{array}\right]\)

    1. \(2\times3\)
    2. \(2\times2\)
    3. \(4\times1\)
    4. \(3\times2\)

Equal matrices

For two matrices to be equal, they must be the same shape and the corresponding elements must be equal.

Consider matrices \(A\) and \(B\).

\[\begin{align*} A & =\left[\begin{array}{ccc} 2 & 5 & b\\
5 & 3 & 1\\
2 & 0 & -2
\end{array}\right]
& B & =\left[\begin{array}{ccc} 2 & 5 & 7\\
5 & a & 1\\
2 & 0 & -2
\end{array}\right]
\end{align*}\]

If \(A\) and \(B\) are equal, then \(a=3\) and \(b=7\).

Your turn – identifying equal matrices

  1. Identify which of the following matrices are equal.
    1. \(\left[\begin{array}{cc} 3 & 0\\
      1 & -2
      \end{array}\right] \)
    2. \(\left[\begin{array}{cc} 3 & 1
      \end{array}\right] \)
    3. \(\left[\begin{array}{cc} 3 & 0
      \end{array}\right] \)
    4. \(\left[\begin{array}{cc} 3 & 0\\
      1 & -2
      \end{array}\right] \)

  1. \(A\) and \(D\)

Keywords