Skip to main content
\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)
Mathematics LibreTexts

11.6: Matrices and Matrix Operations

Skills to Develop

In this section, you will:
  • Find the sum and difference of two matrices.
  • Find scalar multiples of a matrix.
  • Find the product of two matrices.

Figure 11.6.1 (credit: “SD Dirk,” Flickr)

Two club soccer teams, the Wildcats and the Mud Cats, are hoping to obtain new equipment for an upcoming season. Table 11.6.1 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.

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 rowin 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.

\(A=\begin{bmatrix} 1&  2 \\ 3 &  4 \\ \end{bmatrix}\),  \(B=\begin{bmatrix} 1 & 2 & 7 \\ 0 & -5 & 6 \\ 7 & 8 & 2 \end{bmatrix}\),  \(C=\begin{bmatrix} -1 & 3 \\ 0 & 2 \\ 3 & 1 \end{bmatrix}\)

Describing Matrices

A matrix is often referred to by its size or dimensions:  \(m×n\) indicatingm m rows andn 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=\begin{bmatrix} a_{11} & a_{12} & a_{13} \\a_{21} & a_{22} & a_{23} \\a_{31} & a_{32} & a_{33} \end{bmatrix}\) 

square matrix is a matrix with dimensions n × n, 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.

row matrix is a matrix consisting of one row with dimensions \(1 × n\).

\(\begin{bmatrix} a_{11} & a_{12} & a_{13} \end{bmatrix}\)

column matrix is a matrix consisting of one column with dimensions \(m × 1\).

\(\begin{bmatrix} a_{11} \\ a_{21} \\a_{31} \end{bmatrix}\) 

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 General Note: MATRICES

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.


​​​​Finding the Dimensions of the Given Matrix and Locating Entries

Given matrix \(A\):

  1. What are the dimensions of matrix \(A\)?
  2. What are the entries at \(a_{31}\) and \(a_{22}\)?

\(A=\begin{bmatrix} 2 & 1 & 0\\2 & 4 & 7\\3 & 1 & −2 \end{bmatrix}\)


  1. The dimensions are \(3 × 3\) because there are three rows and three columns.
  2. 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.

\(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.


It is also associative.



Finding the Sum of Matrices

Find the sum of \(A\) and \(B\),given

\(A=\begin{bmatrix}a & b\\c & d \end{bmatrix}\) and \(B=\begin{bmatrix}e & f\\g & h\end{bmatrix}\)


Add corresponding entries.

\(A+B=\begin{bmatrix}a & b\\c & d\end{bmatrix}+\begin{bmatrix}e & f\\g & h\end{bmatrix}\)

\(=\begin{bmatrix}a+e & b+f\\c+g & d+h \end{bmatrix}\)


Adding Matrix \(A\) and Matrix \(B\)

Find the sum of \(A\) and \(B\).

\(A=\begin{bmatrix}4 &1\\3 & 2 \end{bmatrix}\) and \(B=\begin{bmatrix}5 & 9\\0 & 7\end{bmatrix}\)


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.

  \(A+B=\begin{bmatrix}4&1\\3 &2\end{bmatrix}+\begin{bmatrix}5&9\\0&7\end{bmatrix}\)         




Finding the Difference of Two Matrices

Find the difference of \(A\) and \(B\).

\(A=\begin{bmatrix}−2&3\\0&1\end{bmatrix}\) and \(B=\begin{bmatrix}8&1\\5&4\end{bmatrix}\)


We subtract the corresponding entries of each matrix.





Finding the Sum and Difference of Two 3 x 3 Matrices

Given \(A\) and \(B\):

  1. Find the sum.
  2. Find the difference.

\(A=\begin{bmatrix}2&−10&−2\\14&12&10\\4&−2&2\end{bmatrix}\) and \(B=\begin{bmatrix}6&10&−2\\0&−12&−4\\−5&2&−2\end{bmatrix}\)


1. Add the corresponding entries.

\(A+B=\begin{bmatrix} 2&  −10&  −2\\14 & 12 & 10\\4 & −2 & 2\end{bmatrix}+\begin{bmatrix}6 & 10 & −2\\0 & −12 & −4\\−5 & 2 & −2\end{bmatrix}\)               

\(=\begin{bmatrix}2+6 & −10+10 & −2−2\\14+0 & 12−12 & 10−4\\4−5 & −2+2 & 2−2\end{bmatrix}\)               

\(=\begin{bmatrix} 8 & 0 & −4\\14 & 0 & 6\\−1 & 0 & 0\end{bmatrix}\)

2. Subtract the corresponding entries.


\(=\begin{bmatrix}2−6 & −10−10 & −2+2\\14−0 & 12+12 & 10+4\\4+5 & −2−2 & 2+2\end{bmatrix}\)               

\(=\begin{bmatrix}−4 & −20 & 0\\14 & 24 & 14\\9 & −4 & 4\end{bmatrix}\)


Add matrix \(A\) and matrix \(B\).

\(A=\begin{bmatrix}2&6\\1&0\\1&−3\end{bmatrix}\) and \(B=\begin{bmatrix}3&−2\\1&5\\−4&3\end{bmatrix}\)


\(A+B=\begin{bmatrix}2&6\\​1​​&0\\1&−3\end{bmatrix}+\begin{bmatrix} 3&-2 \\1&5 \\-4&3\end{bmatrix}=\begin{bmatrix}2+3&6+(−2)\\1+1&0+5\\1+(-4)&−3+3\end{bmatrix}=\begin{bmatrix}5&4\\2&5\\-3&0\end{bmatrix}\)

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 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 Table 11.6.2.

  Lab A Lab B
Computers 15 27
Computer Tables 16 34
Chairs 16 34

Table 11.6.2

Converting the data to a matrix, we have

\(C_{2013}=\begin{bmatrix}15  & 27\\16&34\\16&34\end{bmatrix}\)

To calculate how much computer equipment will be needed, we multiply all entries in matrix \(C\) by 0.15.

\((0.15)C_{2013}=\begin{bmatrix}(0.15)15&(0.15)27\\(0.15)16&(0.15)34\\(0.15)16 &(0.15)34\end{bmatrix}=\begin{bmatrix}2.25 &4.05\\2.4&5.1\\2.4&5.1\end{bmatrix}\)

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\),




