Docsity

Cramer's Method for Solving Systems of Linear Equations, Slides of Computational Methods

Partial preview of the text

Download Cramer's Method for Solving Systems of Linear Equations and more Slides Computational Methods in PDF only on Docsity!

Chp8 Linear

Algebraic Eqns-

Learning Goals

  • Define Linear Algebraic Equations
  • Solve Systems of Linear Equation by Hand

using

  • Gaussian Elimination
  • Cramer’s Method
  • Distinguish between Equation System

Conditions: Exactly Determined,

Overdetermined, Underdetermined

  • Use MATLAB to Solve Systems of Eqns

Cramer’s Method – Illustrated-

  • Cramer’s Method can Solve “Square” Systems; - i.e., [No. Eqns] = [No. Unknowns]
  • Consider Sq Sys

8 4 22 50

3 6 2 3

21 9 12 33

− − + =

− + − =

− − = −

x y z

x y z

x y z

 Calc Cramer’s Determinant, Dc

  • Also Called the “Characteristic” or “Denominator” Determinant  Dc ≡ Determinant of the Coefficients

8 4 22

3 6 2

21 9 12

− −

− −

− − Dc =

Cramer’s Method – Illustrated-

  • Now, to Find The Individual Solns, Sub The Constraint Vector for the Variable Coefficients and Compute the Determinant for Each unknown, Dk
  • In this Example Find Dx , Dy, Dz as

50 4 22

3 6 2

33 9 12

−

−

− − − Dx =

8 4 22 50

3 6 2 3

21 9 12 33 − − + =

− + − =

− − = − x y z

x y z

x y z

8 50 22

3 3 2

21 33 12

−

− −

− − Dy =

8 4 50

3 6 3

21 9 33

− −

−

− Dz =

Cramer’s Method – Illustrated-

  • Since –^ However, We can ANTICIPATE Problems if |D (^) c | << than the SMALLEST Coefficient  Completing the Example

c

k D

D

k =

 Can ID “Condition” by Calculating Dc

  • SINGULAR Systems → Dc = 0
  • ILL-CONDITIONED Systems → Dc = “Small” - Small is technically relative to the D (^) k

8 4 22 50

3 6 2 3

21 9 12 33

− − + =

− + − =

− − = −

x y z

x y z

x y z

Cramer’s Method – Illustrated-

  • Calc the Determinants
  • First Recall The SIGN pattern for Determinants

Dc = 21 ( ) (^1) −^64 − 222 − 9 ( − 1 ) (^) −− 83 − 222 − 12 ( ) (^1) −− 83 −^64

 Find Dc

1146

2604 738 720

= − −

c

c D

D

[ ( ) (( ) ( ))] [( ) (( ) ( ))] 12 [( 3 ) ( 4 ) (( 8 ) 6 )]

9 3 * 22 8 * 2

21 6 * 22 2 * 4

= − − − − −

= + − − − −

Dc = − − −

 Dc is LARGE → WELL Conditioned System

Cramer’s Method – Illustrated-

  • Solve using MATLAB’s det Function >> Dz = det([EqnSys(:,1:2),EqnSys(:,4)]) Dz = 3438

>> x = Dx/Dc x = 1

>> y = Dy/Dc y = 2

>> z = Dz/Dc z = 3

All Row Elements of Cols 1-2, 4

Cramer vs Homogenous: Ax =^ b =^0

 In general, for a set of

HOMOGENEOUS linear algebraic

equations that contains the same

number of equations as unknowns

  • a nonzero solution exists only if the set is singular; that is, if Cramer’s determinant is zero
  • furthermore, the solution is not unique.
  • If Cramer’s determinant is not zero, the homogeneous set has a zero solution; that is, all the unknowns are zero

UnderDetermined Systems

  • An UNDERdetermined system does not

contain enough information to solve for ALL

of the unknown variables

  • Usually because it has fewer equations than unknowns.
  • In this case an INFINITE number of

solutions can exist, with one or more of the

unknowns dependent on the remaining

unknowns.

  • For such systems the Matrix-Inverse and Cramer’s methods will NOT work

UnderDetermined Example-

  • A simple UnderDetermined

system is the equation x +^3 y =^6

 All we can do is solve for one of the

unknowns in terms of the other; for

example, x = 6 – 3y OR y = −x/3 + 2

  • An INFINITE number of (x,y) solutions satisfy this equation

More UnderDetermined Systems

  • An infinite number of solutions might exist

EVEN when the number of equations EQUALS

the number of knowns

  • Predict by Cramer as: (^) det ( A ) = Dc = 0

 For such systems the Matrix Inverse

method and Cramer’s method will also

NOT work

  • MATLAB’s left-division method generates an error message warning us that the matrix A is singular

Minimum Norm Solution

  • When det( A ) = 0, We can use the

PSEUDOINVERSE method to find ONE

Solution, x , such that the Euclidean (or

Pythagorean) Length of x is MINIMIZED

  • In MATLAB:

( ) 2 2 3

2 2

2 x = min x 1 + x + x + xn

 MATLAB will return the MINIMUM

NORM SOLUTION →

x = pinv(A)*b

An INconsistent Example

  • Consider Ax = b (^)  Since The Ranks

are Unequal → this system of equations is NOT solvable  Graphically

 

  

  = 

  

  

  

 5

4 2 4

1 2 2

1 x

x

 ERO: Multiply the 1 st row by −2 and add to the 2 nd^ row

 

  

 0 0

1 2 Rank[ A ]=

^ Rank[ Ab ]= 

  

 − 3

4 0

2 0

1

Existence and Uniqueness

  • Recall Rank for m-Eqns & n-Unknwns

rank [ A ] = rank[ Ab ] ( ) 1

 Now Let r = rank[ A ]

  • If condition (1) is satisfied and if r = n , then the solution is unique
  • If condition (1) is satisfied but r < n , an infinite number of solutions exists and - r unknown variables can be expressed as linear combinations of the other n−r unknown variables, whose values are ARBITRARY