Use Sophia to knock out your gen-ed requirements quickly and affordably. Learn more
×

Matrices and Matrix Operations

Author: Sophia

1. Finding the Sum and Difference of Two Matrices

We typically name matrices using capital letters.

For instance, A equals open square brackets table row cell short dash 1 end cell 2 row 1 4 end table close square brackets and B equals open square brackets table row 1 0 2 row 3 cell short dash 1 end cell 4 row 5 2 cell short dash 3 end cell row 2 0 6 end table close square brackets.

The dimension of a matrix is written m cross times n comma where m is the number of rows and n is the number of columns.

For instance, the dimension of A is 2 cross times 2 and the dimension of B is 4 cross times 3.

try it
Consider the matrix: D equals open square brackets table row 4 cell short dash 1 end cell 2 row cell short dash 7 end cell 0 8 end table close square brackets

Matrices with the same dimension can be added and subtracted. To add two matrices, add the corresponding entries. To subtract two matrices, subtract the corresponding entries (first minus second).

EXAMPLE

Let A equals open square brackets table row cell short dash 2 end cell 4 row 1 6 end table close square brackets and B equals open square brackets table row 5 cell short dash 2 end cell row 7 8 end table close square brackets.

Then, A plus B equals open square brackets table row cell short dash 2 plus 5 end cell cell 4 plus open parentheses short dash 2 close parentheses end cell row cell 1 plus 7 end cell cell 6 plus 8 end cell end table close square brackets equals open square brackets table row 3 2 row 8 14 end table close square brackets and A minus B equals open square brackets table row cell short dash 2 minus 5 end cell cell 4 minus open parentheses short dash 2 close parentheses end cell row cell 1 minus 7 end cell cell 6 minus 8 end cell end table close square brackets equals open square brackets table row cell short dash 7 end cell 6 row cell short dash 6 end cell cell short dash 2 end cell end table close square brackets.

try it
Consider the matrices D equals open square brackets table row 4 cell short dash 1 end cell 2 row cell short dash 7 end cell 0 8 end table close square brackets and E equals open square brackets table row 1 17 cell short dash 6 end cell row 3 5 cell short dash 2 end cell end table close square brackets.

When the numbers in the matrices represent quantities, certain operations can be meaningful too.

EXAMPLE

There are three convenience stores in Gambler. For one week, each store's sales were recorded for four items:

  • Store I sold 88 loaves of bread, 40 quarts of milk, 12 jars of peanut butter, and 116 pounds of cold cuts.
  • Store II sold 105 loaves of bread, 69 quarts of milk, 18 jars of peanut butter, and 150 pounds of cold cuts.
  • Store III sold 70 loaves of bread, 30 quarts of milk, no peanut butter, and 50 pounds of cold cuts.
A matrix that could be used to represent this situation is A equals open square brackets table row 88 40 12 116 row 105 69 18 150 row 70 30 0 50 end table close square brackets. Quantity of each item is stored in columns; rows correspond to each store.

During the next week, the sales matrix is B equals open square brackets table row 110 50 16 145 row 140 92 24 200 row 77 33 0 55 end table close square brackets.

The combined sales for both weeks is given by the matrix sum A plus B. If you wanted to see the sales gains from one week to the next, you would compute B minus A.


2. Finding Scalar Multiples of Matrices

A scalar is a number that has no dimension; it is simply used as a multiple.

Given a matrix A and a scalar c, the scalar multiple of A is defined as cA, and is obtained by multiplying all entries of matrix A by the scalar c.

Instead of just calling c “a number,” it is important that we distinguish it from matrices since a matrix is a table of numbers.

EXAMPLE

Given A equals open square brackets table row cell short dash 2 end cell 4 row 1 6 end table close square brackets comma find 5 A.

5 A equals open square brackets table row cell 5 open parentheses short dash 2 close parentheses end cell cell 5 open parentheses 4 close parentheses end cell row cell 5 open parentheses 1 close parentheses end cell cell 5 open parentheses 6 close parentheses end cell end table close square brackets equals open square brackets table row cell short dash 10 end cell 20 row 5 30 end table close square brackets

