Implementation of Gaussian- Elimination
Total Page:16
File Type:pdf, Size:1020Kb
International Journal of Innovative Technology and Exploring Engineering (IJITEE) ISSN: 2278-3075, Volume-5 Issue-11, April 2016 Implementation of Gaussian- Elimination Awatif M.A. Elsiddieg Abstract: Gaussian elimination is an algorithm for solving systems of linear equations, can also use to find the rank of any II. PIVOTING matrix ,we use Gaussian Jordan elimination to find the inverse of a non singular square matrix. This work gives basic concepts The objective of pivoting is to make an element above or in section (1) , show what is pivoting , and implementation of below a leading one into a zero. Gaussian elimination to solve a system of linear equations. The "pivot" or "pivot element" is an element on the left Section (2) we find the rank of any matrix. Section (3) we use hand side of a matrix that you want the elements above and Gaussian elimination to find the inverse of a non singular square matrix. We compare the method by Gauss Jordan method. In below to be zero. Normally, this element is a one. If you can section (4) practical implementation of the method we inherit the find a book that mentions pivoting, they will usually tell you computation features of Gaussian elimination we use programs that you must pivot on a one. If you restrict yourself to the in Matlab software. three elementary row operations, then this is a true Keywords: Gaussian elimination, algorithm Gauss, statement. However, if you are willing to combine the Jordan, method, computation, features, programs in Matlab, second and third elementary row operations, you come up software. with another row operation (not elementary, but still valid). You can multiply a row by a non-zero constant and I. INTRODUCTION add it to a non-zero multiple of another row, Section (1) replacing that row. Basic Concepts: So what? If you are required to pivot on a one, then you must sometimes use the second elementary row operation A. Echelon form: and divide a row through by the leading element to make it The steps of replacing the argument matrix into reduced into a one. Division leads to fractions. While fractions are row-echelon form. The goal when solving a system of your friends, you're less likely to make a mistake if you linear equations is to replace the augmented matrix into don't use them. reduced row-echelon form, if possible. There are three What's the catch? If you don't pivot on a one, you are elementary row operations that you may use to accomplish likely to encounter larger numbers. Most people are willing placing a matrix into reduced row-echelon form. Each of the to work with the larger numbers to avoid the fractions. requirements of a reduced row-echelon matrix can satisfied The Pivot Process: using the elementary row operations. If there is a row of all zeros, then it is at the bottom of Pivoting works because a common multiple (not necessarily the matrix. Interchange two rows of a matrix to move the least common multiple) of two numbers can always be the row of all zeros to the bottom. found by multiplying the two numbers together. Let's take The first non-zero element of any row is one. That the example we had before, and clear the first column. element is called the leading one. Multiply (divide) the x y z rhs row by a non-zero constant to make the first non-zero 3 2 -4 3 element into a one. The leading one of any row is to the right of the leading 2 3 3 15 one of the previous row. Multiply a row by a non-zero 5 -3 1 14 constant and add it to another row, replacing that row. The point of this elementary row operation is to make Helpful Hints: numbers into zeros. By making the numbers under the Although you do not have to pivot on a one, it is highly leading ones into zero, it forces the first non-zero desirable. Pivoting on a one means that you're element of any row to be to the right of the leading one multiplying by 1 (which is easy to do). of the previous row. It is nice to pivot on the main diagonal, but not All elements above and below a leading one are zero. absolutely necessary. Some people like to start in the Multiply a row by a non-zero constant and add it to upper left and work their way down to the lower right. another row, replacing that row. The point of this As long as you pivot only once per row and column, the elementary row operation is to make numbers into zero. columns which have been cleared will remain cleared. The difference here is that you're clearing (making zero) Since the point of pivoting is to clear the pivot column, the elements above the leading one instead of just picking a column which already has zeros in it saves below the leading one. time because you don't have to change the row that contains the zero. Revised Version Manuscript Received on April 04, 2016. Awatif M.A. Elsiddieg, Faculty of Mathematical Sciences Elneilain Selecting a Pivot: University Math. Department Khartoum Sudan. Present Address: Prince Sattam Bin Abdul-Aziz University Faculty of Science & Humanities Studies Math. Dept. Hotat Bani – Tamim Kingdom of Saudi Arabia P. O .Box. Published By: Retrieval Number: K22830451116/2016©BEIESP Blue Eyes Intelligence Engineering 7 & Sciences Publication Implementation of Gaussian- Elimination Pick the column with the most zeros in it. To replace the 1 in R3C3, you would take 3(1) - 5(-4) = 3 + Use a row or column only once 20 = 23 Pivot on a one if possible To replace the 14 in R3C4, you would take 3(14) - 5(3) = 42 Pivot on the main diagonal - 15 = 27. Never pivot on a zero Here's how the process looks. Never pivot on the right hand side x y z rhs Since there is no one in the first row, we have two options: Either we divide the first row by three and work with pivot row, pivot row, pivot row, pivot row, fractions, or we pivot on the three and get large numbers. copy copy copy copy That is the option I'm going to use. I'll pivot on the three in 3 2 -4 3 R1C1. Go ahead and circle that as the pivot element. pivot column, Depending on your browser, you may see the pivot elements 3(3) - 2(2) 3(3) - 2(-4) 3(15) - 2(3) clear circled in red or just with a * in front of it. 5 17 39 0 x y z rhs pivot column, 3(-3) - 5(2) 3(1) - 5(-4) 3(14) - 5(3) *3 2 -4 3 clear -19 23 27 2 3 3 15 0 Or, if you remove the comments, the matrix after the first 5 -3 1 14 pivot looks like The idea is to make the boxed (yellow) numbers into zero. This: Using the combined row operation (this is not an elementary x y z rhs operation), that could be done by: 3 2 -4 3 3R2 - 2R1 → R2 and 3R3 - 5R1 → R3. The only row not being changed is the row containing the 0 5 17 39 pivot element (the 3). The whole point of the pivot process 0 -19 23 27 is to make the boxed values into zero. Go ahead and rewrite the pivot row and clear (make zero) the pivot column. It is now time to repeat the entire process. We go through x y z rhs and pick another place to pivot. We would like it to be on the main diagonal, a one, or have zeros in the column. *3 2 -4 3 Unfortunately, we can't have any of those. But since we have to multiply all the other numbers by the pivot, we want 0 it to be small, so we'll pivot on the 5 in R2C2 and clear out 0 the 2 and -19. To replace the values in row 2, each new element is x y z rhs obtained by multiplying the element being replaced in the 3 2 -4 3 second row by 3 and subtracting 2 times the element in the first row from the same column as the element being 0 *5 17 39 replaced. To perform the pivot, place one finger on the pivot 0 -19 23 27 (circled number), and one finger on the element being replaced. Multiply these two numbers together. Now, place Begin by copying down the pivot row ( row) and clearing one finger on the boxed number in the same row as the the pivot column ( column). Previously cleared columns element you're replacing and the other finger in the pivot will remain cleared. row and the same column as the number your replacing. x y z rhs Multiply these two numbers together. Take the product with 0 the pivot and subtract the product without the pivot. x y z rhs 0 *5 17 39 0 0 *3 2 -4 3 Here are the calculations to find the next iteration. By 2 3 3 15 careful attention to the row where we're subtracting -19 5 -3 1 14 times a value. Since we're subtracting a negative, I went ahead and wrote it as plus 19. To replace the 3 in R2C2, you would take 3(3) - 2(2) = 9 - 4 = 5. x y z rhs To replace the 3 in R C , you would take 3(3) - 2(-4) = 9 +8 2 3 pivot column, 5(-4) - 5(3) - = 17.