Solving Simultaneous Equations (An introduction to Linear Algebra)

Document Sample
Solving Simultaneous Equations (An introduction to Linear Algebra) Powered By Docstoc
					  Solving Simultaneous Equations
(An introduction to Linear Algebra)
           Systems of Equations
• Many geoscience problems require using systems
  of equations.
• A common application for systems of equations
  involves estimating the fraction of several
  components in a mixture.
• Examples:
  – Estimating the mineralogical composition of a rock
    based on chemical analyses
  – Deriving source rocks contribution to glacial till based
    on the chemistry of various size fractions.
          Model Compositions
• A calculated source composition of till or the
  mineralogical composition of a rock based on
  its major oxide chemistry is a modeled
  composition.
              How does it work?
• Let’s assume that each element (or chemical
  species) exists in the same proportion in each
  component.
• The way each element is distributed can be
  expressed linearly:
                                 Where the coefficient a is the ij
a11x1+a12x2+…+a1mxm=b1           known content of element i in
                                 component j. b is the total
a21x1+a22x2+…+a2mxm=b2           content of element i in the
                                         mixture.
…
                                         For m unknown components,
an1x1+an2x2+…+anmxm=bn                   the proportions xj to be solved
                                         are the same for n elements.
         an1x1+an2x2+…+anmxm=bn

What we know:
a
b
All we need is xm

If m=n then we have the same number of
equations as we have of unknowns! This is a
simple system of linear equations.
             Example
(from Mäkinen and Gustavsson, 1998)

• A stone count near glacial till in Finland
  roughly contains 20% granitoids, 53%
  quartzite, and 20% amphibolite.
• This does not agree with the chemical
  composition of till corresponding to these 3
  rock types.
• A layer of gravel sand is found beneath the till.
  Based on appearance, it is thought that the
  gravel-sand layer is where the till originated.
             Setting up the model
• Include the following chemical species which exist in
  known amounts in each of the components:
• Al2O3, CaO, MgO, Cr, Ni, Pb, Rb, Sr, V, Y, Na2O, SiO2,
  TiO2, K2O
• Have bulk analysis of the 4 components: granitoids
  (A), quartzite(B), amphibolite(C), gravel sand(D).
• Have bulk analysis of the till (T).
Let’s take the example of Al2O3:
       AAl2O3xA + BAl2O3xB+ CAl2O3xC + DAl2O3xD = TAl2O3
           ACaOxA + BCaOxB+ CCaOxC + DCaOxD = TCaO
                              …
          AK2OxA + BK2OxB+ CK2OxC + DK2OxD = TK2O
  Solution
• Check to see that it
  adds up! xA = 0.26, xB =
  0.03, xC = 0.09, xD = 0.62
• Notice that the equations are linear, of the form Ax = B.
• Need to find an easy way to multiple equations
  simultaneously.
• We can represent the equations in the last example as
  coefficients and constants, omitting the variables.
AAl2O3+ BAl2O3+ CAl2O3 + DAl2O3 = TAl2O3   xA       TAl2O3
    ACaO + BCaO+ CCaO+ DCaO = TCaO         xB   =   TCaO
                  …                        xC       …
   AK2O + BK2O+ CK2O + DK2O = TK2O         xD       TK2O


              A                            x =      B
              Matrix Algebra
• Matrices provide a theoretical and practical
  way of solving problems.
• Excel is a natural medium by which to
  construct, analyze and solve matrices.
           What is a Matrix?

Monthly
Expenses
             Food   Utilities   Health
Family A     a      b           c
Family B     d      e           f
What is a Matrix?
                        Matrices
Size of a Matrix
• Defined by number of
   ROWS and number of
   COLUMNS.
• In this case, the matrix on
   the left has 2 rows and 3
   columns so it is a (2x3)
   matrix.
• More generally, it has m
   rows and n columns so we
   say it’s an (mxn) matrix.
                 Matrices
The elements of a matrix can be variables or
functions instead. It provides a grid
arrangement for data, much like the way Excel
manages data.

Matrices can be added, subtracted, multiplied
and, in general, manipulated to extract
information.
          Examples of matrices
• A matrix that has equal
  number of rows and
  columns, i.e., m=n is
  called a square matrix.
• A matrix with 4 rows
  and 2 columns is a 4x2
  matrix.
• How would you
  describe the matrix to
  the right in terms of
  mxn?
            Matrix Operations
• To add or subtract two
  matrices, simply add
  the elements together.
  Matrices must be the
  same size (i.e., same
  mxn)



• Or more generally:
           Matrix Operations
• As implied by the last example, you can apply
  an operation to an entire matrix. Adding a
  matrix to itself is the same as doubling a
  matrix. Therefore we can multiply a matrix by
  a constant.
           Matrix Operations
• What about multiplying two matrices?
• Can only be done if the number of rows in
  matrix A equals the number of columns in
  matrix B.
• For example:
    How to multiply matrices?


                       Or



In other words if matrix A is an mxn matrix and
matrix B is a kxl matrix, n must equal k in order to
 multiply them. The result will be an mxl matrix.
However AB ≠ BA!
           More Properties:
    Adding and Multiplying Matrices
• If A, B, and C are matrices and a and b are
  numbers,
                  (A+B)C = AC + BC
                 A(B+C) = AB + AC

               A(A+B) = aA + bB
               (a+b)A = aA + bA
Example
            The Identity Matrix
If we have the matrices



It’s easy to see that



And
            The Identity Matrix




We call these two forms linear combinations. From
 this we can see how a matrix can behave like the
 number 1 behaves in normal multiplication.
           The Identity Matrix
A matrix that behaves
like the number 1.




For any nxn matrix A,
AIn = InA = A
              Invertible Matrices
An nxn matrix A is invertible if AB = BA = In
Where In is the Identity Matrix. If this is the case, B is the
inverse of A. Check to see if this is true:




The notation for “inverse of matrix A” is A-1
For a matrix to be invertible, it must be square.
        Using Invertible Matrices
• How do we use them? Remember that we
  want to solve systems of equations of the
  form Ax = B
• Multiply each side by the inverse of A.
                 A-1(AX) = A-1(B)
• Regroup the factors
                  (A-1A)X = A-1B
• Regroup the factors, and we know that A-1A= I
                     X = A-1B
                      Example
 3x + 2y – 5z = 12
 x – 3y + 2z = -13
 5x – y + 4z = 10


Coefficients matrix Variables matrix   Constants matrix
      3 2 -5               x                  12
      1 -3 2               y                 -13
      5 -1 4                z                 10
                Excel Commands
You will need to know
   a)How to transpose matrix A. Use the =TRANSPOSE(A)
   a)how to multiply matrix A-1 by matrix B – use the
      =MMULT(range of cells from matrix A-1, range of cells for
      matrix B) function. Make sure your matrices are
      compatible for multiplication.
   b) how to invert a matrix A; use the function =MINVERSE(A)

As with any Excel formula, you may combine various operations
in one cell.
Because you are selecting multiple cells for input and output,
make sure you hold the CTRL-SHIFT keys when pressing ENTER.