Multiplying the Matrix by a Scalar

Multiply matrix \(A\) by the scalar 3.



Multiply each entry in \(A\) by the scalar 3.





Given matrix \(B\),find \(−2B\) where





Finding the Sum of Scalar Multiples

Find the sum \(3A+2B\).

\(A=\begin{bmatrix}1&−2&0\\0&−1&2\\4&3&−6\end{bmatrix}\) and \(B=\begin{bmatrix}−1&2&1\\0&−3&2\\0&1&−4\end{bmatrix}\)


First, find \(3A\), then \(2B\). 





Now, add \(3A+2B\).



\(=\begin{bmatrix}1& −2&2\\0&−9&10\\12&11&−26\end{bmatrix}\)

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.

\(A=\begin{bmatrix}a_{11}&a_{12}&a_{13}\\a_{21}&a_{22}&a_{23}\end{bmatrix}\) and \(B=\begin{bmatrix}b_{11}&b_{12}&b_{13}\\b_{21}&b_{22}&b_{23}\\b_{31}&b_{32}&b_{33}\end{bmatrix}\)

Multiply and add as follows to obtain the first entry of the product matrix \(AB\).

  1. 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.

    \(\begin{bmatrix}a_{11}&a_{12}&a_{13}\end{bmatrix} ⋅\begin{bmatrix}b_{11}\\b_{21}\\b_{31}\end{bmatrix}=a_{11}⋅b_{11}+a_{12}⋅b_{21}+a_{13}⋅b_{31}\)

  2. 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.

    \(\begin{bmatrix}a_{11}&a_{12}&a_{13}\end{bmatrix} ⋅\begin{bmatrix}b_{12}\\b_{22}\\b_{32}\end{bmatrix}=a_{11}⋅b_{12}+a_{12}⋅b_{22}+a_{13}⋅b_{32}\)

  3. 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.

    \(\begin{bmatrix}a_{11}&a_{12}&a_{13}\end{bmatrix} ⋅\begin{bmatrix}b_{13}\\b_{23}\\b_{33}\end{bmatrix}=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

\(AB=\begin{bmatrix}a_{11}⋅b_{11}+a_{12}⋅b_{21}+a_{13}⋅b_{31} &a_{11}⋅b_{12}+a_{12}⋅b_{22}+a_{13}⋅b_{32}&a_{11}⋅b_{13}+a_{12}⋅b_{23}+a_{13}⋅b_{33} \\a_{21}⋅b_{11}+a_{22}⋅b_{21}+a_{23}⋅b_{31}&a_{21}⋅b_{12}+a_{22}⋅b_{22}+a_{23}⋅b_{32}&a_{21}⋅b_{13}+a_{22}⋅b_{23}+a_{23}⋅b_{33}\end{bmatrix}\)


For the matricesA,B, A,B,andC 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.


Multiplying Two Matrices

Multiply matrix \(A\) and matrix \(B\).

\(A=\begin{bmatrix}1&2\\3&4\end{bmatrix}\) and \(B=\begin{bmatrix}5&6\\7&8\end{bmatrix}\)


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.


Multiplying Two Matrices

Given \(A\) and \(B\):

  1. Find \(AB\).
  2. Find \(BA\).

\(A=\begin{bmatrix}−1&2&3\\ 4&0&5\end{bmatrix}\) and  \(B=\begin{bmatrix}5&−1\\-4&0\\2&3\end{bmatrix}\)


1. As the dimensions of \(A\) are \(2 × 3\) and the dimensions of \(B\) are \(3 × 2\),these matrices can be multiplied together because the number of columns in \(A\) matches the number of rows inB. B. The resulting product will be a \(2 × 2\) matrix, the number of rows in \(A\) by the number of columns in \(B\).

\(AB=\begin{bmatrix}−1&2&3\\4&0&5\end{bmatrix} \begin{bmatrix}5&−1\\−4&0\\2&3\end{bmatrix}\)     



2. 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=\begin{bmatrix}5&−1\\−4&0\\2&3\end{bmatrix} \begin{bmatrix} −1&2&3\\4&0&5\end{bmatrix}\)     

