Gauss-Jordan Elimination for Matrix Inversion and System Solutions

Gauss-Jordan Elimination for Matrix Inversion and System Solutions
Slide Note
Embed
Share

The content discusses Gauss-Jordan elimination, its purpose, elementary row operations, pivoting, implementation in C++ library, solution computation, and a code example. It also covers modifications to the textbook's code for specific solutions. Gauss-Jordan elimination is a powerful method for inverting matrices and solving systems of linear equations systematically.

  • Gauss-Jordan Elimination
  • Matrix Inversion
  • System Solutions
  • C++ Library
  • Linear Algebra

Uploaded on Apr 12, 2025 | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. Gauss-Jordan Elimination Ben Rorabaugh (ft. Gauss and Jordan)

  2. Purpose - Invert a matrix - Find the specific solution to a system of equations

  3. Elementary Row Operations - Swap two rows - Multiply an entire row by a (non-zero) scalar - Add a multiple of a row to another row

  4. Pivoting Pivoting refers to choosing one row with a more easily workable number and swapping it so that the workable number is on the diagonal.

  5. Gauss-Jordan Elimination in the C++ Library

  6. Pivoting in the C++ Library The gaussj() function finds a pivot by finding the greatest element in the desired row.

  7. Pivoting in the C++ Library (continued) The function then swaps the chosen pivot row so that the pivot element is on the diagonal.

  8. Computing the Solution The function then divides all other rows by the pivot element.

  9. Computing the Solution (continued) The function then subtracts the pivot row from all other rows. This entire process is repeated for all rows in the input matrix.

  10. Example Input: 2w + 3x + 1y - 2z = -4 g++ main.cpp -o main 0w - 2x + 3y - 5z = 3 ./main in3.txt 2w + 5x - 1y - 1z = -5 3w + 2x + 0y + 4z = 6 Expected Solution: w = -2 x = 0 y = 6 z = 3

  11. Changes I made to the textbook's code The textbook's code will always calculate the inverse of matrix A, with the specific solution in column B, if applicable. With the addition of a boolean parameter and some conditions using the parameter, we can have the program eliminate columns as expected

  12. The elimination algorithm for an n x n matrix - Loop n times: - Find the largest (abs. value) element in the matrix (that hasn't already been pivoted with); this is the pivot element - If the pivot element is not on the diagonal, swap rows so that it is - Normalize the row of the pivot element - Loop through all non-pivot rows: - Subtract the pivot row times the coefficient of the row's element in the pivot column

More Related Content