ChE Lecture Notes, Dept. of Chemicl Engineering, Univ. of TN, Knoville - D. Keffer, 5/9/98 (updted /) Lecture 8- - Solution of System of Liner Eqution 8. Why is it importnt to e le to solve system of liner equtions? Mny of the phenomen oserved in science nd engineering cn e descried y liner equtions. The virtionl modes of crystlline mteril, nd the equilirium of multicomponent-multi-rection vessel re just two emples of prolems tht give rise to systems of liner, lgeric equtions. Of course, there re mny systems tht re intrinsiclly nonliner. For emple, mteril nd energy lnces re oth nonliner equtions. However, we egin study of the solution of equtions y focussing on liner equtions for severl resons liner equtions re esier to solve thn nonliner equtions more cn e known out the eistence nd uniqueness of solutions for liner equtions thn cn e known for nonliner equtions y oserving the ehvior of solution techniques for liner equtions, we my get n ide out how solution methods my work or fil for nonliner equtions there is tremendous mount of theory of liner lger, which provides insight into the solution of specil systems: symmetric mtrices, sprse mtrices, nded mtrices, repeted solutions, etc. 8. Liner Algeric Equtions An eqution is liner if the unknowns in the eqution ppers s sums or differences. If their is multipliction, division, or ny trnscendentl function of the unknown, then the eqution is nonliner. emple of liner eqution: + 5 emple of nonliner equtions: + 5 log() + 5 A system of equtions is liner if ll the unknowns pper only s sums or differences. emple of system of liner equtions: + 5 + 5 emple of system of nonliner equtions: sin( ) + 5 + 5 If ny one eqution in the system is nonliner, then the system is considered nonliner. 8. Converting systems of liner equtions into mtri nottion We will find tht it conserves spce to write systems of equtions in mtri nottion. For the generl system of n liner equtions with n unknowns,,,... n, we cn write:
ChE Lecture Notes, Dept. of Chemicl Engineering, Univ. of TN, Knoville - D. Keffer, 5/9/98 (updted /), +, +, +... +,n n +,n n, +, +, +... +,n n +,n n n, + n, + n, +... + n,n n + n,n n n The s nd s re constnts. Ech hs two suscripts. The first suscript on indictes the eqution it ppers in. The second suscript on indictes the vrile it ppers in front of. Ech hs one suscript, indicting which eqution it ppers in. This system of liner lgeric equtions cn e written in mtri nottion s: A where A is mtri of size nn, is vector of size n nd is vector of size n. Specificlly,,, A M n,,, M n, K K O K,n,n M n,n,, M n M n An emple. The system of equtions nd unknowns, cn e written s: + 4 + 9 8 4 9 8 Any system of liner lgeric equtions cn e converted to mtri form. 8.4 Etending ordinry lger to liner lger Sy we hve the system of liner equtions:, +,, +, If we wnt to solve these equtions using trditionl lgeric techniques. We isolte in eqution, nd sustitute it into eqution. Then solve for in eqution.
ChE Lecture Notes, Dept. of Chemicl Engineering, Univ. of TN, Knoville - D. Keffer, 5/9/98 (updted /), () (solve eqution for ),,, +,,,, +,, () (sustitute into eqution ) () (solve for ),,,, (4) (solve for ),, (,,,, ),,,,, (5) (solve () for ),, (,,,, ) The prolem with this technique of sustitution is tht it tkes long time s the numer of equtions increse. We need quicker, more methodicl pproch to solving systems of liner lgeric equtions. We cn write our originl equtions in mtri nottion s: A We define n inverse mtri, the property: A A AA I A, which is the sme size s the mtri A, nmely in this cse, which hs where I is clled the identity mtri nd is defined s: I O
ChE Lecture Notes, Dept. of Chemicl Engineering, Univ. of TN, Knoville - D. Keffer, 5/9/98 (updted /) The size of I is the sme s the size of A. The most importnt property of the identity mtri is tht multiplying mtri or vector y I yields the originl mtri or vector: I A AI A I If we hd this mgicl creture clled n inverse then we could solve the system of equtions esily: A A A A I A A Thus we would hve the vector of solutions,. So we need to know how nd when we cn compute inverses. 8.5 Determinnts nd inverses The inverse only eists for squre mtrices. (Tht is the dimensions of the mtri re n y n.) The first time we clculte n inverse, we will use wht is clled Nïve Guss Elimintion (NGE). In NGE, we use three elementry row opertions. These elementry row opertions re row c row (multipliction of row y constnt) row row + row (replcement of row with liner comintion of tht row nd nother row) row row (swpping rows) Under certin conditions, NGE llows us to find the inverse. For mtri, the procedure for finding the inverse is given elow: STEP ONE. Write down the initil mtri ugmented y the identity mtri. STEP TWO. Using elementry row opertions, convert A into n identity mtri. () Put in, ROW ROW 4
ChE Lecture Notes, Dept. of Chemicl Engineering, Univ. of TN, Knoville - D. Keffer, 5/9/98 (updted /) () Put zeroes in ll the entries of COLUMN ecept ROW, ROW ROW ROW () Put one in, ROW ROW (4) Put zeroes in ll the entries of COLUMN ecept ROW, ROW ROW ROW which cn e simplified s: 5
ChE Lecture Notes, Dept. of Chemicl Engineering, Univ. of TN, Knoville - D. Keffer, 5/9/98 (updted /) Here we hve converted the mtri on the left hnd side to the identity mtri. As result the identity mtri tht ws originlly on the right-hnd side is now the inverse of A, A. This inverse cn e rewritten s A det ( A) (8.) where the determinnt of A ( mtri), det ( A), is given to e: det ( A) We cn lern severl things out the inverse from this demonstrtion. The most importnt thing is: If the determinnt is zero, the inverse does not eist (ecuse we divide y the determinnt to otin the inverse.) A mtri with determinnt of zero is clled singulr. A mtri with non-zero determinnt is clled non-singulr. Never clculte n inverse until you hve first shown tht the determinnt is not zero. We cn check tht this is the correct inverse y sustituting A into A A AA I nd verifying tht we otin the identity mtri. For mtri, A (8.8) the determinnt is det ( A ) ( ) ( ) ( ) + + (8.9) NGE cn e pplied to ny mm mtri with non-zero determinnt. A clen formul like eqution (8.) is not ville for m >. Even for m, the nlogous formul tends towrd the gruesome. (See the ppendi for the complete derivtion.) 6
ChE Lecture Notes, Dept. of Chemicl Engineering, Univ. of TN, Knoville - D. Keffer, 5/9/98 (updted /) A det + ( ) A + + + (8.4) For lrger mtrices, we generlly turn to computers to clculte the determinnt nd inverse for us. 8.6 Rnk nd Row Echelon Form We need to introduce couple dditionl quntities efore we get round to using the inverse to solve A. We sy tht mtri is in Row Echelon Form when ll elements elow the digonl re zero. This nottion is lso clled n upper tringulr mtri. Strting with the mtri A, we perform elementry row opertions on the mtri until the we zero out the required elements. A ROW ROW ROW ROW ROW ROW U ROW ROW ROW Simplifiction yields: U ( ) det A 7
ChE Lecture Notes, Dept. of Chemicl Engineering, Univ. of TN, Knoville - D. Keffer, 5/9/98 (updted /) The rnk of A is the numer of non-zero rows in the mtri when it is put in row-echelon form. The rnk of A is lso the numer of independent equtions in A. If the determinnt of the mtri is non-zero,we see tht the rnk of n nn mtri is n. U u u u u u u If the determinnt of n nn mtri is zero, then the rnk(a n ) is less thn n. u u u U u u Non-squre mtrices cn lso e put in row echelon form. Consider n n(n+) mtri of the form: C Agin, y performing elementry row opertions, we reduce this mtri to n upper tringulr form, u U u u u u u v v v The rnk of this mtri is still defined s the numer of non-zero rows in the row echelon form of the mtri. The rnk of the following mtri is three. u U u u u u v v v The rnk of the following mtri is two. u u u v U u u v 8
ChE Lecture Notes, Dept. of Chemicl Engineering, Univ. of TN, Knoville - D. Keffer, 5/9/98 (updted /) If mtri hs some non-zero rows, then it mens tht some of the equtions were linerly independent. Consider the mtri elow. A c + k c + k c + k We cn clerly see tht Row c*row + k*row. Row is liner comintions of Rows nd. If we perform elementry row opertions on A to put it in row echelon form, then we will find tht there re two nonzero rows. Thus the rnk is, the numer of independent equtions. At this point we cn identify some logiclly equivlent sttements out n nn mtri, A. If ny one of these sttements is true, ll the others re true. If nd only if det( A) then inverse eists then A is non-singulr then rnk (A) n then there re no zero rows in the row echelon form of A then A hs one, unique solution ll eigenvlues of A re non-zero If nd only if det( A) then inverse does not eist then A is singulr then rnk (A) < n then there is t lest one zero row in the row echelon form of A then A hs either no solution or infinite solutions t lest one eigenvlue of A is zero 8.7 Eistence nd Uniqueness of Solutions to A We now hve ll the tools we need to solve A. Before we work ny emples, we need to know eforehnd how mny solutions we cn otin for system. In deling with liner equtions, we only hve three choices for the numer of solutions. We either hve,, or n infinite numer of solutions. 9
ChE Lecture Notes, Dept. of Chemicl Engineering, Univ. of TN, Knoville - D. Keffer, 5/9/98 (updted /) No Solutions: rnk (A) < n nd rnk (A) < rnk(a ) One Solution: rnk (A) rnk(a ) n Infinite Solutions: rnk (A) rnk(a ) < n Consider ech cse. When rnk (A ) > rnk(a), your system is over-specified. There re no solutions to your prolem. When rnk (A ) rnk(a) n, you hve properly specified system with n equtions nd n unknowns nd you hve one, unique solution. When rnk (A ) rnk(a) < n, then you hve less equtions thn unknowns. You cn pick n rnk(a) unknowns ritrrily then solve for the rest. Therefore you hve n infinite numer of solutions. We will work one emple of ech cse elow. Emple: One Solution to Let s find where A () the determinnt of A () the inverse of A A A (c) the solution of (d) the solution of A () The determinnt of A is (y eqution 8.9) det( A) () Becuse the determinnt is non-zero, we know there will e n inverse. Let s find it. STEP ONE. Write down the initil mtri ugmented y the identity mtri.
ChE Lecture Notes, Dept. of Chemicl Engineering, Univ. of TN, Knoville - D. Keffer, 5/9/98 (updted /) STEP TWO. Using elementry row opertions, convert A into n identity mtri. () Put in, ROW ROW ROW / / / () Put zeroes in ll the entries of COLUMN ecept ROW, ROW ROW ROW ROW ROW ROW ROW ROW ROW ROW / / / / / / / / / () Put in, ROW ROW ROW / / / / / / / / / / (4) Put zeroes in ll the entries of COLUMN ecept ROW, ROW ROW ROW ROW/ * ROW ROW ROW ROW ROW / * ROW 5 / / / / / / / / / (5) Put in, ROW ROW ROW /
ChE Lecture Notes, Dept. of Chemicl Engineering, Univ. of TN, Knoville - D. Keffer, 5/9/98 (updted /) / / / / / 5 / (6) Put zeroes in ll the entries of COLUMN ecept ROW, * ROW / ROW ROW ROW ROW * ROW 5 / ROW ROW ROW ROW + 5 so 5 A (c) The solution to A is A 5 (d) The solution to A is A 4 8 5 We see tht we only need to clculte the inverse once to solve oth A nd A. Tht s nice ecuse finding the inverse is lot hrder thn solving the eqution once the inverse is known. Emple: No Solutions to A 4 A
ChE Lecture Notes, Dept. of Chemicl Engineering, Univ. of TN, Knoville - D. Keffer, 5/9/98 (updted /) det ( A) The determinnt is zero. No inverse eists. To determine if we hve no solution or infinite solutions find the rnks of A nd A. In row echelon form, A ecomes: U A so the rnk ( A) In row echelon form, A ecomes: U A so the ( A ) rnk. Since ( A ) rnk( A) rnk >, there re no solutions to A. Emple: Infinite Solutions to A Consider the sme mtri, A, s ws used in the previous emple. The determinnt is zero nd the rnk is. now consider different vector. Reduce the A mtri to row echelon form. U A In this cse, ( A ) rnk. Since rnk (A) rnk(a ) < n, there re infinite solutions.
ChE Lecture Notes, Dept. of Chemicl Engineering, Univ. of TN, Knoville - D. Keffer, 5/9/98 (updted /) 4 We cn find one emple of the infinite solutions y following stndrd procedure. First, we ritrrily select ) rnk(a n vriles. In this cse we cn select one vrile. Let s mke. Then sustitute tht vlue into the row echelon form of A nd solve the resulting system of ) rnk(a equtions. U A When U A Now solve new A prolem where A nd come from the non-zero prts of A U This prolem will lwys hve n inverse. So one emple of the infinite solutions is 8.8 Eigenvlues nd Eigenvectors See Liner Alger Appendi 8.9 Emple Applictions See Liner Alger Applictions Pcket
ChE Lecture Notes, Dept. of Chemicl Engineering, Univ. of TN, Knoville - D. Keffer, 5/9/98 (updted /) Summry of sic MATLAB commnds for Liner Alger Entering mtri A[,;,] (comms seprte elements in row, semicolons seprte rows) (esiest for direct dt entry) A[ ] (ts seprte elements in row, returns seprte rows) (useful for copying dt from tle in Word or Ecel) Entering column vector [;;] (n n vector) determinnt of mtri det(a) (sclr) inverse of n nn mtri inv(a) (nn mtri) solution of A A\ or inv(a)* (n vector) Entering row vector [,,] ( n vector) rnk of mtri rnk(a) (sclr) trnspose of n nm mtri or n n vector AA (mn mtri or n vector) reduced row echelon form of n nn mtri rref(a) (nn mtri) eigenvlues nd eigenvector of n nn mtri [w,lmd]eig(a) (w is n nn mtri where ech column is n eigenvector, lmd is nn mtri where ech digonl element is n eigenvlue, off-digonls re zero). 5