For the following problem: using Gauss-Seidel iteration method using partial pivoting find the solution of following system up to 5 iterations with initial values $(x,y,z,w) = (0,0,0,0)$
$10x-7y+3z+5w = 6$
$-6x+8y-z-4w = 5$
$3x+y+4z+11w = 2$
$5x-9y-2z+4w = 7$
My approach:
Partial pivoting:- reorganising equaitons so that $|a_{ij}/a_{ii}| < 1 \forall i,j$
$x = (6+7y-3z-5w)/10$
$y = (-7+5x-2z+4w)/9$
$z = (2-3x-y-11w)/4$
$w = (-5-6x+8y-z)/4$
Putting initial values $(0,0,0,0)$
1st iteration: $(0.6, -0.4444, 0.1611, -3.0792)$
2nd iteration: $(1.7801, -1.1931, 7.9309, -8.2892)$
3rd iteration: $(1.5301, -5.3742, 23.4912, -20.1664)$
4rth iteration: $(-0.1261, -15.0310, 59.8100, -46.0753)$
5th iteration: $(-4.8270, -37.2285, 140.1344, -103.5000)$
Why are these values not converging to actual answer $(5,4,-7,1)$ even after 5 iterations. They seem to diverge on every further iteration. Could you tell me, did I do pivoting correctly? Please clarify!
You are no where wrong. The problem is not intrinsically convergent. Defining $$v=\begin{bmatrix}x\\y\\z\\w\end{bmatrix}$$and $$A=\begin{bmatrix}0&0.7&-0.3&-0.5\\{5\over 9}&0&-{2\over 9}&{4\over 9}\\-{3\over 4}&-{1\over 4}&0&{11\over 4}\\-{3\over 2}&2 &-{1\over 4}&0\end{bmatrix}\\b=\begin{bmatrix}0.6\\-{7\over 9}\\0.5\\-{5\over 4}\end{bmatrix}$$you are trying to iteratively find $v$ such that $$v_0=\underline{0}\\,\\v_{n+1}=Av_n+b$$such that $v_{n}\to v^*$ where $v^*$ is the answer of the set of the equations. Note that $$v_n=A^n v_0+(A^{n-1}+\cdots +I)b=(A^{n-1}+\cdots +I)b$$which is convergent only if all the absolute values of the eigenvalues of $A$ are less that $1$. Since this is not the case here (the eigs are $\approx\{-1.84,0.25,0.62,1.47\}$) then we have divergence.