\(=\begin{bmatrix}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)\end{bmatrix}\)     



Notice that the products \(AB\) and \(BA\) are not equal.

\(AB=\begin{bmatrix}−7&10\\30&11\end{bmatrix}≠ \begin{bmatrix}−9&10&10\\4&−8&−12\\10&4&21\end{bmatrix}=BA\)

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.


Using Matrices in Real-World Problems

Let’s return to the problem presented at the opening of this section. We have Table 11.6.3, representing the equipment needs of two soccer teams.

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

Table 11.6.3

We are also given the prices of the equipment, as shown in Table 11.6.4.

Goal $300
Ball $10
Jersey $30

We will convert the data to matrices. Thus, the equipment need matrix is written as


The cost matrix is written as


We perform matrix multiplication to obtain costs for the equipment.




The total cost for equipment for the Wildcats is $2,520, and the total cost for equipment for the Mud Cats is $3,840.

How to: Given a matrix operation, evaluate using a calculator.

  1. Save each matrix as a matrix variable [A], [B], [C],... 
  2. Enter the operation into the calculator, calling up each matrix variable as needed.
  3. If the operation is defined, the calculator will present the solution matrix; if the operation is undefined, it will display an error message.


Using a Calculator to Perform Matrix Operations

Find \(AB−C\)  given

\(A=\begin{bmatrix}−15&25&32\\41&−7&−28\\10&34&−2\end{bmatrix}\), \(B=\begin{bmatrix}45&21&−37\\−24&52&19\\6&−48&−31\end{bmatrix}\),and \(C=\begin{bmatrix}−100&−89&−98\\25&−56&74\\−67&42&−75\end{bmatrix}\)


On the matrix page of the calculator, we enter matrix \(A\) 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.


The calculator gives us the following matrix.



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 \(3×2\) matrix has three rows and two columns. See Example.
  • We add and subtract matrices of equal dimensions by adding and subtracting corresponding entries of each matrix. See ExampleExampleExample, and Example.
  • Scalar multiplication involves multiplying each entry in a matrix by a constant. See Example.
  • Scalar multiplication is often required before addition or subtraction can occur. See Example.
  • 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\),and so on. See Example and Example.
  • Many real-world problems can often be solved using matrices. See Example.
  • We can use a calculator to perform matrix operations after saving each matrix as a matrix variable. See Example.