Now, here is one for you to try on your own.

try it
Consider the matrix: D equals open square brackets table row 4 cell short dash 1 end cell 2 row cell short dash 7 end cell 0 8 end table close square brackets

Assuming the matrices have the same dimension, scalar multiplication can be combined with addition and subtraction.

EXAMPLE

Given A equals open square brackets table row 2 cell short dash 3 end cell row 4 0 end table close square brackets and B equals open square brackets table row 6 5 row cell short dash 1 end cell 7 end table close square brackets comma find 3 A minus 4 B.

First, perform the scalar multiplications:

3 A equals open square brackets table row 6 cell short dash 9 end cell row 12 0 end table close square brackets     and     4 B equals open square brackets table row 24 20 row cell short dash 4 end cell 28 end table close square brackets


Then, 3 A minus 4 B equals open square brackets table row 6 cell short dash 9 end cell row 12 0 end table close square brackets minus open square brackets table row 24 20 row cell short dash 4 end cell 28 end table close square brackets equals open square brackets table row cell short dash 18 end cell cell short dash 29 end cell row 16 cell short dash 28 end cell end table close square brackets.

Now, here is one for you to try.

try it
Let A equals open square brackets table row 1 4 row 2 cell short dash 3 end cell row 9 5 end table close square brackets and B equals open square brackets table row cell short dash 2 end cell 6 row 0 4 row 3 cell short dash 8 end cell end table close square brackets.
Find 5A + 3B.
First, perform the scalar multiplications:

5 A equals open square brackets table row 5 20 row 10 cell short dash 15 end cell row 45 25 end table close square brackets

3 B equals open square brackets table row cell short dash 6 end cell 18 row 0 12 row 9 cell short dash 24 end cell end table close square brackets

Then:

5 A plus 3 B equals open square brackets table row 5 20 row 10 cell short dash 15 end cell row 45 25 end table close square brackets plus open square brackets table row cell short dash 6 end cell 18 row 0 12 row 9 cell short dash 24 end cell end table close square brackets equals open square brackets table row cell short dash 1 end cell 38 row 10 cell short dash 3 end cell row 54 1 end table close square brackets

term to know
Scalar
A number that has no dimension, simply used as a multiple.


3. Finding the Product of Two Matrices

3a. The Dimension of a Matrix Product

Given two matrices A and B, their product AB is the result of multiplying the rows of A with the columns of B.

That said, here is what we know about the matrix product AB:

  • For AB to be defined, the number of columns in A must be equal to the number of rows in B.
  • If A has dimension m cross times n and B has dimension n cross times p comma then AB has dimension m cross times p.
  • The products AB and BA are not necessarily equal. That is, matrix multiplication is not commutative.

EXAMPLE

Let A and B be matrices. If A has dimension 3 cross times 5 and B has dimension 5 cross times 3 comma then we know the following:

  • The product AB is defined since A has 5 columns and B has 5 rows. The product has dimension 3 cross times 3.
  • The product BA is defined since B has 3 columns and A has 3 rows. The product has dimension 5 cross times 5.
Notice that both products are defined but have different dimensions. This justifies that matrix multiplication is not commutative, since two matrices of different sizes can’t be equal.

try it
Let A and B be matrices, where A has dimension 2 cross times 7 and B has dimension 7 cross times 1.
What are the dimensions of AB and BA?
AB has dimension 2 cross times 1 and BA is not defined, therefore has no dimension.

Now, let’s find matrix products.

3b. Calculating Matrix Products

As mentioned earlier, the matrix product AB is found by multiplying each row of A by each column in B. This first example will help to illustrate this.

EXAMPLE

Given A equals open square brackets table row cell short dash 1 end cell 4 row 3 2 end table close square brackets and B equals open square brackets table row 7 row 3 end table close square brackets comma find the matrix product AB.

First, check the dimensions: A has dimension 2 cross times 2 and B has dimension 2 cross times 1. This means that AB is defined and also has dimension 2 cross times 1.

