# Rearrange a matrix into a diagonally dominant form and solve it using iterative method

I have the matrix and I solve the system using iterative method

From $$Ax=b$$, matrix $$A$$: $$\begin{bmatrix} 2 & 3 & -4 & 1 \\ 1 & -2 & -5 & 1 \\ 5 & -3 & 1 & -4 \\ 10 & 2 & -1 & 2 \\ \end{bmatrix}$$

Matrix b: $$\begin{bmatrix} 3 \\ 2 \\ 1 \\ -4 \\ \end{bmatrix}$$

I was told that firstly, I need to transform the matrix to the way, where every diagonal element is greater than the sum modulo of other elements in this row.

In this matrix, it's easy to do with $$2$$ rows, the last one $$(10 > 2 + 1 + 2)$$, and the second one $$(5 > 2 + 1 + 1)$$, however, I can't find any algorithm or any solution how to transform it in general.

Any tips?

UPD.

Gauss-Seidel method should work, but this site says that "Equations are Divergent" and I'm pretty sure this happens because of diagonal elements are being less than sum of other elements in the row

• @Moo thank you for the note and the article, it helped a lot. Also, I updated the question. Answering your question, I think Gauss-Seidel method would work for me, but this site says that "Equations are Divergent" and I think this happens because of diagonal elements. Jun 11 '19 at 9:22
• @Moo Okay, so there is no algorithm how to rearrange equations, I guess I just need to try it manually. Jun 11 '19 at 12:17
• @Moo My bad, should have told you. Are you sure the last row is 3 0 0 9 -4, not 2 -5 -1 -9 9? Jun 17 '19 at 13:02
• Using the matrix as shown in the beginning in my answer, we have $2R_1 - R_2 \implies 3, 8, -3, 1, 4$ and $2R_3 - R_4 \implies 0, -8, 3, -10, 6$. Adding those together gives the result as shown. I am sure.
– Moo
Jun 17 '19 at 13:09
• @Moo I see I see, I was confused, because some calculators produced your (correct) answer and some gave me -0.81, 0.45, -0.46, 1.38 which is not the same Jun 18 '19 at 10:21

For the Gauss - Seidel Method to work, the matrix must be in diagonally dominant form and your current matrix is not, so we expect it to fail.

Sometimes, we cannot easily see a way to put the matrix in such a form without playing around with it. We have

$$\left[ \begin{array}{cccc|c} 2 & 3 & -4 & 1 &3\\ 1 & -2 & -5 & 1 &2\\ 5 & -3 & 1 & -4 &1\\ 10 & 2 & -1 & 2&-4 \\ \end{array} \right]$$

We can take $$R_4 \rightarrow R_1$$ and $$R_2 \rightarrow R_3$$, but the other two rows are problematic. We can try using row operations, with care, to see if we can get those into diagonally dominant form.

For row $$2$$, we can take $$R_2 \rightarrow R_1-R_2$$.

We now need a fourth row and must be careful to make sure and use the third row, since we haven't made use of it yet.

For row $$4$$, we can do $$R_4 \rightarrow 2R_1 - R_2 + 2 R_3 - R_4$$.

We now have

$$\left[ \begin{array}{cccc|c} 10 & 2 & -1 & 2&-4\\ 1 & 5 & 1 & 0 &1\\ 1 & -2 & -5 & 1 &2\\ 3 & 0 & 0 & 9&10 \\ \end{array} \right]$$

Now repeat the Guass-Seidel method since this matrix is in diagonally dominant form.

We should get a solution of $$X = \begin{bmatrix} -\dfrac{1}{3} \\ \dfrac{4}{9}\\ -\dfrac{8}{9}\\ -\dfrac{11}{9} \end{bmatrix}$$