International Journal of Algebra, Vol. 5, 2011, no. 20, 993 - 1003 Solve Linear System with Sylvester’s Condensation Abdelmalek Salem Department of Mathematics University of Tebessa, 12002 Algeria And Faculty of Sciences and Arts at Yanbu, Taibah University, Saudi Arabia a.salem@gawab.com Khaled Sioud Department of Mathematics Faculty of Sciences and Arts at Yanbu, Taibah University, Saudi Arabia Taher Mekhaznia Department of Informatics University of Tebessa, 12002 Algeria mekhaznia@yahoo.fr Abstract We present a development of Dodgson’s method for the solution to a system of linear equations (see [5]) using the determinants of the Sylvester’s (Determinants) Identity. We explicitly write down the algorithm for this developed method. Mathematics Subject Classification: Primary 05A19; Secondary 05A10 Keywords: Linear system, Dodgson’s condensation, Sylvester’s determinant identity 1 Introduction In this paper we consider a system of n linear equations: ⎧ a11 x1 + a12 x2 + ... + a1n xn − b1 = 0, ⎪ ⎪ ⎨ a21 x1 + a22 x2 + ... + a2n xn − b2 = 0, ....................................... ⎪ ⎪ ⎩ an1 x1 + an2 x2 + ... + ann xn − bn = 0. with aij , bi ∈ R i, j = 1, 2, ..., n and n ∈ N∗ . (1.1) 994 S. Abdelmalek, K. Sioud and T. Mekhaznia We can rewrite expression (1.1) in the following matricial form: AX − B = 0 ⎛ ⎜ ⎜ A=⎜ ⎝ a11 a12 · · · a1n a21 a22 · · · a2n .. .. .. .. . . . . an1 an2 · · · ann ⎞ ⎛ ⎞ x1 x2 .. . ⎟ ⎜ ⎟ ⎜ ⎟,x = ⎜ ⎠ ⎝ ⎛ ⎟ ⎜ ⎟ ⎜ ⎟ and B = ⎜ ⎠ ⎝ xn b1 b2 .. . ⎞ ⎟ ⎟ ⎟ ⎠ (1.2) bn Also write A = [C1 , C2 , · · · , Cn ] (1.3) where C1 is the first column and C2 is the second column, ect ..Previous Results 1.1 Method of Gabriel Cramer (1704–1752) Cramer’s rule is a theorem, which gives an expression for the solution of a system of linear equations with as many equations as unknowns, Theorem 1 If det A = 0, then the solution of (1.1) is X := A−1 B with A−1 the inverse matrix of A, the unknowns (xj )m j=1 are given by Cramer formula : xj = det [C1 , C2 , · · · , Cj−1, B, Cj+1, · · · , Cn ] ; j = 1, 2, ..., n. det A Proof. Let X = n i=1 xi ei So B = AX = n xi Ci i=1 Then for j = 1, 2, ..., n det [C1 , C2 , · · · , Cj−1, B, Cj+1, · · · , Cn ] = det C1 , C2 , · · · , Cj−1, n (2.1) n xi Ci , Cj+1 , · · · , Cn = i=1 xi det [C1 , C2 , · · · , Cj−1, Ci , Cj+1, · · · , Cn ] = i=1 xj det [C1 , C2 , · · · , Cj−1, Cj , Cj+1 , · · · , Cn ]+ n i=1 xj det A. 1.2 xi det [C1 , C2 , · · · , Cj−1, Ci , Cj+1, · · · , Cn ] = i=j Method of Charles L. Dodgson (Lewis Carroll, 1832– 1898)(see [5]) This method concludes by showing how this process may be applied to the solution of simultaneous linear equations. 995 Solve linear system If we take a block consisting of n rows and (n + 1) columns, and ”condense” it, we reduce it at last to 2 terms, the first of which is the determinant of the first n columns, the other of the last n columns. Hence, if we take the n simultaneous equations (1.1), and if we condense the whole block of coefficients and constants. ⎛ ⎞ a11 a12 · · · a1n b1 ⎜ a21 a22 · · · a2n b2 ⎟ ⎜ ⎟ (2.2) ⎜ .. .. .. .. ⎟ . . ⎝ . . . . . ⎠ an1 an2 · · · ann bn we reduce it at last to two terms which we denote by S, T , so that s= a11 a12 · · · a1n a21 a22 · · · a2n .. .. .. .. . . . . an1 an2 · · · ann and t = a12 · · · a1n b1 a22 · · · a2n b2 .. .. .. . .. . . . . an2 · · · ann bn Now we know that x1 = (−1)n TS , which may be written in the form (−1)n Sx1 = T. Hence the two terms obtained by the process of condensation may be converted into an equation for x1 , by multiplying the first of these equations by x1 , affected by a (+) or (−) according to n being even or odd respectively. The latter part of the rule may simply be expressed as: ” place the signs (+) and (−) alternately over the several columns, beginning with the last column with a (+) sign, and the sign which occurs over the column containing x1 is the sign with which x1 is to be affected.” When the value of x1 has been thus found, it may be substituted in the first (n − 1) equations, and the same operation is repeated on the new block, which will now consist of (n − 1) rows and n columns. But in calculating the second series of blocks, it will be found that most of the work has already been done. In fact, of the two determinants required in the new block, one has already been computed correctly, and the computation of the other only requires the last column in each of the derived blocks to be corrected. This method based on Dodgson’s algorithm is based on the following algorithm: algorithm 1.1 (Dodgson’s algorithm) This algorithm can be described in the following four steps: (1) Let A be the given n × n matrix. Arrange A so that no zeros occur in its interior. An explicit definition of interior would be all ai,j with i, j = 1, n. We can do this using any operation that we could normally perform without changing the value of the determinant, such as adding a multiple of one row to another. (2) Create an (n − 1) × (n − 1) matrix B, consisting of the determinants of 996 S. Abdelmalek, K. Sioud and T. Mekhaznia ai,j ai,j+1 . every 2 × 2 submatrix of A. Explicitly, we write bi,j = ai+1,j ai+1,j+1 (3) Using this (n − 1) × (n − 1) matrix, perform step (2) to obtain an (n − 2) × (n − 2) matrix C. Divide each term in C by the corresponding term in the interior of A. (4) Let A = B, and B = C. Repeat step (3) as necessary until the 1 × 1 matrix is found; its only entry is the determinant. To clarify how the algorithm works, let us deal with the following example: −2 −1 −1 −4 −1 −2 −1 −6 Example 1 We wish to find 4 −1 −1 2 2 1 −3 −8 We of its 2 × 2 submatrices. make a matrix −2 −1 −1 −1 −1 −4 −1 −2 −2 −1 −1 −6 3 −1 2 −1 −2 −2 −1 −1 −6 = −1 −5 8 −1 −1 −1 2 2 4 1 1 −4 −1 −1 4 −1 2 2 2 1 −3 1 −3 −8 We matrix then find another of determinants: 3 −1 −1 2 −1 −5 −5 8 −16 2 . = −1 −5 −5 8 4 12 1 1 1 −4 We must then divide each element by the corresponding element of our origi −2 −1 , so after dividnal matrix. The interior of our original matrix is −1 −2 8 −2 . The process is repeated untill one arrives at a 1 × 1 ing we get −4 6 8 −2 = |40|.We divide by the interior of our 3×3 matrix, which matrix: −4 6 is just −5, giving us |−8|. −8 is indeed the determinant of the original matrix. However we cannot apply these steps on all matrices as shown in the following examples: Example 2 We wish to find |A| = 2 −1 2 1 −3 1 2 1 −1 2 1 −1 −2 −1 −1 we apply step 2 1 −1 −2 −1 1 −2 −1 −1 2 Solve linear system 997 5 −5 −3 −1 −3 −3 −3 3 again we apply step (2) (2) on matrix A, we find |B| = 3 3 −1 3 −5 −3 −1 −5 −30 6 −12 on matrix B, we get: |C| = 0 0 −6 . By applying step (3), we get: 6 6 −16 −15 6 12 0 0 6 . 6 −6 8 5 −5 −3 −1 −15 6 12 −3 −3 −3 3 , |B| = 0 0 6 By applying step (4), we find: |A| = 3 3 −1 3 6 −6 8 −5 −3 −1 −5 36 0 −12 0 36 = , so 0 −3 and |C| = 36 0 12 .We repeat the previous steps, 0 0 36 3 we get : −15 6 12 0 −12 and |C| = |0|, so 0 . This means 0 6 , |B| = |A| = 0 0 0 12 6 −6 8 2 1 −1 Dodgson’s method cannot be used to compute |A| because −1 −2 −1 = 0. 1 −1 −2 Example 2 2 −1 −1 1 −1 3 We wish to find |A| = −1 −1 = 0 −2 2 −1 2 1 −3 1 2 2 −1 2 1 −1 −1 −1 −1 ,we notice that 2 1 −1 −2 −1 1 −2 −1 −1 2 5 −6 −4 −1 −3 0 −3 3 . By With the same way in example (1.3) , we find: |B| = 2 1 −1 3 −5 −3 −1 −5 −18 18 −15 −18 18 −15 2 2 −1 −6 6 0 0 , so −1 −1 −1 = the condensation of B, we get: |C| = −6 6 1 −6 1 1 1 −6 1 −1 −2 −9 9 15 6 −6 0 by applying the same previous steps, we find: 1 −1 3 998 S. Abdelmalek, K. Sioud and T. Mekhaznia 5 −6 −4 −1 −9 9 −3 0 −3 3 6 −6 , |B| = 3 2 1 −1 1 −1 −5 −3 −1 −5 0 90 0 90 −3 . Finally 00 −18 B, we get: |C| = 0 −18 2 1 |A| = 15 0 3 . and by the condensation of In examples 2 and 3, we face problems in the computation of the determinant. If we continue the process, we will eventually be dividing by 0. We can avoid this problem by changing some rows or columns and then repeating the process. 1.3 Sylvester and Chio’s condensation Chio’s pivotal condensation (see [4]) is a special case of Sylvester’s determinant identity (see [7]). It is a method for evaluating an n × n determinant in terms of (n − 1) × (n − 1) determinants. Proposition 2 ( [1, 2]) we condense the determinant of an n × n matrix to the determinant of (n − 1) × (n − 1) matrix. The elements of (n − 1) × (n − 1) matrix are the determinants of 2 × 2 matrix as is shown in the following formula: (ak,l )n−2 det (ai,j )1≤i,j≤n = det 1≤i,j≤n−1 [det (Ai,j )] , 1 ≤ n, l ≤ n (3.1) where A(i,j) 2 ⎧ a a i,j i,l ⎪ ⎪ if j < l, i < k ⎪ ⎪ ak,j ak,l ⎪ ⎪ ⎪ ⎪ ⎪ ai,l ai,j+1 ⎪ ⎪ if j ≥ l, i < k ⎨ ak,l ak,j+1 = . ⎪ ak,j ak,l ⎪ ⎪ if j < l, i ≥ k ⎪ ⎪ ai+1,j ai+1,l ⎪ ⎪ ⎪ ⎪ ⎪ ak,j+1 ak,l ⎪ ⎩ if j ≥ l, i ≥ k ai+1,l ai+1,j+1 Main Results In this section, we’ll show the main result which is a development of Dodgson’s method for the solution to a system of linear equations (see [5]). We use the determinants of the Sylvester’s (Determinants) Identity . For this, we propose the following algorithm: 999 Solve linear system algorithm 2.1 This algorithm can be described in the following three steps: (1) Let A be a given (n + 1) × n matrix in (2.2). We use the elements of the column before the last as pivots in the matrix A (2) Create an n × (n − 1) matrix B, consisting of the determinants of every 2 × 2 submatrix of A. ⎧ ai,j ai,l ⎪ ⎪ if i < n, j < l, ⎪ an,j an,l ⎪ ⎪ ⎪ ⎪ ⎪ ai,l ai,j+1 ⎪ ⎪ ⎪ if i < n, j ≥ l, ⎨ a n,l an,j+1 bi,j = a ⎪ an,l ⎪ ⎪ n,j if i = n, j < l, ⎪ ⎪ an+1,j an+1,l ⎪ ⎪ ⎪ ⎪ a ⎪ an,j+1 ⎪ ⎩ n,l if i = n, j ≥ l, an+1,l an+1,j+1 Taking an+1,j = bj forj = 1, 2, ..., n. We take the first non-zero element in column before the last as the lth row of matrix B. If all elements are zero stop. (3) Let A = B. Repeat step (2) as necessary until a 2 × 1 matrix is found, its only entry is the (s, t) in (3.2). Remark 1 In the algorithm 2.1 if we divide elements bi,j of matrix B by the pivot (an,l )n−2 at every iteration we find (s, t) = (S, T ) . Let us consider the system (1.1) . If we condense the whole block of coefficients and constants (2.2) we find two terms denoted s and t; the first is the determinant of the first n columns multiplied by α, the second is the determinant of the last n columns multiplied by α: s = α a11 a12 · · · a1n a21 a22 · · · a2n .. .. .. .. . . . . an1 an2 · · · ann and t = α a12 · · · a1n b1 a22 · · · a2n b2 .. .. .. .. . . . . an2 · · · ann bn (3.2) where α is the result of not dividing by the pivots. For computing s and t, we use (algorithm 2.1 ). Hence the two terms obtained by the process of condensation may be converted into an equation for x1 , by multiplying the first of these equation by (−1)n x1 . Now we know that x1 = (−1)n st , which may be written in the form (−1)n x1 s = t. (these computations are independent of α). The sign that xi is to be affected with is the sign of (−1)n+i−1 . When the value of x1 has been found, it may be substituted in the (n − 1) equations after deleting the equation that corresponds to the row which is not included in forming the pivot, and the same operation is repeated on the new 1000 S. Abdelmalek, K. Sioud and T. Mekhaznia matrix, which will now consist of (n − 1) rows and n columns. However in calculating the second series of matrices, it is found that most of the work has already been done. In fact one of the two determinants required in the new matrix has already been found correctly, and the computation of the other only requires the last column in each of the derived matrices. To clarify the algorithm we give the following examples: Example 4 Consider the following system of five linear equations: ⎧ x1 + 2x2 + x3 − x4 + 2x5 + 2 = 0 ⎪ ⎪ ⎪ ⎪ ⎨ x1 − x2 − 2x3 − x4 − x5 − 4 = 0 2x1 + x2 − x3 − 2x4 − x5 − 6 = 0 ⎪ ⎪ x1 − 2x2 − x3 − x4 + 2x5 + 4 = 0 ⎪ ⎪ ⎩ 2x1 − x2 + 2x3 + x4 − 3x5 − 8 = 0 The table of solution is: 2 1 2 1 −1 2 1 −1 −2 −1 −1 −4 2 1 −1 −2 −1 −6 1 −2 −1 −1 2 4 2 −1 2 1 −3 −8 ⇓ −3 0 3 3 −6 −5 −4 1 5 −10 0 8 4 0 4 −7 −4 −7 1 −10 ⇓ 0 12 0 12 0 −24 −12 12 18 12 24 −24 ⇓ 144 144 0 −216 144 −288 ⇓ 31 104 −62 208 5 (−1) 31 104x1 = −62 208 2 4 −1 −2 −1 −2 2 6 ⇓ 3 0 5 0 0 4 ⇓ 12 0 −12 12 2 6 −1 −3 −1 −1 ⇓ 3 0 5 4 2 5 −1 −1 ⇓ 3 3 2 4 ⇓ −2x5 = 4. x5 = −2 ⇓ ⇓ 12 12 3x4 = 3 ........... x4 = 1 ⇓ ⇓ 144 144 −12x3 = 12 .......... ........... x3 = −1 ⇓ 144x2 = 144 ........... .......... ........... x2 = 1 ............. ........... .......... ........... x1 = 2 In this example the last equation is always deleted. 1001 Solve linear system Example 5 Consider the following system of five linear equations: ⎧ 2x1 + x2 + 2x3 + 2x4 + 2 = 0 ⎪ ⎪ ⎨ −x1 − 2x2 − x3 − x4 − 4 = 0 x1 − x2 − x3 − x4 − 6 = 0 ⎪ ⎪ ⎩ −2x1 − x2 − x3 + 2x4 + 4 = 0 2 1 2 2 2 −1 −2 −1 −1 −4 1 −1 −1 −1 −6 −2 −1 −1 2 4 ⇓ 0 3 0 −6 −4 1 0 −10 8 4 6 4 ⇓ 8 4 6 4 −4 1 0 −10 0 3 0 −6 ⇓ 24 −6 −60 0 −18 −36 ⇓ −432 −864 −432x1 = −864 2 6 ⇒ −1 −4 ⇒ 2 4 2 2 2 0 ⇒ 2 −8 3 ⇓ ⇓ 6 −12 0 −2 6 −4 ⇓ , −2x4 = − 83 x4 = − 43 ⇓ −6 −12 ⇓ 6x3 = −4 .......... x3 = − 23 ⇓ 6x2 = −12 ............. ........... ........... .......... ............ x2 = −2 x1 = 2 In this example the Third equation is always deleted, because we remove the equations which do not contain a pivot. The issue of removing equations is resolved by the method of permutations which is shown in the following subsection. 3 Algorithm The algorithm is presented is two steps: Step 1- Transformation of the matrix into a triangular matrix . Step 2- Resolution of the system. Step 1 - Transformation: for i = 1 to n π (i) = i end loop. for k = 1 to n 1002 S. Abdelmalek, K. Sioud and T. Mekhaznia m=k (k) piv = ak,n−k+1 while piv = 0 m=m+1 (k) piv = am,n−k+1 end while if piv = 0 Stop ” Singular matrix A” end ⎫ c = π (m) ⎬ π (m) = π (k) permutation π (m) and π (k) ⎭ π (k) = c for l from 1 to n (k) Lk (l) = am,l ⎫ (k) Lk (l) = am,l ⎪ ⎬ (k) (k) Permutation between rows number k and m am,l = ak,l ⎪ ⎭ (k) ak,l = Lk (l) end loop l for i from k + 1 to n for j from 1 to n − k (k+1) (k) (k) (k) (k) ai,j = ak,j · ai,n−k+1 − aij · ak,n−k+1 end loop j end loop i end loop k Step 2 - Resolution for l from 1 to n cl = bl Permutation of terms of vector b. bl = cπ(l) end loop l b=b eps = (−1)n−1 for j from 1 to n b(1) = b for k from 1 to n − j for i from k + 1 to n − j + 1 b(k+1) = b(k) · a(n+1) − b(k) · a(k) i i k,n−k+1 k i,n−k+1 end loop i end loop k (k+1) (n+1) xj = eps · bn−j+1 /an−j+1,j 1003 Solve linear system if j =< n − 1, for i from 1 to n − j update b for next iteration. (1) bi = bi − ai,j xj end if. end main loop j. End of algorithm. References [1] S. Abdelmalek, arXiv:0712.0822. and S. Kouachi, Condensation of determinants [2] S. Abdelmalek and S. Kouachi, A Simple Proof of Sylvester’s (Determinants ) Identity, App.Math. scie. Vol. 2.2008. no 32. 1571-1580. [3] A. G. Akritas, E. K. Akritas, and G. I. Malaschonok, Various proofs of Sylvester’s (determinant) identity, Math. and Computers in Simulation 42 (1996) 585-593. [4] F. Chio, Mémoires ur les FonctionsC onnues sous le nom des Résultants ou des Déterminants Turin,(1853). [5] C.L. Dodgson, Condensation of Determinants, Proceedings of the Royal Society of London 15(1866), 150-155. [6] S. Kouachi, S. Abdelmalek, and B. Rebai, A Mathematical Proof of Dodgson’s Algorithm arXiv:0712.0362. [7] T. Muir, The Theory of determinants in The Historical Order of Development, vol. II. London (1911). Received: April, 2011