Matrices and Matrix Operations
(credit: “SD Dirk,” Flickr) Two club soccer teams, the Wildcats and the Mud Cats, are hoping to obtain new equipment for an upcoming season. [link] shows the needs of both teams. Wildcats Mud Cats Goals 6 10 ...
Two club soccer teams, the Wildcats and the Mud Cats, are hoping to obtain new equipment for an upcoming season. [link] shows the needs of both teams.
Wildcats | Mud Cats | |
Goals | 6 | 10 |
Balls | 30 | 24 |
Jerseys | 14 | 20 |
A goal costs $300; a ball costs $10; and a jersey costs $30. How can we find the total cost for the equipment needed for each team? In this section, we discover a method in which the data in the soccer equipment table can be displayed and used for calculating other information. Then, we will be able to calculate the cost of the equipment.
To solve a problem like the one described for the soccer teams, we can use a matrix, which is a rectangular array of numbers. A row in a matrix is a set of numbers that are aligned horizontally. A column in a matrix is a set of numbers that are aligned vertically. Each number is an entry, sometimes called an element, of the matrix. Matrices (plural) are enclosed in [ ] or ( ), and are usually named with capital letters. For example, three matrices named A,B, and C are shown below.
Describing Matrices
A matrix is often referred to by its size or dimensions: m × n indicating m rows and n columns. Matrix entries are defined first by row and then by column. For example, to locate the entry in matrix A identified as a ij , we look for the entry in row i, column j. In matrix A, shown below, the entry in row 2, column 3 is a 23 .
A square matrix is a matrix with dimensions n × n, meaning that it has the same number of rows as columns. The 3×3 matrix above is an example of a square matrix.
A row matrix is a matrix consisting of one row with dimensions 1 × n.
A column matrix is a matrix consisting of one column with dimensions m × 1.
A matrix may be used to represent a system of equations. In these cases, the numbers represent the coefficients of the variables in the system. Matrices often make solving systems of equations easier because they are not encumbered with variables. We will investigate this idea further in the next section, but first we will look at basic matrix operations.
A matrix is a rectangular array of numbers that is usually named by a capital letter: A,B,C, and so on. Each entry in a matrix is referred to as a ij , such that i represents the row and j represents the column. Matrices are often referred to by their dimensions: m × n indicating m rows and n columns.
Given matrix A:
- What are the dimensions of matrix A?
- What are the entries at
a
31
and
a
22
?
A=[ 2 1 0 2 4 7 3 1 −2 ]
- The dimensions are 3 × 3 because there are three rows and three columns.
- Entry a 31 is the number at row 3, column 1, which is 3. The entry a 22 is the number at row 2, column 2, which is 4. Remember, the row comes first, then the column.
Adding and Subtracting Matrices
We use matrices to list data or to represent systems. Because the entries are numbers, we can perform operations on matrices. We add or subtract matrices by adding or subtracting corresponding entries.
In order to do this, the entries must correspond. Therefore, addition and subtraction of matrices is only possible when the matrices have the same dimensions. We can add or subtract a 3 × 3 matrix and another 3 × 3 matrix, but we cannot add or subtract a 2 × 3 matrix and a 3 × 3 matrix because some entries in one matrix will not have a corresponding entry in the other matrix.
Given matrices
A
and
B
of like dimensions, addition and subtraction of
A
and
B
will produce matrix
C
or
matrix
D
of the same dimension.
Matrix addition is commutative.
It is also associative.
Find the sum of A and B, given
Add corresponding entries.
Find the sum of A and B.
Add corresponding entries. Add the entry in row 1, column 1, a 11 , of matrix A to the entry in row 1, column 1, b 11 , of B. Continue the pattern until all entries have been added.
Find the difference of A and B.
We subtract the corresponding entries of each matrix.
Given A and B:
- Find the sum.
- Find the difference.
- Add the corresponding entries.
A+B=[ 2 −10 −2 14 12 10 4 −2 2 ]+[ 6 10 −2 0 −12 −4 −5 2 −2 ] =[ 2+6 −10+10 −2−2 14+0 12−12 10−4 4−5 −2+2 2−2 ] =[ 8 0 −4 14 0 6 −1 0 0 ]
- Subtract the corresponding entries.
A−B=[ 2 −10 −2 14 12 10 4 −2 2 ]−[ 6 10 −2 0 −12 −4 −5 2 −2 ] =[ 2−6 −10−10 −2+2 14−0 12+12 10+4 4+5 −2−2 2+2 ] =[ −4 −20 0 14 24 14 9 −4 4 ]
Add matrix A and matrix B.
Besides adding and subtracting whole matrices, there are many situations in which we need to multiply a matrix by a constant called a scalar. Recall that a scalar is a real number quantity that has magnitude, but not direction. For example, time, temperature, and distance are scalar quantities. The process of scalar multiplication involves multiplying each entry in a matrix by a scalar. A scalar multiple is any entry of a matrix that results from scalar multiplication.
Consider a real-world scenario in which a university needs to add to its inventory of computers, computer tables, and chairs in two of the campus labs due to increased enrollment. They estimate that 15% more equipment is needed in both labs. The school’s current inventory is displayed in [link].
Lab A | Lab B | |
Computers | 15 | 27 |
Computer Tables | 16 | 34 |
Chairs | 16 | 34 |
Converting the data to a matrix, we have
To calculate how much computer equipment will be needed, we multiply all entries in matrix C by 0.15.
We must round up to the next integer, so the amount of new equipment needed is
Adding the two matrices as shown below, we see the new inventory amounts.
This means
Thus, Lab A will have 18 computers, 19 computer tables, and 19 chairs; Lab B will have 32 computers, 40 computer tables, and 40 chairs.
Scalar multiplication involves finding the product of a constant by each entry in the matrix. Given
the scalar multiple cA is
Scalar multiplication is distributive. For the matrices A,B, and C with scalars a and b,
Multiply matrix A by the scalar 3.
Multiply each entry in A by the scalar 3.
Given matrix B, find −2B where
−2B=[ −8 −2 −6 −4 ]
Find the sum 3A+2B.
First, find
3A,
then
2B.
Now, add 3A+2B.
In addition to multiplying a matrix by a scalar, we can multiply two matrices. Finding the product of two matrices is only possible when the inner dimensions are the same, meaning that the number of columns of the first matrix is equal to the number of rows of the second matrix. If A is an m × r matrix and B is an r × n matrix, then the product matrix AB is an m × n matrix. For example, the product AB is possible because the number of columns in A is the same as the number of rows in B. If the inner dimensions do not match, the product is not defined.
We multiply entries of A with entries of B according to a specific pattern as outlined below. The process of matrix multiplication becomes clearer when working a problem with real numbers.
To obtain the entries in row i of AB, we multiply the entries in row i of A by column j in B and add. For example, given matrices A and B, where the dimensions of A are 2 × 3 and the dimensions of B are 3 × 3, the product of AB will be a 2 × 3 matrix.
Multiply and add as follows to obtain the first entry of the product matrix AB.
- To obtain the entry in row 1, column 1 of
AB,
multiply the first row in
A
by the first column in
B,
and add.
[ a 11 a 12 a 13 ]⋅[ b 11 b 21 b 31 ]= a 11 ⋅ b 11 + a 12 ⋅ b 21 + a 13 ⋅ b 31
- To obtain the entry in row 1, column 2 of
AB,
multiply the first row of
A
by the second column in
B,
and add.
[ a 11 a 12 a 13 ]⋅[ b 12 b 22 b 32 ]= a 11 ⋅ b 12 + a 12 ⋅ b 22 + a 13 ⋅ b 32
- To obtain the entry in row 1, column 3 of
AB,
multiply the first row of
A
by the third column in
B,
and add.
[ a 11 a 12 a 13 ]⋅[ b 13 b 23 b 33 ]= a 11 ⋅ b 13 + a 12 ⋅ b 23 + a 13 ⋅ b 33
We proceed the same way to obtain the second row of AB. In other words, row 2 of A times column 1 of B; row 2 of A times column 2 of B; row 2 of A times column 3 of B. When complete, the product matrix will be
- 1 Introduction to Exchange Rates and International Capital Flows
- 2 Geometric Distribution
- 3 Federal Deficits and the National Debt
- 4 The Standard Normal Distribution
- 5 Regulating Natural Monopolies
- 6 Composition of Functions
- 7 Market-Oriented Environmental Tools
- 8 Fitting Linear Models to Data
- 9 Components of Economic Growth
- 10 Contingency Tables