Skip to main content
Mathematics LibreTexts

2.3: Matrix Operations

  • Page ID
    59065
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    \( \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}}\)

    \( \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}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    \( \newcommand{\vectorA}[1]{\vec{#1}}      % arrow\)

    \( \newcommand{\vectorAt}[1]{\vec{\text{#1}}}      % arrow\)

    \( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vectorC}[1]{\textbf{#1}} \)

    \( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)

    \( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)

    \( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)

    \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    \(\newcommand{\avec}{\mathbf a}\) \(\newcommand{\bvec}{\mathbf b}\) \(\newcommand{\cvec}{\mathbf c}\) \(\newcommand{\dvec}{\mathbf d}\) \(\newcommand{\dtil}{\widetilde{\mathbf d}}\) \(\newcommand{\evec}{\mathbf e}\) \(\newcommand{\fvec}{\mathbf f}\) \(\newcommand{\nvec}{\mathbf n}\) \(\newcommand{\pvec}{\mathbf p}\) \(\newcommand{\qvec}{\mathbf q}\) \(\newcommand{\svec}{\mathbf s}\) \(\newcommand{\tvec}{\mathbf t}\) \(\newcommand{\uvec}{\mathbf u}\) \(\newcommand{\vvec}{\mathbf v}\) \(\newcommand{\wvec}{\mathbf w}\) \(\newcommand{\xvec}{\mathbf x}\) \(\newcommand{\yvec}{\mathbf y}\) \(\newcommand{\zvec}{\mathbf z}\) \(\newcommand{\rvec}{\mathbf r}\) \(\newcommand{\mvec}{\mathbf m}\) \(\newcommand{\zerovec}{\mathbf 0}\) \(\newcommand{\onevec}{\mathbf 1}\) \(\newcommand{\real}{\mathbb R}\) \(\newcommand{\twovec}[2]{\left[\begin{array}{r}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\ctwovec}[2]{\left[\begin{array}{c}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\threevec}[3]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\cthreevec}[3]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\fourvec}[4]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\cfourvec}[4]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\fivevec}[5]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\cfivevec}[5]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\mattwo}[4]{\left[\begin{array}{rr}#1 \amp #2 \\ #3 \amp #4 \\ \end{array}\right]}\) \(\newcommand{\laspan}[1]{\text{Span}\{#1\}}\) \(\newcommand{\bcal}{\cal B}\) \(\newcommand{\ccal}{\cal C}\) \(\newcommand{\scal}{\cal S}\) \(\newcommand{\wcal}{\cal W}\) \(\newcommand{\ecal}{\cal E}\) \(\newcommand{\coords}[2]{\left\{#1\right\}_{#2}}\) \(\newcommand{\gray}[1]{\color{gray}{#1}}\) \(\newcommand{\lgray}[1]{\color{lightgray}{#1}}\) \(\newcommand{\rank}{\operatorname{rank}}\) \(\newcommand{\row}{\text{Row}}\) \(\newcommand{\col}{\text{Col}}\) \(\renewcommand{\row}{\text{Row}}\) \(\newcommand{\nul}{\text{Nul}}\) \(\newcommand{\var}{\text{Var}}\) \(\newcommand{\corr}{\text{corr}}\) \(\newcommand{\len}[1]{\left|#1\right|}\) \(\newcommand{\bbar}{\overline{\bvec}}\) \(\newcommand{\bhat}{\widehat{\bvec}}\) \(\newcommand{\bperp}{\bvec^\perp}\) \(\newcommand{\xhat}{\widehat{\xvec}}\) \(\newcommand{\vhat}{\widehat{\vvec}}\) \(\newcommand{\uhat}{\widehat{\uvec}}\) \(\newcommand{\what}{\widehat{\wvec}}\) \(\newcommand{\Sighat}{\widehat{\Sigma}}\) \(\newcommand{\lt}{<}\) \(\newcommand{\gt}{>}\) \(\newcommand{\amp}{&}\) \(\definecolor{fillinmathshade}{gray}{0.9}\)

    Two club soccer teams, the Wildcats and the Mud Cats, are hoping to obtain new equipment for an upcoming season. The table below 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 the last section we learned how matrices can be used to solve systems of linear equations.  In this section, we will explore other uses of matrices, and 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 in a way that can be easily translated to a computer or calculator.

    Finding the Sum and Difference of Two Matrices

    To solve a problem like the one in the section opener, 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.

    \[A = \left[ \begin{array}{*{20}{r}}   1&2 \\    3&4  \end{array} \right],\quad B = \left[ \begin{array}{*{20}{r}}   1&2&7 \\    0&{ - 5}&6 \\    7&8&2  \end{array} \right],\quad C = \left[ \begin{array}{*{20}{r}}   - 1&3 \\    0&2 \\  3&1  \end{array}  \right] \nonumber \]

    Describing Matrices

    A matrix is often referred to by its size or dimensions: \(m \times n\) indicating \(m \nonumber \) 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 = \left[ \begin{array}{*{20}{r}}  a_{11}&a_{12}&a_{13} \\  a_{21}&a_{22}&a_{23} \\  a_{31}&a_{32}&a_{33}  \end{array} \right] \nonumber \]

    A square matrix is a matrix with dimensions \(n \times n,\) meaning that it has the same number of rows as columns. The \(3 \times 3\) matrix above is an example of a square matrix.

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

    \[\left[ \begin{array}{*{20}{r}}   a_{11}&a_{12}&a_{13}  \end{array} \right] \nonumber \]

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

    \[\left[ \begin{array}{*{20}{r}}   a_{11} \\    a_{21} \\    a_{31}  \end{array} \right] \nonumber \]

    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.

    Definition: 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 \(i\) represents the row and \(j \nonumber \) represents the column. Matrices are often referred to by their dimensions: \(m \times n\) indicating \\(m \) rows and \(n \) columns.

    Example \(\PageIndex{1}\)

    Given matrix \[A = \left[ \begin{array}{*{20}{r}}   2&1 \\    2&4 \\    3&1  \end{array} \right] \nonumber \]

    a) What are the dimensions of matrix \(A?\) 

    b) What are the entries at \(a_{31}\) and \(a_{22}\)?

    Solution

    a) The dimensions are \(3 \times 2\) because there are three rows and two columns.

    b) 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 \times 3\) matrix and another \(3 \times 3\) matrix, but we cannot add or subtract a \(2 \times 3\) matrix and a \(3 \times 3\) matrix because some entries in one matrix will not have a corresponding entry in the other matrix.

    Definition: Adding and Subtracting Matrices

    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\; \text{ such that }\; a_{ij} + b_{ij} = c_{ij}\\ A - B = D\; \text{ 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 \(\PageIndex{2}\)

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

    \[A = \left[ \begin{array}{*{20}{r}}   2&{ - 10}&{ - 2} \\    {14}&{12}&{10} \\    4&{ - 2}&2  \end{array} \right]\quad {\text{and}}\quad B = \left[ \begin{array}{*{20}{r}}   6&{10}&{ - 2} \\    0&{ - 12}&{ - 4} \\    { - 5}&2&{ - 2}  \end{array} \right] \nonumber \]

    a) Find the sum.

    b) Find the difference.

    Solution

    a) Add the corresponding entries.

    \[\begin{align*}   A + B &= \left[ \begin{array}{*{20}{r}}   2&{ - 10}&{ - 2} \\    {14}&{12}&{10} \\    4&{ - 2}&2  \end{array} \right] + \left[ \begin{array}{*{20}{r}}   6&{10}&{ - 2} \\    0&{ - 12}&{ - 4} \\    { - 5}&2&{ - 2}  \end{array} \right] \\     &= \left[ \begin{array}{*{20}{r}}   {2 + 6}&{ - 10 + 10}&{ - 2 - 2} \\    {14 + 0}&{12 - 12}&{10 - 4} \\    {4 - 5}&{ - 2 + 2}&{2 - 2}  \end{array} \right] \\   &= \left[ \begin{array}{*{20}{r}}   8&0&{ - 4} \\    {14}&0&6 \\    { - 1}&0&0  \end{array} \right] \end{align*}  \nonumber \]

    b) Subtract the corresponding entries.

    \[\begin{align*}   A - B &= \left[ \begin{array}{*{20}{r}}   2&{ - 10}&{ - 2} \\    {14}&{12}&{10} \\    4&{ - 2}&2  \end{array} \right] - \left[\begin{array}{*{20}{r}}   6&{10}&{ - 2} \\    0&{ - 12}&{ - 4} \\    { - 5}&2&{ - 2}  \end{array} \right] \\     &= \left[ \begin{array}{*{20}{r}}   {2 - 6}&{ - 10 - 10}&{ - 2 + 2} \\    {14 - 0}&{12 + 12}&{10 + 4} \\    {4 + 5}&{ - 2 - 2}&{2 + 2}  \end{array} \right] \\     &= \left[ \begin{array}{*{20}{r}}   { - 4}&{ - 20}&0 \\    {14}&{24}&{14} \\    9&{ - 4}&4  \end{array} \right] \end{align*}  \nonumber \]

    Exercise \(\PageIndex{1}\)

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

    \[A = \left[\begin{array}{*{20}{r}}   2 \\    1 \\    1  \end{array}\begin{array}{*{20}{r}}  6 \\   0 \\  - 3  \end{array} \right]\quad {\text{and}}\quad B = \left[ \begin{array}{*{20}{r}} 3 \\   1 \\  -4  \end{array}\begin{array}{*{20}{r}}   -2 \\  5 \\   3  \end{array} \right] \nonumber \]

    Answer

    \[A + B = \left[\begin{array}{*{20}{r}} 2&6 \\  1&0 \\  1&-3  \end{array} \right] + \left[ \begin{array}{*{20}{r}} 3&-2 \\ 1&5 \\ -4&3  \end{array} \right] = \left[\begin{array}{*{20}{c}} 2 +3&6+(-2) \\ 1 + 1&0+5 \\ 1 + (-4)&-3+3 \end{array} \right] = \left[\begin{array}{*{20}{r}}  5&4 \\  2&5 \\ -3&0    \end{array} \right] \nonumber \]

    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.

    Definition: Scalar Multiplication

    Scalar multiplication involves finding the product of a constant by each entry in the matrix. Given

    \[A = \left[\begin{array}{*{20}{r}}   a_{11}&a_{12} \\    a_{21}&a_{22}  \end{array} \right] \nonumber \]

    the scalar multiple \(cA\) is

    \[\begin{align*}   cA &= c\left[\begin{array}{*{20}{r}}   a_{11}&a_{12} \\    a_{21}&a_{22}  \end{array} \right]    \\     &= \left[\begin{array}{*{20}{r}}   {c{a_{11}}}&{c{a_{12}}} \\    {c{a_{21}}}&{c{a_{22}}}  \end{array} \right]    \end{align*}\]

    Scalar multiplication is distributive. For the matrices \(A, B,\) and \(C\) with scalars \(a\) and \(b\),

    \[\begin{align*}   a\left( {A + B} \right) = aA + aB \\    (a + b)A = aA + bA \end{align*}  \nonumber \]

    Example \(\PageIndex{3}\)

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

    \[A = \left[\begin{array}{*{20}{r}}   8&1 \\    5&4  \end{array} \right] \nonumber \]

    Solution

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

    \[\begin{align*}   3A &= 3\left[\begin{array}{*{20}{r}}   8&1 \\    5&4  \end{array} \right] \\     &= \left[\begin{array}{*{20}{r}}   {3 \cdot 8}&{3 \cdot 1} \\    {3 \cdot 5}&{3 \cdot 4}  \end{array} \right] \\     &= \left[\begin{array}{*{20}{r}}   {24}&3 \\    {15}&{12}  \end{array} \right] \end{align*}  \nonumber \]

    Exercise \(\PageIndex{2}\)

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

    \[B = \left[\begin{array}{*{20}{r}}   4&1 \\    3&2  \end{array} \right] \nonumber \]

    Answer

    \[ - 2B = \left[\begin{array}{*{20}{r}}   - 8&- 2 \\  - 6&- 4  \end{array} \right] \nonumber \]

    Example \(\PageIndex{4}\)

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

    \[A = \left[\begin{array}{*{20}{r}}   1&{ - 2}&0 \\    0&{ - 1}&2 \\    4&3&{ - 6}  \end{array} \right]\quad {\text{and}}\quad B = \left[\begin{array}{*{20}{r}}   { - 1}&2&1 \\    0&{ - 3}&2 \\    0&1&{ - 4}  \end{array} \right] \nonumber \]

    Solution

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

    \[\begin{align*}   3A &= \left[\begin{array}{ccc}   {3 \cdot 1}&{3\left( { - 2} \right)}&{3 \cdot 0} \\    {3 \cdot 0}&{3\left( { - 1} \right)}&{3 \cdot 2} \\    {3 \cdot 4}&{3 \cdot 3}&{3\left( { - 6} \right)}  \end{array} \right] \\   &= \left[\begin{array}{ccc}   3&{ - 6}&0 \\    0&{ - 3}&6 \\    {12}&9&{ - 18}  \end{array} \right] \end{align*}  \nonumber \]

    \[\begin{align*}   2B &= \left[\begin{array}{ccc}   {2\left( { - 1} \right)}&{2 \cdot 2}&{2 \cdot 1} \\    {2 \cdot 0}&{2\left( { - 3} \right)}&{2 \cdot 2} \\    {2 \cdot 0}&{2 \cdot 1}&{2\left( { - 4} \right)}  \end{array} \right] \\     &= \left[\begin{array}{ccc}   { - 2}&4&2 \\    0&{ - 6}&4 \\    0&2&{ - 8}  \end{array} \right] \end{align*}  \nonumber \]

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

    \[\begin{align*}   3A + 2B &= \left[\begin{array}{*{20}{r}}   3&{ - 6}&0 \\    0&{ - 3}&6 \\    {12}&9&{ - 18}  \end{array} \right] + \left[\begin{array}{*{20}{r}}   { - 2}&4&2 \\    0&{ - 6}&4 \\    0&2&{ - 8}  \end{array} \right] \\     &= \left[\begin{array}{*{20}{r}}   {3 - 2}&{ - 6 + 4}&{0 + 2} \\    {0 + 0}&{ - 3 - 6}&{6 + 4} \\    {12 + 0}&{9 + 2}&{ - 18 - 8}  \end{array} \right] \\     &= \left[\begin{array}{*{20}{r}}   1&{ - 2}&2 \\    0&{ - 9}&{10} \\    {12}&{11}&{ - 26}  \end{array} \right] \end{align*}  \nonumber \]

    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 \times r\) matrix and \(B \) is an \(r \times n\) matrix, then the product matrix \(AB \) is an \(m \times 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.

    \[\begin{array}{rcl}
      A\quad  & \cdot &\quad  B  \\
      2\times 3 \  && \  3\times 3 \\
        \nwarrow \!\!\!\!&\text{same} &\!\!\!\! \nearrow 
    \end{array} \nonumber \]

    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 \times 3\) and the dimensions of \(B\) are \(3\times 3\) the product of \(AB\) will be a \(2 \times 3\) matrix.

    \[A = \left[\begin{array}{*{20}{r}} a_{11}&a_{12}&a_{13} \\ a_{21}&a_{22}&a_{23} \end{array} \right]\quad \text{and}\quad B = \left[\begin{array}{*{20}{r}}b_{11}&b_{12}& b_{13} \\b_{21}& b_{22}&b_{23} \\b_{31}& b_{32}& b_{33} \end{array}\right] \nonumber \]

    Definition:Multiplying Matrices

     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.

    \[\left[\begin{array}{ccc} a_{11}&a_{12}&a_{13}\end{array} \right] \cdot \left[\begin{array}{c} b_{11} \\ b_{21} \\ b_{31} \end{array} \right] = a_{11} \cdot b_{11} + a_{12} \cdot b_{21} + a_{13} \cdot b_{31} \nonumber \]
    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.

    \[\left[\begin{array}{ccc} a_{11}&a_{12}&a_{13} \end{array} \right] \cdot \left[\begin{array}{c} b_{12} \\b_{22} \\b_{32} \end{array} \right] = a_{11} \cdot b_{12} + a_{12} \cdot b_{22} + a_{13} \cdot b_{32} \nonumber \]
    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.

    \[\left[\begin{array}{ccc} a_{11}&a_{12}&a_{13} \end{array} \right] \cdot \left[\begin{array}{c} b_{13} \\    b_{23} \\    b_{33}  \end{array} \right] = a_{11} \cdot b_{13} + a_{12} \cdot b_{23} + a_{13} \cdot b_{33} \nonumber \]
    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 = \left[\begin{array}{ccc}   a_{11} \cdot b_{11} + a_{12} \cdot b_{21} + a_{13} \cdot b_{31}& a_{11} \cdot b_{12} + a_{12} \cdot b_{22} + a_{13} \cdot b_{32} &  a_{11} \cdot b_{13} + a_{12} \cdot b_{23} + a_{13} \cdot b_{33} \\ &&\\
    a_{21} \cdot b_{11} + a_{22} \cdot b_{21} + a_{23} \cdot b_{31} &     a_{21} \cdot b_{12} + a_{22} \cdot b_{22} + a_{23} \cdot b_{32}     &   a_{21} \cdot b_{13} + a_{22} \cdot b_{23} + a_{23} \cdot b_{33}  \end{array} \right] \nonumber \]

    Properties of Matrix  Multiplication

    For the matrices \(A, B,\) and \(C\) the following properties hold.

    • Matrix multiplication is associative: \(\left( AB \right)C = A\left( {BC} \right).\)
    • Matrix multiplication is distributive: \[\begin{align*}   C\left( {A + B} \right) &= CA + CB,    \\   (A + B)C &= AC + BC.    \end{align*}  \]

    Note that matrix multiplication is not commutative.

    Example \(\PageIndex{5}\)

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

    \[A = \left[\begin{array}{*{20}{r}}   1&2 \\    3&4  \end{array} \right]\quad {\text{and}}\quad B = \left[\begin{array}{*{20}{r}}   5&6 \\    7&8  \end{array} \right] \nonumber \]

    Solution

    First, we check the dimensions of the matrices. Matrix \(A\) has dimensions \(2 \times 2\) and matrix \(B \) has dimensions \(2 \times 2\). The inner dimensions are the same so we can perform the multiplication. The product will have the dimensions \(2 \times 2\).

    We perform the operations outlined previously.

    \[\begin{align*}   AB &= \left[\begin{array}{*{20}{r}}   1&2 \\    3&4  \end{array} \right] \cdot \left[\begin{array}{*{20}{r}}   5&6 \\    7&8  \end{array} \right] \\    & = \left[\begin{array}{*{20}{r}}   {1 \cdot 5 + 2 \cdot 7}&{1 \cdot 6 + 2 \cdot 8} \\    {3 \cdot 5 + 4 \cdot 7}&{3 \cdot 6 + 4 \cdot 8}  \end{array} \right] \\     &= \left[\begin{array}{*{20}{r}}   {19}&{22} \\    {43}&{50}  \end{array} \right] \end{align*}  \nonumber \]   

    Example \(\PageIndex{6}\)

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

    a) Find \(AB\).

    b) Find \(BA\).

    \[A = \left[ \begin{align*}   \begin{array}{*{20}{r}}   { - 1}&2&3  \end{array}    \\   \begin{array}{*{20}{r}}   {   4}&0&5  \end{array}    \end{align*}  \right]\quad {\text{and}}\quad B = \left[\begin{array}{*{20}{r}}   {  5} \\    { - 4} \\    {  2}  \end{array}   \begin{array}{*{20}{r}}   { - 1} \\    {  0} \\    {  3}  \end{array} \right] \nonumber \]

    Solution

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


    \[\begin{align*}  AB &= \left[ \begin{array}{rrr}   -1&2&3 \\  4&0&5  \end{array} \right]\left[\begin{array}{rr}   5&-1 \\-4&0 \\ 2&3 \end{array} \right] \\  &= \left[\begin{array}{rr}  -1(5) + 2(-4) + 3(2)& - 1( - 1) + 2(0) + 3(3) \\ 4(5) + 0(-4) + 5(2)&4(-1) + 0(0) + 5(3)  \end{array} \right] \\     &= \left[\begin{array}{rr} -7&10 \\ 30&11  \end{array} \right] \end{align*} \]
    b) The dimensions of  \(B\) are \(3 \times 2\) and the dimensions of \(A\) are \(2 \times 3\). The inner dimensions match so the product is defined and will be a \(3 \times 3\) matrix.

    \[\begin{align*}   BA &= \left[\begin{array}{rr}   5&-1 \\ -4 & 0 \\ 2 & 3 \end{array}\right] \left[ \begin{array}{rrr}   -1&2&3 \\  4&0&5  \end{array} \right] \\     &= \left[\begin{array}{ccc}   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{array} \right] \\     &= \left[\begin{array}{rrr} - 9&10&10 \\  4&- 8&- 12 \\ 10 & 4 &21  \end{array} \right] \end{align*} \]

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

    \[AB = \left[\begin{array}{*{20}{r}}   { - 7}&{10} \\    {30}&{11}  \end{array} \right] \ne \left[\begin{array}{*{20}{r}}   { - 9}&{10}&{10} \\    4&{ - 8}&{ - 12} \\    {10}&4&{21}  \end{array} \right] = BA \nonumber \]

    This illustrates the fact that matrix multiplication is not commutative.

    Also, this means that it is possible for AB to be defined but not BA.  Consider a matrix A with dimension \(3 \times 4\) and matrix B with dimension \(4 \times 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.

    Exercise \(\PageIndex{3}\)

    Multiply:  \[\left[\begin{array}{*{20}{r}}   1&{ - 2} \\    4&0 \\    { - 1}&3  \end{array} \right] \cdot \left[\begin{array}{*{20}{r}}   2&3 \\    1&{ - 1}  \end{array} \right] \nonumber \]

    Answer

    \[\left[\begin{array}{r}   1&{ - 2} \\    4&0 \\    { - 1}&3  \end{array} \right] \cdot \left[\begin{array}{r}   2&3 \\    1&{ - 1}  \end{array} \right] = \left[\begin{array}{*{20}{c}}   {1(2) + ( - 2)(1)}&{1(3) + ( - 2)( - 1)} \\    {4(2) + 0(1)}&{4(3) + 0( - 1)} \\    {( - 1)(2) + (3)(1)}&{( - 1)(3) + (3)( - 1)}  \end{array} \right] = \left[\begin{array}{c}   0&5 \\    8&{12} \\    1&{ - 6}  \end{array} \right] \nonumber \]

    Example \(\PageIndex{7}\)

    Let us return to the problem presented at the opening of this section. We have the table below representing the equipment needs of two soccer teams.

     

    Wildcats

    Mud Cats

    Goals

    6

    10

    Balls

    30

    24

    Jerseys

    14

    20

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

    Goal

    $300

    Ball

    $10

    Jersey

    $30

    Solution

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

    \[E = \left[\begin{array}{r}   6&10 \\    30&24 \\   14&20  \end{array} \right] \nonumber \]

    The cost matrix is written as

    \[C = \left[\begin{array}{r}   300&10&30  \end{array} \right] \nonumber \]

    We perform matrix multiplication to obtain costs for the equipment.

    \[\begin{align*}   CE &= \left[\begin{array}{c}   300&10&30  \end{array} \right] \cdot \left[\begin{array}{r}   6&10 \\   30&24 \\   14&20  \end{array} \right] \\     &= \left[\begin{array}{c}   {300(6) + 10(30) + 30(14)}&{300(10) + 10(24) + 30(20)}  \end{array} \right] \\     &= \left[\begin{array}{c}   {2,520}&{3,840}  \end{array} \right] \end{align*}  \nonumber \]

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

    The calculation in the last example could easily be calculated using a calculator and computer, which would also easily handle a version of the problem with dozens of teams and hundreds of expenses.  Representing the problem as matrix operations allows us to utilize technology to help solve this type of problem.

    Important Topics of this Section

    Size of a matrix

    Sum and difference of matrices

    Scalar multiple of a matrix

    Product of matrices


    2.3: Matrix Operations is shared under a not declared license and was authored, remixed, and/or curated by LibreTexts.

    • Was this article helpful?