MDB3053 Chap9 LinearAlgebra Part 1 May16

Embed Size (px)

Citation preview

  • 7/26/2019 MDB3053 Chap9 LinearAlgebra Part 1 May16

    1/27

    RECAP ON CHAPTER 6

    1. Bracketing Method:

    Bisection Method

    False-Position Method

    2. Open Method:

    Fixed Point Iteration

    Newton-Raphson Method

    Secant Method

  • 7/26/2019 MDB3053 Chap9 LinearAlgebra Part 1 May16

    2/27

    2x

    1x

    How to solve a system of

    simultaneous algebraic

    equations using CM ?

    Cokes example

  • 7/26/2019 MDB3053 Chap9 LinearAlgebra Part 1 May16

    3/27

  • 7/26/2019 MDB3053 Chap9 LinearAlgebra Part 1 May16

    4/27

    LINEAR ALGEBRAIC EQUATIONS

    Example of a system of L.A.E

    Why coupled? Each equation has terms in common with the

    others, that is x1, x2 and x3.

    Why linear? It means the effects areproportionalto their cause.

    Each equation contains only first order terms of x1, x2 and x3. No

    terms like x12, or log(x3) or 1/x2x3.

    132

    132

    8253

    321

    321

    321

    xxx

    xxx

    xxx

    Three coupled,

    linear equations

    bxA

  • 7/26/2019 MDB3053 Chap9 LinearAlgebra Part 1 May16

    5/27

    GENERAL FORM OF L.A.E

    The general form of a system of L.A.E forn number ofequations

    nnnnnn

    nn

    nn

    bxaxaxa

    bxaxaxa

    bxaxaxa

    2211

    22222121

    11212111coefficients

    constants

    unknown

    variables

  • 7/26/2019 MDB3053 Chap9 LinearAlgebra Part 1 May16

    6/27

    MATRIX FORM OF L.A.E

    Linear Algebraic Equations in matrix form

    54

    132

    21

    21

    xx

    xx

    nnmnm

    n

    b

    b

    b

    x

    x

    x

    aa

    aa

    A

    11

    1

    111

    ,,

    bxA

    m x n

    coefficient

    matrix, A

    n x 1 column vector of

    unknowns

    n x 1 column vector

    of constants

    5

    1

    14

    32

    5

    1

    14

    32

    2

    1

    x

    x

    or

    Example: augmented formbxA

  • 7/26/2019 MDB3053 Chap9 LinearAlgebra Part 1 May16

    7/27

    TRY THIS

    Write the matrix representation for the L.A.Eshown below:

    132

    132

    8253

    321

    321

    321

    xxx

    xxx

    xxx

    1

    1

    8

    321

    132

    253

  • 7/26/2019 MDB3053 Chap9 LinearAlgebra Part 1 May16

    8/27

    SPECIAL TYPES OF MATRICES

    33

    2322

    131211

    00

    0

    a

    aa

    aaa

    333231

    2221

    11

    0

    00

    aaa

    aa

    a

    33

    22

    11

    00

    00

    00

    a

    a

    a

    100

    010

    001

    Diagonal matrix

    Identity matrix, I

    Lowertriangular matrix, L

    Uppertriangular matrix, U

  • 7/26/2019 MDB3053 Chap9 LinearAlgebra Part 1 May16

    9/27

    WAYS TO SOLVE L.A.E

    Graphical Methodby plottingCramers Ruleby determinant concept

    Direct Method Gaussian Elimination(Exact Sol) Gauss-Jordan

    LU Factorization

    Iterative Method Jacobis Method

    (Approx. Sol) Gauss-Seidel Method

  • 7/26/2019 MDB3053 Chap9 LinearAlgebra Part 1 May16

    10/27

    GRAPHICAL METHOD

    The SOLUTION isshown graphically

    They are in the forms of

    straight linebecause of

    linear equations

    22

    1823

    21

    21

    xx

    xx

    )2(..........1

    2

    )1.......(2

    39

    12

    12

    xx

    xx

  • 7/26/2019 MDB3053 Chap9 LinearAlgebra Part 1 May16

    11/27

    BASIC CONCEPTS OF SOLUTION

    Unique Solution (Nonhomogeneous equation)

    Without Solution

    2x

    1x

    63

    593

    21

    21

    xx

    xx

    1x

    2x

    parallel lines

    864

    432

    21

    21

    xx

    xxLinearly

    dependentequations

  • 7/26/2019 MDB3053 Chap9 LinearAlgebra Part 1 May16

    12/27

    Infinite # of Solutions (No unique solutions)

    ill-conditioned slopes are close to each

    other, very hard to determine the solution

    BASIC CONCEPTS OF SOLUTION (CONT)

    864

    432

    21

    21

    xx

    xx

    2x

    1x

    linearly

    dependant

    5.522

    7.52.22

    21

    21

    xx

    xx

    1x

    2x

    identical lines

  • 7/26/2019 MDB3053 Chap9 LinearAlgebra Part 1 May16

    13/27

    GAUSSIAN ELIMINATION

    Gaussian = Forward + Back

    Elimination Elimination Substitution

    To transform the original

    matrix, A into an upper, U

    triangular matrix

    Unknowns are solved

    through Back Substitution

    in the upper triangular

    matrix

    Most frequently used Direct Method

    Principle: to reduce coefficient matrix, A into

    equivalent upper triangular form

    Consists ofTWO stages:

  • 7/26/2019 MDB3053 Chap9 LinearAlgebra Part 1 May16

    14/27

    Fig. 9.3

    upper

    triangular

    matrix

    Augmented

    form

  • 7/26/2019 MDB3053 Chap9 LinearAlgebra Part 1 May16

    15/27

    FORWARD ELIMINATION

    Forward Elimination stage reduces the augmented

    matrix into an uppertriangular matrix.

    It requires Elementary Row Transformations

    (3 Basic approaches). You can:

    1. Interchange any two row in position

    2. Multiply (or divide) a row by a

    nonzero scalar , k=2 (eg. 2 R2)

    3. Multiply (or divide) a row by ascalar and adding it (or subtracting

    it from) another row (eg R1 + 2 R2)

    1

    5

    32

    14

    5

    1

    14

    32

    2

    5

    64

    14

    7

    5

    70

    14

  • 7/26/2019 MDB3053 Chap9 LinearAlgebra Part 1 May16

    16/27

    Example: Reducing matrix to upper matrix

    1 2 2 3

    Consider the matrix 4 4 2 6

    4 6 4 10

    Lets perform the transformation at second row R2:

    new R2

    It means To get the second row of the new matrix,

    multiply every element of the first row by 4 and subtract

    it from the element in the second row.

    12

    '

    2

    1

    4RRR

    R1

    R2

    R3

    1

    4 Elimination factor or

    multiplier

  • 7/26/2019 MDB3053 Chap9 LinearAlgebra Part 1 May16

    17/27

    Thus, the new 2nd row becomes :

    R2 = [4 4 2 | 6] 4 [1 2 2 | 3]

    = [0 4 6 |6]

    EXAMPLE (cont)

    1221

    4RRR

    133

    1

    4RRR

    You can perform one

    more transformation to

    obtain U matrix

    Original Matrix:

    1 2 2 3

    4 4 2 6

    4 6 4 10

    Transformation:

    1 2 2 3

    0 -4 -6 -6

    0 -2 -4 -2

    Next, transformation at 3rd row

    Thus, the new 3rd row becomes:

    R3 = [4 6 4 | 10] 4 [1 2 2 | 3]

    = [ 0 2 4 |2]R

    3

    '' = [0 -2 -4 | -2] 1/2 [0 -4 -6 | -6]

    = [ 0 0 1 | 1]

  • 7/26/2019 MDB3053 Chap9 LinearAlgebra Part 1 May16

    18/27

    BACK SUBSTITUTION

    Suppose that the next forward elimination step results in

    the following augmented matrix:

    1 2 2 3

    0 4 6 6

    0 0 1 1

    All the entries

    below the

    diagonal are

    ZEROS

    By using Back Substitution, SOLUTIONS are:

    R3: x3 = 1 x3 =1

    R2: 4x26x3 =6 x2 = 3

    R1 : x1 + 2x2 + 2x3 = 3 x1 =1

    Direct method

    yields exact sol

  • 7/26/2019 MDB3053 Chap9 LinearAlgebra Part 1 May16

    19/27

    CLASS ACTIVITY #1

    Use fraction number to reduce round-off errors.

    3232

    14

    232

    321

    321

    321

    xxx

    xxx

    xxx

    Try this in EXCEL: (p296)

    To inverse, highlight the

    range, enter minverse(..)

    and press Ctrl+Shift+Enter

    To multiply,enter mmult(..)

    Try this in MATLAB: (p298)

    >> A=[2 1 3;4 1 1;-2 3 2]

    >> b=[2 ; 1 ; 3 ]

    >> x = A\b

  • 7/26/2019 MDB3053 Chap9 LinearAlgebra Part 1 May16

    20/27

    CLASS ACTIVITY #1 (cont)

    Step 1: Augmented Matrix Form:

    3232

    14

    232

    321

    321

    321

    xxx

    xxx

    xxx

    3

    1

    2

    232

    114

    312

    462423

    5

    2

    232

    530

    312

    2 112

    RRR

    Step 2: Forward Elimination by performing

    elementary row transformation

  • 7/26/2019 MDB3053 Chap9 LinearAlgebra Part 1 May16

    21/27

    Pitfalls of Gaussian Elimination

    Division by zero. It is possible that during bothelimination and back-substitution phases a division by

    zero can occur. can be solved by (Partial) Pivoting

    Round-off errors. Because computer can only store afixed no. of digits to use more S.F. orfractions

    Ill-conditioned systems. Systems where small changes

    in coefficients result in large changes in the solution. Ithappens when two or more equations are nearly

    identical.

    1x

    2x

  • 7/26/2019 MDB3053 Chap9 LinearAlgebra Part 1 May16

    22/27

    GAUSS-JORDAN

    A variation of Gauss elimination but 50% more

    computational work than Gaussian Elimination

    Elimination step results in an identity matrix (not

    upper triangular matrix) due to normalization step

    No back substitution required

    3

    2

    1

    332331

    232221

    131211

    c

    c

    c

    aaa

    aaa

    aaa

    3

    2

    1

    100

    010

    001

    h

    h

    h

    Elimination +Normalization

    Identity

    matrix

  • 7/26/2019 MDB3053 Chap9 LinearAlgebra Part 1 May16

    23/27

    Fig 9.9

    IdentityMatrix

    No back

    substitution !

    Elimination +

    Normalization

  • 7/26/2019 MDB3053 Chap9 LinearAlgebra Part 1 May16

    24/27

    EXAMPLE

    Suppose that the forward elimination and normalizing

    steps result in the following augmented matrix:

    1 0 0 5

    0 1 0 3

    0 0 1 7

    The SOLUTION will be : x1 = 5 x2 = 3 and x3 = 7

    Hence there is no need for back substitution

  • 7/26/2019 MDB3053 Chap9 LinearAlgebra Part 1 May16

    25/27

    CLASS ACTIVITY #2

    Solve the system of equations below using

    Gauss-Jordan method

    123

    6252

    72

    321

    321

    321

    xxx

    xxx

    xxx

    Ans: x1 = 2 ; x2 = 8; x3 = 21

  • 7/26/2019 MDB3053 Chap9 LinearAlgebra Part 1 May16

    26/27

    MATRIX INVERSION

    Inverse Matrix A-1

    can be found through Gauss-Jordan Method

    STEP 1 : Form

    STEP 2 : Transform to using theElementary Row Transformations.

    STEP 3 : Finally, B = A -1, where B is the inversematrix

    IA

    IA BI

  • 7/26/2019 MDB3053 Chap9 LinearAlgebra Part 1 May16

    27/27

    CLASS ACTIVITY #3

    MATRIX INVERSION

    Find the inverse of the matrix below usingthe Gauss-Jordan Method

    612

    131

    221

    A

    135

    124

    410171

    A