Reading: Matrices and Matrix Operations
Two club soccer teams, the Wildcats and the Mud Cats, are hoping to obtain new equipment for an upcoming season.
Table 1 shows the needs of both teams.
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.
Table 1  

Wildcats  Mud Cats  
Goals  6  10 
Balls  30  24 
Jerseys  14  20 
Finding the Sum and Difference of Two Matrices
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 and are shown below. [latexdisplay]A=\matrix{{1}&{2}\\{3}&{4}}[/latexdisplay] [latexdisplay]\displaystyle{B = \left[\matrix{{1}&{2}&{7}\\{0}&{5}&{6}\\{7}&{8}&{2}}\right][/latexdisplay] [latexdisplay]\displaystyle{C = \left[\matrix{{1}&{3}\\{0}&{2}\\{3} & {1}}\right][/latexdisplay]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 the matrix shown below, the entry in row 2, column 3 is a_{23 = }_{[latex]\displaystyle{A}={\left[\matrix{{a}_{{11}}&{a}_{{12}}&{a}_{{13}}\\{a}_{{21}}&{a}_{{22}}&{a}_{{23}}\\{a}_{{31}}&{a}_{{32}}&{a}_{{33}}}\right][/latex] } A square matrix is a matrix with dimensions meaning that it has the same number of rows as columns. The matrix above is an example of a square matrix. A row matrix is a matrix consisting of one row with dimensions 1 × n [latexdisplay]\displaystyle{\left[\matrix{{a}_{11}&{a}_{{21}}&{a}_{{31}}\dots&{a}_{{n1}}\right][/latexdisplay] A column matrix is a matrix consisting of one column with dimensions m × 1 [latexdisplay]\displaystyle{\left[\matrix{{a}_{11}\\{a}_{{21}}\\{a}_{{31}}\right][/latexdisplay] 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.Matrices
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 represents the row and represents the column. Matrices are often referred to by their dimensions: m × n indicating m rows and n columns.Example 1
Given matrix find the dimensions of the given matrix and locating entries: [latexdisplay]\displaystyle{A}={\left[\matrix{{2}&{1}&{0}\\{2}&{4}&{7}\\{3}&{1}&{2}}\right]}[/latexdisplay] What are the dimensions of matrix A
 What are the entries at and a_{31} and a_{22}
Solutions
 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_{2}_{2} 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.A General Note
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. A + B = C such that a_{ij} + b_{ij} = c_{ij} A − B = D such that a_{ij}− b_{ij}= d_{ij} Matrix addition is commutative. A + B = B + A It is also associative. (A + B) + C = A + (B + C)Example 2
 Find the sum of A and B given[latex]\displaystyle{A}={\left[\matrix{{a}&{b}\\{c}&{d}}\right]{\text{and}} {B}={\left[\matrix{{e}&{f}\\{g}&{h}}\right][/latex]
 Find the sum of A and B, given[latex]\displaystyle{A}={\left[\matrix{{4}&{1}\\{3}&{2}}\right] {\text{and}} {B}={\left[\matrix{{5}&{9}\\{0}&{7}}\right][/latex]
 Find the difference of A and B [latex]\displaystyle{A}={\left[\matrix{{2}&{3}\\{0}&{1}}\right]{\text{and}} {B}={\left[\matrix{{8}&{1}\\{5}&{4}}\right]}[/latex]
 Given A and B: [latex]\displaystyle{A}={\left[\matrix{{2}&{10}&{2}\\{14}&{12}&{10}\\{4}&{2}&{2}}\right]} {\text{and}} {B}={\left[\matrix{{6}&{10}&{2}\\{0}&{12}&{4}\\{5}&{2}&{2}}\right]}[/latex]
 Find the sum.
 Find the difference.
 Add matrix A and matrix B [latex]\displaystyle{A}={\left[\matrix{{2}&{6}\\{1}&{0}\\{1}&{3}}\right]}{\text{and}}{B}={\left[\matrix{{3}&{2}\\{1}&{5}\\{4}&{3}}\right]}[/latex]
Solutions
 [latex]\displaystyle{A}+{B}={\left[\matrix{{a}&{b}\\{c}&{d}}\right]}+{\left[\matrix{{e}&{f}\\{g}&{h}}\right]}={\left[\matrix{{a}+{e}&{b}+{f}\\{c}+{g}&{d}+{h}}\right]}[/latex]
 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. [latex]\displaystyle{A}+{B}={\left[\matrix{{4}&{1}\\{3}&{2}}\right]}+{\left[\matrix{{5}&{9}\\{0}&{7}}\right]}={\left[\matrix{{4}+{5}&{1}+{9}\\{3}+{0}&{2}+{7}}\right]}={\left[\matrix{{9}&{10}\\{3}&{9}}]\right}[/latex]
 We subtract the corresponding entries of each matrix. [latex]\displaystyle{A}{B}={\left[\matrix{{2}&{3}\\{0}&{1}}\right]}{\left[\matrix{{8}&{1}\\{5}&{4}}\right]}={\left[\matrix{{2}{8}&{3}{1}\\{0}{5}&{1}{4}}\right]}={\left[\matrix{{10}&{2}\\{5}&{3}}\right]}[/latex]

 Add the corresponding entries [latex]\displaystyle{A}+{B}={\left[\matrix{{2}&{10}&{2}\\{14}&{12}&{10}\\{4}&{2}&{2}}\right]}+{\left[\matrix{{6}&{10}&{2}\\{0}&{12}&{4}\\{5}&{2}&{2}}\right]}[/latex]
 Subtract the corresponding entries [latex]\displaystyle{A}{B}={\left[\matrix{{2}&{10}&{2}\\{14}&{12}&{10}\\{4}&{2}&{2}}\right]}{\left[\matrix{{6}&{10}&{2}\\{0}&{12}&{4}\\{5}&{2}&{2}}\right]}[/latex]
 [latex]\displaystyle{A}+{B}={\left[\matrix{{2}&{6}\\{1}&{0}\\{1}&{3}}\right]}+{\left[\matrix{{3}&{2}\\{1}&{5}\\{4}&{3}}\right]}={\left[\matrix{{2}+{3}&{6}+{({2})}\\{1}+{1}&{0}+{5}\\{1}+{({4})}&{3}+{3}}\right]}={\left[\matrix{{5}&{4}\\{2}&{5}\\{3}&{0}}\right]}[/latex]
Finding Scalar Multiples of a Matrix
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 realworld 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 Table 2.Table 2  

Lab A  Lab B  
Computers  15  27 
Computer Tables  16  34 
Chairs  16  34 
Scalar Multiplication
Scalar multiplication involves finding the product of a constant by each entry in the matrix. Given [latexdisplay]\displaystyle{A}={\left[\matrix{{a}_{{11}}&{a}_{{12}}\\{a}_{{21}}&{a}_{{22}}}\right]}[/latexdisplay] the scalar multiple cA is [latexdisplay]\displaystyle{c}{A}={c}{\left[\matrix{{a}_{{11}}&{a}_{{12}}\\{a}_{{21}}&{a}_{{22}}}\right]}={\left[\matrix{{c}{a}_{{11}}&{c}{a}_{{12}}\\{c}{a}_{{21}}&{c}{a}_{{22}}}\right]}[/latexdisplay] Scalar multiplication is distributive. For the matrices A, B, and C with scalars a and b [latexdisplay]\displaystyle{a}{({A}+{B})}={a}{A}+{a}{B}[/latexdisplay] [latexdisplay]\displaystyle{({a}+{b})}{A}={a}{A}+{b}{A}[/latexdisplay]Example 3
 Multiply matrix A by the scalar 3.
2. Given matrix B find –2B where
[latexdisplay]\displaystyle{B}={\left[\matrix{{4}&{1}\\{3}&{2}}\right]}[/latexdisplay]3. Find the sum 3A + 2B
[latexdisplay]\displaystyle{A}={\left[\matrix{{1}&{2}&{0}\\{0}&{1}&{2}\\{4}&{3}&{6}}\right]} {\text{and}}{B}={\left[\matrix{{1}&{2}&{1}\\{0}&{3}&{2}\\{0}&{1}&{4}}\right]}[/latexdisplay]Solutions
 [latex]\displaystyle{3}{A}={3}{\left[\matrix{{8}&{1}\\{5}&{4}}\right]}={\left[\matrix{{3}\cdot{8}&{3}\cdot{1}\\{3}\cdot{5}&{3}\cdot{4}}\\right]}={\left[\matrix{{24}&{3}\\{15}&{12}}\right]}[/latex]
 [latex]\displaystyle{2}{B}={\left[\matrix{{8}&{2}\\{6}&{4}}\right]}[/latex]
 First, find 3A then 2B [latex]\displaystyle{3}{A}={\left[\matrix{{3}\cdot{1}&{3}{({2})}&{3}\cdot{0}\\{3}\cdot{0}&{3}{({1})}&{3}\cdot{2}\\{3}\cdot{4}&{3}\cdot{3}&{3}{({6})}}\right]}={\left[\matrix{{3}&{6}&{0}\\{0}&{3}&{6}\\{12}&{9}&{18}}\right]}[/latex]. Now, add 3A + 2B.[latex]\displaystyle{3}{A}+{2}{B}={\left[\matrix{{3}&{6}&{0}\\{0}&{3}&{6}\\{12}&{9}&{18}}\right]}+{\left[\matrix{{2}&{4}&{2}\\{0}&{6}&{4}\\{0}&{2}&{8}}\right]}[/latex]
Finding the Product of Two Matrices
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. [latexdisplay]\displaystyle{A}={\left[\matrix{{a}_{{11}}&{a}_{{12}}&{a}_{{13}}\\{a}_{{21}}&{a}_{{22}}&{a}_{{23}}}\right]} {\text{and}} {B}={\left[\matrix{{b}_{{11}}&{b}_{{12}}&{b}_{{13}}\\{b}_{{21}}&{b}_{{22}}&{b}_{{23}}\\{b}_{{31}}&{b}_{{32}}&{b}_{{33}}}\right]}[/latexdisplay] 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 [latex]\displaystyle{[{a}_{{11}} {a}_{{12}} {a}_{{13}}]}\cdot{\left[\matrix{{b}_{{11}}\\{b}_{{21}}\\{b}_{{31}}}\right]={a}_{{11}}\cdot{b}_{{11}}+{a}_{{12}}\cdot{b}_{{21}}+{a}_{{13}}\cdot{b}_{{31}}[/latex]
 To obtain the entry in row 1, column 2 of AB, multiply the second row in A by the second column in B, and add [latex]\displaystyle{[{a}_{{11}} {a}_{{12}} {a}_{{13}}]}\cdot{\left[\matrix{{b}_{{12}}\\{b}_{{22}}\\{b}_{{32}}}\right]={a}_{{11}}\cdot{b}_{{12}}+{a}_{{12}}\cdot{b}_{{22}}+{a}_{{13}}\cdot{b}_{{32}}[/latex]
 To obtain the entry in row 1, column 3 of AB, multiply the third row in A by the third column in B, and add [latex]\displaystyle{[{a}_{{11}} {a}_{{12}} {a}_{{13}}]}\cdot{\left[\matrix{{b}_{{13}}\\{b}_{{23}}\\{b}_{{33}}}\right]={a}_{{11}}\cdot{b}_{{13}}+{a}_{{12}}\cdot{b}_{{23}}+{a}_{{13}}\cdot{b}_{{33}}[/latex]
Properties of Matrix Multiplication
For the matrices A, B, 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
Example 4
 Multiply matrix A and matrix B. [latex]\displaystyle{A}={\left[\matrix{{1}&{2}\\{3}&{4}}\right]}{\text{and}}{B}={\left[\matrix{{5}&{6}\\{7}&{8}}\right]}[/latex]
 Given
A and B:
[latexdisplay]\displaystyle{A}={\left[\matrix{{1}&{2}&{3}\\{4}&{0}&{5}}\right]}{\text{and}}{B}={\left[\matrix{{5}&{1}\\{4}&{0}\\{2}&{3}}\right]}[/latexdisplay]
 Find AB
 Find BA
Solutions
 First, we check the dimensions of the matrices. Matrix A has dimensions 2 × 2 and matrix B has dimensions 2 × 2. The inner dimensions are the same so we can perform the multiplication. The product will have the dimensions 2 × 2. We perform the operations outlined previously.[latex]\displaystyle{A}{B}={\left[\matrix{{1}&{2}\\{3}&{4}}\right]}\cdot{\left[\matrix{{5}&{6}\\{7}&{8}}\right]}={\left[\matrix{{1}{({5})}+{2}{({7})}&{1}{({6})}+{2}{({8})}\\{3}{({5})}+{4}{({7})}&{3}{({6})}+{4}{({8})}}\right]}={\left[\matrix{{19}&{22}\\{43}&{50}}\right]}[/latex]
 Notice that the products AB and BA are not equal.[latex]\displaystyle{A}{B}={\left[\matrix{{7}&{10}\\{30}&{11}}\right]}\neq{\left[\matrix{{9}&{10}&{10}\\{4}&{8}&{12}\\{10}&{4}&{21}}\right]}={B}{A}[/latex]This illustrates the fact that matrix multiplication is not commutative.
Q&A
Is it possible for AB to be defined but not BA? 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.Example 5
Using Matrices in RealWorld Problems Let's return to the problem presented at the opening of this section. We have Table 3, representing the equipment needs of two soccer teams.Table 3  

Wildcats  Mud Cats  
Goals  6  10 
Balls  30  24 
Jerseys  14  20 
Table 4  

Goal  $300 
Ball  $10 
Jersey  $30 
How To
Given a matrix operation, evaluate using a calculator. Save each matrix as a matrix variable
 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.
Example 6
Using a calculator to perform matrix operations, find AB – C given [latexdisplay]\displaystyle{A}={\left[\matrix{{15}&{25}&{32}\\{41}&{7}&{28}\\{10}&{34}&{2}}\right]},{B}={\left[\matrix{{45}&{21}&{37}\\{24}&{52}&{19}\\{6}&{48}&{31}}\right]},{\text{and}}{C}={\left[\matrix{{100}&{89}&{98}\\{25}&{56}&{74}\\{67}&{42}&{75}}\right]}[/latexdisplay]Solutions
On the matrix page of the calculator, we enter matrix above as the matrix variablematrix above as the matrix variableand matrix above as the matrix variable On the home screen of the calculator, we type in the problem and call up each matrix variable as needed. [ A] × [B] − [C] The calculator gives us the following matrix. [latexdisplay]\displaystyle{\left[\matrix{{983}&{462}&{136}\\{1820}&{1897}&{856}\\{311}&{2032}&{413}}\right]}[/latexdisplay]Media
Access these online resources for additional instruction and practice with matrices and matrix operations.Key Concepts
 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 matrix has three rows and two columns.
 We add and subtract matrices of equal dimensions by adding and subtracting corresponding entries of each matrix.
 Scalar multiplication involves multiplying each entry in a matrix by a constant.
 Scalar multiplication is often required before addition or subtraction can occur.
 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, and is obtained by multiplying each entry in row 1 of by each entry in column 1 of then multiply each entry of row 1 of by each entry in columns 2 of and so on.
 Many realworld problems can often be solved using matrices.
 We can use a calculator to perform matrix operations after saving each matrix as a matrix variable.
OpenStax, Precalculus, "Matrices and Matrix Operations," licensed under a CC BY 3.0 license. SD Dirk, "UCSD Trition Womens Soccer 005," licensed under a CCBY license. Mathispower4u, "Dimensions of a Matrix," licensed under a Standard YouTube license. Mathispower4u, "Ex: Matrix Addition and Subtraction," licensed under a Standard YouTube license. Mathispower4u, "Ex: Matrix Operations—Scalar Multiplication, Addition, and Subtraction," licensed under a Standard YouTube license. Mathispower4u, "Ex 1: Matrix Multiplication," licensed under a Standard YouTube license.