To perform the multiplication, write the product as open square brackets table row cell short dash 1 end cell 4 row 3 2 end table close square brackets open square brackets table row 7 row 3 end table close square brackets equals open square brackets table row ? row ? end table close square brackets.

To get the first row, first column entry in the product, multiply the first row of A by the (first) column of B.

This is done by multiplying corresponding entries, then adding the products.

That is, multiply open square brackets table row cell short dash 1 end cell 4 end table close square brackets by open square brackets table row 7 row 3 end table close square brackets. This gives short dash 1 open parentheses 7 close parentheses plus 4 open parentheses 3 close parentheses equals 5.

To get the second row, (first) column entry in the product, multiply the second row of A by the (first) column of B.

That is, multiply open square brackets table row 3 2 end table close square brackets by open square brackets table row 7 row 3 end table close square brackets. This gives 3 open parentheses 7 close parentheses plus 2 open parentheses 3 close parentheses equals 27.

The matrix product A B equals open square brackets table row 5 row 27 end table close square brackets.

watch
In this video, we will find the product AB where A equals open square brackets table row cell short dash 1 end cell 4 row 3 2 end table close square brackets and B equals open square brackets table row 2 0 5 row cell short dash 3 end cell 1 4 end table close square brackets.

Now, here is one for you to try.

try it
Given A equals open square brackets table row 2 3 7 row 4 cell short dash 1 end cell 0 end table close square brackets and B equals open square brackets table row 5 row 8 row 12 end table close square brackets.
Find the matrix product AB.
First, make sure that the product is defined:

A has dimension 2 cross times 3 comma and B has dimension 3 cross times 1. Since the 3’s match, the product is defined, and the result will be a 2 cross times 1 matrix.

Now to find the product, find products of each row from A with each column of B.

A B equals open square brackets table row 2 3 7 row 4 cell short dash 1 end cell 0 end table close square brackets open square brackets table row 5 row 8 row 12 end table close square brackets equals open square brackets table row cell 2 open parentheses 5 close parentheses plus 3 open parentheses 8 close parentheses plus 7 open parentheses 12 close parentheses end cell row cell 4 open parentheses 5 close parentheses minus 1 open parentheses 8 close parentheses plus 0 open parentheses 12 close parentheses end cell end table close square brackets equals open square brackets table row 118 row 12 end table close square brackets

3c. Identity Matrices

The notation I subscript n is used to represent the identity matrix with dimension n cross times n.

Some examples of identity matrices:

I subscript 2 equals open square brackets table row 1 0 row 0 1 end table close square brackets

I subscript 3 equals open square brackets table row 1 0 0 row 0 1 0 row 0 0 1 end table close square brackets

Assuming the matrix product is defined, the product of an identity matrix and a matrix A in either direction is also equal to A.

big idea
Given matrix A has dimension m cross times n comma then I subscript m A equals A and A I subscript n equals A. The dimension of I subscript n has to be chosen carefully so that the matrix products are defined.

EXAMPLE

Consider the matrix: A equals open square brackets table row 2 0 cell short dash 3 end cell row 4 1 6 end table close square brackets

Note that A has dimension 2 cross times 3. This means that I subscript 2 A equals A and A I subscript 3 equals A. This is illustrated below.

I subscript 2 A equals open square brackets table row 1 0 row 0 1 end table close square brackets open square brackets table row 2 0 cell short dash 3 end cell row 4 1 6 end table close square brackets
I subscript 2 A equals open square brackets table row cell 1 open parentheses 2 close parentheses plus 0 open parentheses 4 close parentheses end cell cell 1 open parentheses 0 close parentheses plus 0 open parentheses 1 close parentheses end cell cell 1 open parentheses short dash 3 close parentheses plus 0 open parentheses 6 close parentheses end cell row cell 0 open parentheses 2 close parentheses plus 1 open parentheses 4 close parentheses end cell cell 0 open parentheses 0 close parentheses plus 1 open parentheses 1 close parentheses end cell cell 0 open parentheses short dash 3 close parentheses plus 1 open parentheses 6 close parentheses end cell end table close square brackets
I subscript 2 A equals open square brackets table row 2 0 cell short dash 3 end cell row 4 1 6 end table close square brackets

