Chapter 5 - Matrices

MATH1050Matrices

Matrices represent a structured way of storing and using groups of data in mathematically valid ways. They were initially developed for solving systems of simultaneous equations, such as

Matrices are used very heavily in computer software, for solving complex problems from science, business and engineering. Most supercomputers spend a lot of their time solving large matrix problems.

5.1 Introduction to Matrices

We will start with an example to illustrate what matrices are and how they can be used in a familiar situation.

5.1.1 Example

Suppose that this week you buy 1kg of apples, 0.6kg of oranges and 0.76kg of bananas, and next week you buy 0.75kg of apples, 1kg of oranges and 0.8kg of bananas. If the cost of apples is 3.99 per kg, bananas is $1.89 per kg, how much did you spend on fruit each week?

This information can be presented as follows.

To determine how much money was spent on fruit each week we combine the information in a row of the first table with a column of the second table.

You spent 7.74 in the second week.


The rows and columns of numbers enclosed in brackets are examples of matrices and this combining operation is an example of matrix multiplication. We will now define matrices and operations on matrices formally.

A matrix is a rectangular array of numbers, enclosed in brackets.

An matrix has m rows and n columns. The size or order of a matrix is its number of rows and number of columns. An matrix has size ”* by “.

The plural of matrix is matrices.


Example 5.1.2


Common notation for a general matrix A is:

The notation is used to represent the element or entry in the th row and th column of the matrix A.

We commonly use an upper case letter to refer to a matrix and the corresponding lower case letter (with subscripts) to refer to the elements of that matrix.

A matrix with exactly one row may be called a row vector. A matrix with exactly one column may be called a column vector. Row and column vectors are often denoted by lower-case letters in bold type.

A matrix with one row and one column is just a number (as we’re all familiar with). Sometimes this is called a scalar, to distinguish it from matrices with multiple rows or columns, and we write it without any brackets.

A matrix in which every entry is 0 is called a zero matrix. The zero matrix will sometimes be written as .

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

Matrices and are equal if and only if:

  • A and B have the same size,
  • for all values of and .

5.2 Adding and Subtracting Matrices

Two matrices can be added or subtracted provided that they have the same size. Two matrices of different sizes cannot be added or subtracted!

Matrix addition: Let and be matrices. Then is the matrix with .

5.3 Scalar Multiplication of Matrices

It is possible to multiply any matrix by any scalar (number); this is called scalar multiplication.

Let be an matrix, and let be any scalar (number). Then is the matrix with .

Scalar multiplication of a matrix by a positive integer is the same as adding copies of together.

We usually write for . Note that matrix subtraction is just a combination of matrix addition and scalar multiplication since .

Multiplying Matrices

The product AB of matrices and exists if and only if the number of columns in equals the number of rows in .

Matrix multiplication: Let be an matrix and be an matrix. Then is the matrix with .

Some people get confused by how to work out exactly which row should be multiplied by which column. The following method may help you.

To multiply matrix A by matrix B (assuming possible):

Position (1,1) - multiply the first element in the first row of A by the first element in the first column of B. Add to this the product of the second element in the first row of A and the second element in the first column of B. Keep going until there are no more entries in the first row.

Position (1,2) - multiply the first element in the first row of A by the first element in the second column of B. Add to this the product of the second element in the first row of A and the second element in the second column of B. Keep going until there are no more entries in the first row.

Repeat the above procedure until the first row of your new matrix (AB) is complete.

Position (2,1) - multiply the first element in the second row of A by the first element in the first column of B. Add to this the product of the second element in the second row of A and the second element in the first column of B. Keep going until there are no more entries in the second row.

Repeat the above procedure until the second row of your new matrix (AB) is complete.

Repeat (a)-(e) until all rows are completed.

Properties of Matrix Multiplication

For matrices of appropriate sizes:

;

The order of multiplication is important. Matrix multiplication is not commutative, so in general .

The Transpose of a Matrix

