Lab 09: Matrix Algebra

Objectives

  • Learn the basic operations of the matrix algebra.
  • Learn how to solve simultaneous equations by using MATLAB matrix operations.

Background

Questions

Dot Product

  1. Compute the dot product of the following pairs of vectors, and then show that $A \cdot B = B \cdot A$
    1. $A = \left[ {\begin{array}{*{20}{c}}1&3&5\end{array}} \right]$  $B = \left[ {\begin{array}{*{20}{c}}{ - 3}&{ - 2}&4\end{array}} \right]$
    2. $A = \left[ {\begin{array}{*{20}{c}}0&{ - 1}&{ - 4}&{ - 8}\end{array}} \right]$  $B = \left[ {\begin{array}{*{20}{c}}4&{ - 2}&{ - 3}&{24}\end{array}} \right]$
  2. Use a dot product and the shopping list in the following Table to determine your total bill at the grocery store.
    ItemNumber NeededCost
    Milk 2 gallons $\$ 3.50$ per gallon
    Eggs 1 dozen $\$ 1.25$ per dozen
    Cereal 2 boxes $\$ 4.25$ per box
    Soup 5 cans $\$ 1.55$ per can
    Cookies 1 package $\$ 3.15$ per package
  3. Bomb calorimeters are used to determine the energy released during chemical reactions. The total heat capacity of a bomb calorimeter is defined as the sum of the products of the mass of each component and the specific heat capacity of each component, or
    $$CP = \sum\limits_{i = 1}^n {{m_i}{C_i}} $$
    where
         ${{m_i}} = $mass of component i, g
         ${{C_i}} = $ heat capacity of component, i , J/(gK)
         $CP = $ total heat capacity, J/K
    Find the total heat capacity of a bomb calorimeter, using the thermal data in the following Table.
    ComponentMass, gHeat Capacity, J?(gK)
    Steel 250 0.45
    Water 100 4.2
    Aluminum 10 0.90

Matrix Multiplication

  1. Compute the matrix product $A*B$ of the following pairs of matrices:
    1. $A = \left[ {\begin{array}{*{20}{c}}{12}&4\\3&{ - 5}\end{array}} \right]$  $B = \left[ {\begin{array}{*{20}{c}}2&{12}\\0&0\end{array}} \right]$
    2. $A = \left[ {\begin{array}{*{20}{c}}1&3&5\\2&4&6\end{array}} \right]$  $B = \left[ {\begin{array}{*{20}{c}}{ - 2}&4\\3&8\\{12}&{ - 2}\end{array}} \right]$
    Show that $A*B$ is not the same as $B*A$.

Determinants and Inverses

  1. Recall that not all matrices have an inverse. A matrix is singular (i.e., it doesn't have an inverse) if its determinant equals 0 (i.e., $\left| A \right| = 0$). Use the determinant function to test whether each of the following matrices has an inverse:
    $A = \left[ {\begin{array}{*{20}{c}}2&{ - 1}\\2&5\end{array}} \right]$, $B = \left[ {\begin{array}{*{20}{c}}4&2\\2&1\end{array}} \right]$, $C = \left[ {\begin{array}{*{20}{c}}2&0&0\\1&2&2\\5&{ - 4}&0\end{array}} \right]$
    If an inverse exists, compute it.

Solving Linear Systems of Equations

  1. Solve the following system of equations, using both matrix left division and the inverse matrix method:
    1. $ - 2x + y = 3$
      $ x+y=10$
    2. $ 5x+3y-z=10$
      $ 3x+2y+z=4$
      $ 4x-y+3z=12$
    3. $ 3x+y+z+w=24$
      $ x-3y+7z+w=12$
      $ 2x+2y-3z+4w=17$
      $ x+y+z+w=0$