The Gauss-Jordan method used to solve the prototype linear system can be
described as follows. Augment \(A\) by the right-hand-side vector \(\mathbf{b}\)
and proceed as in Gaussian elimination, except use the pivot element \(a_{k
k}^{(k-1)}\) to eliminate not only \(a_{i k}^{(k-1)}\) for \(i=k+1, \ldots, n\) but
also the elements \(a_{i k}^{(k-1)}\) for \(i=1, \ldots, k-1\), i.e., all elements
in the \(k\) th column other than the pivot. Upon reducing \((A \mid \mathbf{b})\)
into
$$
\left[\begin{array}{cccc|c}
a_{11}^{(n-1)} & 0 & \cdots & 0 & b_{1}^{(n-1)} \\
0 & a_{22}^{(n-1)} & \ddots & \vdots & b_{2}^{(n-1)} \\
\vdots & \ddots & \ddots & 0 & \vdots \\
0 & \cdots & 0 & a_{n n}^{(n-1)} & b_{n}^{(n-1)}
\end{array}\right],
$$
the solution is obtained by setting
$$
x_{k}=\frac{b_{k}^{(n-1)}}{a_{k k}^{(n-1)}}, \quad k=1, \ldots, n
$$
This procedure circumvents the backward substitution part necessary for the
Gaussian elimination algorithm.
(a) Write a pseudocode for this Gauss-Jordan procedure using, e.g., the same
format as for the one appearing in Section \(5.2\) for Gaussian elimination. You
may assume that no pivoting (i.e., no row interchanging) is required.
(b) Show that the Gauss-Jordan method requires
\(n^{3}+\mathcal{O}\left(n^{2}\right)\) floating point operations for one right-
hand-side vector \(\mathbf{b}\) -roughly \(50 \%\) more than what's needed for
Gaussian elimination.