title | layout |
---|---|
Matrices and Matrix Operations |
page |
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 | {: #Table_09_05_01 summary=".."}
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{: data-type="term" .no-emphasis}, which is a rectangular array of numbers. A row{: data-type="term" .no-emphasis} in a matrix is a set of numbers that are aligned horizontally. A column{: data-type="term" .no-emphasis} in a matrix is a set of numbers that are aligned vertically. Each number is an entry{: data-type="term" .no-emphasis}, 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.
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{: data-type="term" .no-emphasis} 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{: data-type="term" .no-emphasis} is a matrix consisting of one row with dimensions 1 × n.
A column matrix{: data-type="term" .no-emphasis} 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{: data-type="term" .no-emphasis}.
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.
-
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 ]
{: type="a"}
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. {: type="a"}
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.
and B
of like dimensions, addition and subtraction of A
and B
will produce matrix C
or * * * {: data-type="newline"}
matrix D
of the same dimension.
and B,
given
and B.
of matrix A
to the entry in row 1, column 1, b 11 ,
of B.
Continue the pattern until all entries have been added.
and B.
and B:
- Find the sum.
- Find the difference. {: type="a"}
- 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 ]
{: type="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{: data-type="term" .no-emphasis} 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{: data-type="term" .no-emphasis} involves multiplying each entry in a matrix by a scalar. A scalar multiple{: data-type="term"} 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 | {: #Table_09_05_02 summary=".."}
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.
is
and C
with scalars a
and b,
by the scalar 3.
by the scalar 3.
find −2B
where
then 2B.
{: data-type="newline" data-count="1"}
In addition to multiplying a matrix by a scalar, we can multiply two matrices. Finding the product of two matrices{: data-type="term" .no-emphasis} 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.
with entries of B
according to a specific pattern as outlined below. The process of matrix multiplication{: data-type="term" .no-emphasis} 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
{: type="1"}
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
and C
the following properties hold.
-
Matrix multiplication is associative: ( AB )C=A( BC ).
-
Matrix multiplication is distributive: C(A+B)=CA+CB, (A+B)C=AC+BC.
Note that matrix multiplication is not commutative.
and matrix B.
and B:
-
Find AB.
-
Find BA. {: type="a"}
are
<math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> <mtext> </mtext><mn>2</mn><mtext> </mtext><mo>×</mo><mtext> </mtext><mn>3</mn><mtext> </mtext> </mrow> </math>
and the dimensions of
<math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> <mtext> </mtext><mi>B</mi><mtext> </mtext> </mrow> </math>
are
<math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> <mtext> </mtext><mn>3</mn><mtext> </mtext><mo>×</mo><mtext> </mtext><mn>2</mn><mo>,</mo><mtext> </mtext> </mrow> </math>
these matrices can be multiplied together because the number of columns in
<math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> <mtext> </mtext><mi>A</mi><mtext> </mtext> </mrow> </math>
matches the number of rows in
<math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> <mtext> </mtext><mi>B</mi><mo>.</mo><mtext> </mtext> </mrow> </math>
The resulting product will be a
<math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> <mtext> </mtext><mn>2</mn><mtext> </mtext><mo>×</mo><mtext> </mtext><mn>2</mn><mtext> </mtext> </mrow> </math>
matrix, the number of rows in
<math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> <mtext> </mtext><mi>A</mi><mtext> </mtext> </mrow> </math>
by the number of columns in
<math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> <mtext> </mtext><mi>B</mi><mo>.</mo> </mrow> </math>
<div data-type="equation" class="unnumbered" data-label="">
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block"> <mrow> <mtable columnalign="left"> <mtr columnalign="left"> <mtd columnalign="left"> <mrow /> </mtd> </mtr> <mtr columnalign="left"> <mtd columnalign="left"> <mrow> <mi>A</mi><mi>B</mi><mo>=</mo><mrow><mo>[</mo> <mrow> <mtable columnalign="right"> <mtr columnalign="right"> <mtd columnalign="right"> <mrow> <mn>−1</mn> </mrow> </mtd> <mtd columnalign="right"> <mn>2</mn> </mtd> <mtd columnalign="right"> <mn>3</mn> </mtd> </mtr> <mtr columnalign="right"> <mtd columnalign="right"> <mn>4</mn> </mtd> <mtd columnalign="right"> <mn>0</mn> </mtd> <mtd columnalign="right"> <mn>5</mn> </mtd> </mtr> </mtable> </mrow> <mo>]</mo></mrow><mtext> </mtext><mrow><mo>[</mo> <mrow> <mtable columnalign="right"> <mtr columnalign="right"> <mtd columnalign="right"> <mn>5</mn> </mtd> <mtd columnalign="right"> <mrow> <mn>−1</mn> </mrow> </mtd> </mtr> <mtr columnalign="right"> <mtd columnalign="right"> <mrow> <mo>−</mo><mn>4</mn> </mrow> </mtd> <mtd columnalign="right"> <mn>0</mn> </mtd> </mtr> <mtr columnalign="right"> <mtd columnalign="right"> <mn>2</mn> </mtd> <mtd columnalign="right"> <mn>3</mn> </mtd> </mtr> </mtable> </mrow> <mo>]</mo></mrow> </mrow> </mtd> </mtr> <mtr columnalign="left"> <mtd columnalign="left"> <mrow> <mtext> </mtext><mo>=</mo><mrow><mo>[</mo> <mrow> <mtable columnalign="right"> <mtr columnalign="right"> <mtd columnalign="right"> <mrow> <mn>−1</mn><mo stretchy="false">(</mo><mn>5</mn><mo stretchy="false">)</mo><mo>+</mo><mn>2</mn><mo stretchy="false">(</mo><mn>−4</mn><mo stretchy="false">)</mo><mo>+</mo><mn>3</mn><mo stretchy="false">(</mo><mn>2</mn><mo stretchy="false">)</mo> </mrow> </mtd> <mtd columnalign="right"> <mrow> <mtext> </mtext><mtext> </mtext><mn>−1</mn><mo stretchy="false">(</mo><mn>−1</mn><mo stretchy="false">)</mo><mo>+</mo><mn>2</mn><mo stretchy="false">(</mo><mn>0</mn><mo stretchy="false">)</mo><mo>+</mo><mn>3</mn><mo stretchy="false">(</mo><mn>3</mn><mo stretchy="false">)</mo> </mrow> </mtd> </mtr> <mtr columnalign="right"> <mtd columnalign="right"> <mrow> <mn>4</mn><mo stretchy="false">(</mo><mn>5</mn><mo stretchy="false">)</mo><mo>+</mo><mn>0</mn><mo stretchy="false">(</mo><mn>−4</mn><mo stretchy="false">)</mo><mo>+</mo><mn>5</mn><mo stretchy="false">(</mo><mn>2</mn><mo stretchy="false">)</mo> </mrow> </mtd> <mtd columnalign="right"> <mrow> <mtext> </mtext><mtext> </mtext><mn>4</mn><mo stretchy="false">(</mo><mn>−1</mn><mo stretchy="false">)</mo><mo>+</mo><mn>0</mn><mo stretchy="false">(</mo><mn>0</mn><mo stretchy="false">)</mo><mo>+</mo><mn>5</mn><mo stretchy="false">(</mo><mn>3</mn><mo stretchy="false">)</mo> </mrow> </mtd> </mtr> </mtable> </mrow> <mo>]</mo></mrow> </mrow> </mtd> </mtr> <mtr columnalign="left"> <mtd columnalign="left"> <mrow> <mtext> </mtext><mo>=</mo><mrow><mo>[</mo> <mrow> <mtable columnalign="right"> <mtr columnalign="right"> <mtd columnalign="right"> <mrow> <mn>−7</mn> </mrow> </mtd> <mtd columnalign="right"> <mrow> <mn>10</mn> </mrow> </mtd> </mtr> <mtr columnalign="right"> <mtd columnalign="right"> <mrow> <mn>30</mn> </mrow> </mtd> <mtd columnalign="right"> <mrow> <mn>11</mn> </mrow> </mtd> </mtr> </mtable> </mrow> <mo>]</mo></mrow> </mrow> </mtd> </mtr> </mtable> </mrow> </math>
</div>
-
The dimensions of B
are 3 × 2
and the dimensions of A
are 2 × 3.
The inner dimensions match so the product is defined and will be a 3 × 3
matrix.
BA=[ 5 −1 −4 0 2 3 ] [ −1 2 3 4 0 5 ] =[ 5(−1)+−1(4) 5(2)+−1(0) 5(3)+−1(5) −4(−1)+0(4) −4(2)+0(0) −4(3)+0(5) 2(−1)+3(4) 2(2)+3(0) 2(3)+3(5) ] =[ −9 10 10 4 −8 −12 10 4 21 ]
{: type="a"}
and BA
are not equal.
*Yes, consider a matrix A with dimension 3 × 4
and matrix B with dimension 4 × 2.
For the product AB the inner dimensions are 4 and the product is defined, but for the product BA the inner dimensions are 2 and 3 so the product is undefined.*
| | Wildcats | Mud Cats | |---------- | Goals | 6 | 10 | | Balls | 30 | 24 | | Jerseys | 14 | 20 | {: #Table_09_05_03 summary=".."}
We are also given the prices of the equipment, as shown in [link].
| Goal | $300 | | Ball | $10 | | Jersey | $30 | {: #Table_09_05_04 summary=".."}
We will convert the data to matrices. Thus, the equipment need matrix is written as
-
Save each matrix as a matrix variable [ A ],[ B ],[ C ],...
-
Enter the operation into the calculator, calling up each matrix variable as needed.
-
If the operation is defined, the calculator will present the solution matrix; if the operation is undefined, it will display an error message. {: type="1"}
given
above as the matrix variable [ A ],
matrix B
above as the matrix variable [ B ],
and matrix C
above as the matrix variable [ C ].
On the home screen of the calculator, we type in the problem and call up each matrix variable as needed.
-
A matrix is a rectangular array of numbers. Entries are arranged in rows and columns.
-
The dimensions of a matrix refer to the number of rows and the number of columns. A 3×2
matrix has three rows and two columns. See [link].
-
We add and subtract matrices of equal dimensions by adding and subtracting corresponding entries of each matrix. See [link], [link], [link], and [link].
-
Scalar multiplication involves multiplying each entry in a matrix by a constant. See [link].
-
Scalar multiplication is often required before addition or subtraction can occur. See [link].
-
Multiplying matrices is possible when inner dimensions are the same—the number of columns in the first matrix must match the number of rows in the second.
-
The product of two matrices, A
and B,
is obtained by multiplying each entry in row 1 of A
by each entry in column 1 of B;
then multiply each entry of row 1 of A
by each entry in columns 2 of B,
-
Many real-world problems can often be solved using matrices. See [link].
-
We can use a calculator to perform matrix operations after saving each matrix as a matrix variable. See [link].
matrix and the second is a 2×3
matrix. [ 1 2 3 4 ]+[ 6 5 4 3 2 1 ]
has no sum.
and BA
be defined? If so, explain how; if not, explain why.
are m×n
and the dimensions of B
are n×m,
both products will be defined.
If so, prove why it does. If not, explain why it does not.
we multiply the first row of A
by the first column of B
to get the first entry of AB.
To find BA,
we multiply the first row of B
by the first column of A
to get the first entry of BA.
Thus, if those are unequal, then the matrix multiplication does not commute.
For the following exercises, use the matrices below and perform the matrix addition or subtraction. Indicate if the operation is undefined.
For the following exercises, use the matrices below to perform scalar multiplication.
For the following exercises, use the matrices below to perform matrix multiplication.
For the following exercises, use the matrices below to perform the indicated operation if possible. If not possible, explain why the operation cannot be performed.
For the following exercises, use the matrices below to perform the indicated operation if possible. If not possible, explain why the operation cannot be performed. (Hint: A 2 =A⋅A
)
For the following exercises, use the matrices below to perform the indicated operation if possible. If not possible, explain why the operation cannot be performed. (Hint: A 2 =A⋅A
)
For the following exercises, use the matrices below to perform the indicated operation if possible. If not possible, explain why the operation cannot be performed. Use a calculator to verify your solution.
For the following exercises, use the matrix below to perform the indicated operation on the given matrix.
Test the formula for B 201
and B 202 ,
using a calculator.
column : a set of numbers aligned vertically in a matrix ^
entry : an element, coefficient, or constant in a matrix ^
matrix : a rectangular array of numbers ^
row : a set of numbers aligned horizontally in a matrix ^
scalar multiple : an entry of a matrix that has been multiplied by a scalar