Informally, the transpose of an matrix is the matrix obtained by exchanging the rows and columns of .

Formally, given an matrix , the transpose of is the matrix where:

The transpose of is usually denoted by .

5.6 Identity and Inverse Matrices

In the multiplication of real numbers, the number 1 plays a special role because for all real numbers . In matrix multiplication, this role is played by the identity matrix.

The identity matrix of order , denoted or , is the matrix where:

If is any matrix, then

More generally, if is any matrix, then:

When dealing with matrix powers, if is an matrix, we define .

The identity matrix is an example of a diagonal matrix. A square matrix is a diagonal matrix if and only if whenever .

The Inverse of a Square Matrix

A square matrix is non-singular if there exists a matrix such that . The matrix is called the inverse of , and is denoted .

A non-singular matrix is said to be invertible.

Not every square matrix is invertible.

A matrix that does not have an inverse is said to be singular or non-invertible.

Example 5.6.4

Show that the matrix is non-invertible.

Properties of Matrix Inverses

If and are non-singular matrices, then:

The Inverse of a 2 X 2 Matrix

Consider the matrix:

A is invertible if and only if .

If , then the inverse of is:

Example 5.6.5

Suppose that , verify that

Example 5.6.6

Determine, if possible, and .

Example 5.6.7

Prove that a matrix has at most one inverse.

5.7 The Determinant of a Square Matrix

With each square matrix we associate a number called the determinant of , denoted or .

A square matrix is invertible if and only if

The determinant of a matrix is often indicated by writing the elements of inside two vertical bars.

Memorise the formula for the determinant of a matrix.

For a (or larger) matrix, understand the following method for calculating determinants.

Calculating the Determinant of a Square Matrix

For the element in a matrix , define the of to be times the determinant of the matrix obtained from by deleting row and column .

To calculate the determinant of an matrix , choose one row (or column) of along which you will expand the determinant. Multiply each element of that row (or column) by its cofactor, and sum the results.

Observe that gives the pattern:

so if you remember this pattern, you don’t need to work out each time you calculate a cofactor.

5.8 Vector Product - part 2

In the previous chapter we saw how to calculate a vector product in using the vector products of the unit vectors, and . Although this method works, it can be a bit tedious. We now illustrate a shortcut using determinant notation.

If and then

Where the determinant must be expanded along its top row.

Area of a Triangle

The area of a triangle withy base length and height is given by .

The triangle formed by the vectors and has base of length and height given by , where is the angle between and .

Thus, the area of the triangle formed by vectors and is

5.9 Solving Systems of Linear Equations

Consider the following pair of simultaneous linear equations in two unknowns.

We can write these using matrices as follows:

\begin{pmatrix} 2 & 1 \\ 3 & 2 \end{pmatrix} \begin{pmatrix} x \\ y \end{pmatrix}=\begin{pmatrix} 7 \\ 12 \end{pmatrix}$$ Now the inverse of $A$ is:

A^{-1}=\begin{pmatrix} 2 & -1 \ -3 & 2 \end{pmatrix}

We can solve for $x$ and $y$ by multiplying both sides of the above matrix equation by $A^{-1}$ (on the left).

\begin{align} \begin{pmatrix} 2 & -1 \ -3 & 2 \end{pmatrix} \begin{pmatrix} 2 & 1 \ 3 & 2 \end{pmatrix} \begin{pmatrix} x \ y \end{pmatrix} &=\begin{pmatrix} 2 & -1 \ -3 & 2 \end{pmatrix} \begin{pmatrix} 7 \ 12 \end{pmatrix} \ \begin{pmatrix} 1 & 0 \ 0 & 1 \end{pmatrix} \begin{pmatrix} x \ y \ \end{pmatrix} &= \begin{pmatrix} 2 \ 3 \end{pmatrix} \ \begin{pmatrix} x \ y \end{pmatrix} &= \begin{pmatrix} 2 \ 3 \end{pmatrix} \end{align}

Thus, the solution is $x=2,y=3$.