10.3: Basic Gauss Jordan
( \newcommand{\kernel}{\mathrm{null}\,}\)
The following is implementation of the Basic Gauss-Jordan Elimination Algorithm for Matrix A^{m \times n} (Pseudocode):
for i from 1 to m: for j from 1 to m if i ≠ j: Ratio = A[j,i]/A[i,i] #Elementary Row Operation 3 for k from 1 to n: A[j,k] = A[j,k] - Ratio * A[i,k] next k endif next j #Elementary Row Operation 2 Const = A[i,i] for k from 1 to n: A[i,k] = A[i,k]/Const next i
using the Pseudocode provided above, write a basic_gauss_jordan
function which takes a list of lists A as input and returns the modified list of lists:
Lets check your function by applying the basic_gauss_jordan
function and check to see if it matches the answer from matrix A in the pre-class video:
The above psuedocode does not quite work properly for all matrices. For example, consider the following augmented matrix:
\begin{split} B = \left[ \begin{matrix} 0 & 1 & 33\\ 5 & 3 & 7 \\ 6 & 69 & 4 \end{matrix} \, \middle\vert \, \begin{matrix} 30 \\ 90 \\ 420 \end{matrix} \right] \end{split} \nonumber
Explain why doesn’t the provided basic_gauss_jordan
function work on the matrix B?
Describe how you could modify matrix B so that it would work with basic_gauss_jordan
AND still give the correct solution?