A I subscript 3 equals open square brackets table row 2 0 cell short dash 3 end cell row 4 1 6 end table close square brackets open square brackets table row 1 0 0 row 0 1 0 row 0 0 1 end table close square brackets
A I subscript 3 equals open square brackets table row cell 2 open parentheses 1 close parentheses plus 0 open parentheses 0 close parentheses minus 3 open parentheses 0 close parentheses end cell cell 2 open parentheses 0 close parentheses plus 0 open parentheses 1 close parentheses minus 3 open parentheses 0 close parentheses end cell cell 2 open parentheses 0 close parentheses plus 0 open parentheses 0 close parentheses minus 3 open parentheses 1 close parentheses end cell row cell 4 open parentheses 1 close parentheses plus 1 open parentheses 0 close parentheses plus 6 open parentheses 0 close parentheses end cell cell 4 open parentheses 0 close parentheses plus 1 open parentheses 1 close parentheses plus 6 open parentheses 0 close parentheses end cell cell 4 open parentheses 0 close parentheses plus 1 open parentheses 0 close parentheses plus 6 open parentheses 1 close parentheses end cell end table close square brackets
A I subscript 3 equals open square brackets table row 2 0 cell short dash 3 end cell row 4 1 6 end table close square brackets

As you can see, the product in both cases is A.

Now, here is one you can verify.

try it
Let A equals open square brackets table row 2 cell short dash 1 end cell row 4 5 end table close square brackets.
Choose identity matrices of appropriate dimension and show that ImA = A and AIn = A.
Since the dimension of A is 2 cross times 2 comma the identity matrix I subscript 2 equals open square brackets table row 1 0 row 0 1 end table close square brackets is used.

Then, you should get open square brackets table row 1 0 row 0 1 end table close square brackets open square brackets table row 2 cell short dash 1 end cell row 4 5 end table close square brackets equals open square brackets table row 2 cell short dash 1 end cell row 4 5 end table close square brackets and open square brackets table row 2 cell short dash 1 end cell row 4 5 end table close square brackets open square brackets table row 1 0 row 0 1 end table close square brackets equals open square brackets table row 2 cell short dash 1 end cell row 4 5 end table close square brackets.

term to know
Identity Matrix
A square matrix in which the entries on the main diagonal (top left to bottom right) are 1s and the rest of the entries are 0s.

summary
In this lesson, you learned that in order to perform operations on matrices, it is important to pay particular attention to the dimension of each matrix. For instance, when finding the sum and difference of two matrices, addition and subtraction can only be performed when the matrices have the same dimension. You can also find scalar multiples of matrices by multiplying all entries of a matrix by a scalar, a number that has no dimension and is simply used as a multiple. You also learned that when finding the product of two matrices, multiplication of matrices is defined only when the number of columns in the first matrix is equal to the number of rows in the second matrix. If this is confirmed, and matrix A has dimension m cross times n and matrix B has dimension n cross times p comma then the dimension of the matrix product (AB) is m cross times p. Keep in mind that when calculating matrix products, matrix multiplication is not commutative. Lastly, you learned about identity matrices with dimension n cross times n, represented by the notation I subscript n. Since matrices are also a way of organizing information, matrix operations can be used when data is broken into categories.

SOURCE: THIS TUTORIAL HAS BEEN ADAPTED FROM OPENSTAX "PRECALCULUS” BY JAY ABRAMSON. ACCESS FOR FREE AT OPENSTAX.ORG/DETAILS/BOOKS/PRECALCULUS-2E. LICENSE: CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL.

Terms to Know
Identity Matrix

A square matrix in which the entries on the main diagonal (top left to bottom right) are 1s and the rest of the entries are 0s.

Scalar

A number that has no dimension, simply used as a multiple.