CHPTER PROGRM OF MTRICES -- INTRODUCTION definition of engineering is the science y which the properties of mtter nd sources of energy in nture re mde useful to mn. Thus n engineer will hve to study the properties nd ehvior of physicl systems, pplying his knowledge to ttin purposes useful to society. Such ctivity cn e considered s consisting of the study nd solution of rel physicl. The complexities involved in deling with ll the prmeters reltive to the properties of rel prolem will, on mny occsions, force him to study n equivlent engineering prolem which cn e mthemticlly defined. He will try to solve such prolem ccording to his knowledge nd experience, nd using the computtionl tools t hnd. When we think of tody s engineering prolems, such s the construction of nucler rectors, spce stellites, oil rigs in the se, etc. it is cler tht they must e nlyzed using very relined discrete models, so s to closely pproximte their rel ehvior. Fortuntely, with the help of the modern computer, it is possile tody to tret discrete models with up to severl thousnds of degrees of freedom. Thus, the need for formulting lrger nd more complex discrete models, nd the vilility of computers which mke fesile their nlysis, re the cuses of the considerle interest produced in reltion to numericl methods nd computer nlysis techniques.
-- PROGRMMING LNGUGES computer cn perform elementry opertions using stored informtion. The user cn order the computer to perform n opertion, giving the proper instruction, s prt of his progrm. The set of ll the instructions which computers ccepts constitutes the mchine lnguge, or solute lnguge of tht computer. The mchine instructions re lwys expressed y numeric codes. Ech instruction normlly consists of one opertion code, nd one or more prmeters or rguments. For instnce, the sequence cn represent two instructions written ccording to given mchine lnguge. He first step in progrmming the solution of prolem, is to mke n nlysis of the prolem. The prolem is studied in ll its detil, nd n pproprite solution scheme is selected. Then the computer solution to e implemented is schemtized grphiclly, y mens of digrm clled flow chrt. These digrms cn e detiled to greter or leser extent, ccording to circumstnces, ut they re fundmentl to the nlysis nd understnding of ll spects of the computer solution. The person in chrge of this tsk is normlly clled n nlyst. Once the flow-chrt is completed, the computer solution is coded, writing the computer progrm using the lnguge selected. This tsk is crried out y progrmmer. With the progrm registered in some informtion support, nd the dt nd proper control commnds dded, the progrm is tested y sumitting it for processing. t the eginning the progrm will include some errors. These cn e syntx errors nd logic errors. Syntx errors pper ecuse some of the rules of the lnguge re violted. Normlly These cn e esily detected nd corrected. Logic errors correspond to the cse tht syntx errors-free progrm is sumitted for execution, nd it does not produce the desired results.
The following situtions cn e encountered.. Execution of the progrm stops efore producing results.. Execution of the progrm does not stop nd results re not produced. The progrm is finlly discontinued fter exceeding the llowed time.. Results re produced, ut they re incorrect.. The progrm works successfully. -- ELEMENTRY MTRIX OPERTION -- Definitions nd Rules Mtrix lger is the set of rules which defines opertions performed with mtrices. mtrix is i-dimensionl rry of numers orgnized ccording to n rows nd m columns, which we refer to s mtrix of order n x m. In wht follows, mtrix will e indicted y old type. Thus, R will e mtrix, while T is sclr numer. The elements or coefficients of mtrix will e two su-indices, indicting row nd column position, respectively. For instnce (-) is rectngulr mtrix, of order x, tht is hving rows nd columns. The su-indices of the coefficients indicte their position within the mtrix. Thus, the coefficient is plced in the first row nd the second column. mtrix hving the sme numer of rows nd columns is clled squre mtrix, such s
B (-) which is squre mtrix of rows nd columns, or of order x. In cse such s this, when speking specificlly of squre mtrices, we cn simply sy tht B is of order. The coefficients,, nd or in generl ij for i = j, re clled the coefficients of the principl or min digonl of the mtrix. Severl types of squre mtrices cn e considered. When the coefficients of squre mtrix B stisfy the condition ij = ji, for i =,,.,n nd j =,,.,n (-) this clled symmetric mtrix. In prticulr, if B is symmetric mtrix of order, it will hve the following structure B (-) On the other hnd, skew-symmetric mtrix is such tht ij = - ji, for i j & ij =, for i = j (-) for exmple, B (-) when ll the coefficients of squre mtrix B re null, except for the min digonl, such s, B (-)
this is clled digonl mtrix. If, in prticulr, ll the coefficients of the min digonl re equl to, the mtrix is clled unit mtrix, nd is symolized I. For instnce, the following is the unit mtrix of order. I (-) mtrix hving only one column is clled column vector. Normlly, the coefficients of column vector will e given only one suscript, corresponding to the row position, nd will e enclosed y curled rckets insted of squre rckets, plced verticlly, s in c c C c (-9) where C is column vector of order. When mtrix hs only one row it will e clled row vector nd gin, ech of its coefficients will e given only one suscript. For instnce, D d d d (-) d is row vector of order. In wht follows the use of the term vector lone will lwys e tken to men column vector. The trnspose of mtrix is otined y interchnging rows nd columns, of the mtrix, nd is indicted y n upper-index T. For instnce, the trnspose of, given y eq. (-) is
T (-) while the trnspose of mtrix B, given y eq. (-) is B T (-) It cn e noticed tht the trnspose of column vector is row vector, nd vice vers. Thus, the trnspose of column vector, given y eq. (-9) is C T c c (-) c While the trnspose of row vector, given y eq. (-) is d d d d D T (-) The trnspose of the trnspose gives the originl mtrix, tht is T T (-) For symmetric mtrix, the trnspose of the mtrix is the originl mtrix, B B T (-)
nother specil mtrix which cn e defined s the null mtrix, represented y, whose coefficients re ll equl to zero. For instnce, (-) is null mtrix of order x -- Trnspose of Rectngulr Mtrix The following routine is very simple exmple of computer progrm operting with mtrices which cn e used to otin the trnspose of rectngulr mtrix. C This progrm computes the trnspose of mtrix of order n x m DIMENSION (,),B(,) DO I=,n DO J=,m B(J,I) = (I,J) END where the rry contins the mtrix to e trnsposed, the integer n contins the numer of rows, nd the integer m contins the numer of columns.
-- Trnspose of Squre Mtrix In the cse of squre mtrix it is possile to trnspose the mtrix in itself, without creting new one. The following routine receives the originl mtrix in the rry, of order n, nd fter operting returns the trnsposed mtrix in the sme rry. Note tht n uxiliry vrile S is used to llow for the trnsposition in plce. C This progrm computes the trnspose of squre mtrix of order n DIMENSION (,) n = n - DO I=,n I = I + DO J=I,n S = (,J) (I,J) = (J,I) (J,I) = S END -- ddition nd Sutrction of Mtrices Two different mtrices cn e dded or sutrcted, provided they re of the sme order. Let us consider the following two mtrices, B (-) By definition the sum of nd B will give nother mtrix C, lso of the sme order, i.e. c c C (-9) c c c c
where coefficients re c = + c = + c = + c = + c = + c = + In generl, c ij = ij + ij for i =,,.,n nd j =,,.,m (-) -- Progrm of ddition nd Sutrction of Mtrices The following routine cn e used for ddition nd sutrction of mtrices. The rrys nd B contin the mtrices to e dded or sutrcted, which of order n x m. The rry C will contin the result mtrix. When the integer L = is specified the routine will perform the ddition opertion, ut when L = the routine will perform the sutrction opertion. C This progrm computes the mtrix opertion C C = + B when L = nd C C = - B when L = C n : numer of rows C m : numer of columns DIMENSION (,), B(,), C(,) DO I=,n DO J=,m GO TO (,), L C(I,J) = (I,J) + B(I,J) GO TO C(I,J) = (I,J) - B(I,J) CONTINUE END 9
-- Multipliction of Mtrices Multipliction of mtrices cn lso e performed. Let us consider mtrix of order n x m, nd mtrix B of order m x n, such s, B (-) The mtrix multipliction eqution C B (-) gives s result new mtrix with coefficients: c = + + c = + + c = + + c = + + or, in generl: c ij m k ik kj (-) It is esily seen tht two mtrices cn e multiplied only if the numer of columns of the first mtrix is equl to the numer of rows of the second mtrix. The result mtrix will hve the sme numer of rows of the first mtrix nd the sme numer of columns of the second mtrix. Notice tht ccording to its definition, mtrix multipliction is not commuttive, i.e.,
[] [B] [B] [] (-) nd tht, in prticulr, if the left hnd side is defined, the right-hnd side my e undefined unless the numer of rows of mtrix is equl to the numer of columns of mtrix B. Even in tht cses, the results of the left-hnd side, nd the right-hnd side will e different, excluding very prticulr cses. -- Progrm of Multipliction of Mtrices The multipliction of two mtrices cn e redily progrmmed. The following routine receives the first mtrix of order n x m, in the rry, nd the second mtrix of order m x h, in the rry B. The result mtrix, of order n x h, will e stored in the rry C. Note tht since the implementtion of eq. (-) requires ccumulting the prtil multiplictions in the rry C, we hve een creful in previously setting c ij =. C C C C C This progrm computes the mtrix opertion C = * B n : numer of rows of nd C m : numer of columns of nd rows of B h : numer of columns of B nd C DIMENSION (,), B(,), C(,) DO I=,n DO J=,h C(I,J) = DO K=,m C(I,J) = C(I,J) + (I,K) * B(K,J) END
-- Progrm of Inverse of Mtrices The inverse of mtrix C is the mtrix which stisfy the following reltion [C] [C] - = [I] The following routine cn e used for computing the mtrix inverse [C] -. C This progrm computes the mtrix opertion DIMENSION C(,), ST(,), C(,) DO I=, DO J=, ST(I,J) = C(I,J) M = K= DO I=, DO J=, IF (I.EQ.(J-)) GO TO ST(I,J) =. GO TO ST(I,J) = CONTINUE L = DO J=,K IF (L.EQ.J) GO TO ST(L,J) = ST(L,J) / ST(L,L) CONTINUE ST(L,L) = DO J=, IF(J.EQ.L) GO TO IF(ST(I,J).EQ..) GO TO DO M=,K IF(L.EQ.M) GO TO ST(J,M) = ST(J,M) ST(J,L) * ST(L,M) CONTINUE ST(J,L) =. CONTINUE IF(L.EQ.) GO TO GO TO DO 9 I=, DO 9 J=, 9 C(I,J) = ST(I,J+) END
Solved Prolems - For the following mtrices, evlute the following expressions if possile. If not possile, stte the reson: ) [D] [E] ] ) [] x [C] c) [] x.[b]. B C D E Solution ) [D] [E] ] [ ] [ E D 9 9 9 9
) [] x x [C] x ةيناثلا ةفوفصملا فوفص ددع عم ىلولأا ةفوفصملا ةدمعأ ددع يواست مدعل ةنكمم ريغ c) [] x [B].. ]. [ ] [ x B x... x.... ) Find the inverse of the following mtrix: x Solution dj By using Srus method, we cn get
= + + + + (-) (-9) = is nonsingulr mtrix. 9. 9.....9. 9.9..9 9....9.. 9. 9...... 9. 9..9.9... 9...... min ors of Mtrix 9. 9.....9. 9.9..9 9....9.. 9. 9...... 9. 9..9.9... 9...... mtrix fctor Co 9.... 9. 9. 9. 9.9.9..9......9...9..... 9. 9.....9. 9. 9... T dj 9.... 9. 9. 9. 9.9.9..9......9...9..... 9. 9.....9. 9. 9.........9.......9....9..99...9....9..........
SHEET () ) Identify the properties of ech of the following mtrices:...... B C D.... E F ) Evlute the following expressions if possile. If not possile, stte the reson. [C] + [B] [] + [C] [F] T x [D] + [F] x [E] x [F] T [E] x [F] [] - [B] - [B] x [C] [] - [F] T x [C] [D] - [C] x [B] ) Solve the following simultneous equtions: X X + X = 9 X + X X = X + X =