Skip to main content

Conjugate gradient numerical (3,0,2 system)

Short answer

Applying the conjugate gradient method from the zero vector, the solution after three iterations is x1=2, x2=2.5, x3=-2.5, with zero residual. The intermediate vectors are (1,0,-1), then (2,2,-2), then the final values.

Solve the given system of equations using the conjugate gradient method.

[302011213]{x1x2x3}={10−1}\begin{bmatrix} 3 & 0 & 2 \\ 0 & 1 & 1 \\ 2 & 1 & 3 \end{bmatrix}\begin{Bmatrix} x_1 \\ x_2 \\ x_3 \end{Bmatrix} = \begin{Bmatrix} 1 \\ 0 \\ -1 \end{Bmatrix}

A=[302011213]A=\begin{bmatrix}3&0&2\\0&1&1\\2&1&3\end{bmatrix} is symmetric and positive definite (leading minors 3, 3, 2>03,\ 3,\ 2>0). b={1,0,−1}Tb=\{1,0,-1\}^T. Take x0=0x_0=0: r0=br_0=b, d0=r0={1,0,−1}Td_0=r_0=\{1,0,-1\}^T.

Iteration 1

Ad0={1, −1, −1}Tα0=r0Tr0d0TAd0=22=1x1={1, 0, −1}Tr1=r0−α0Ad0={0, 1, 0}Tβ0=12=0.5,d1=r1+β0d0={0.5, 1, −0.5}T\begin{aligned} Ad_0&=\{1,\,-1,\,-1\}^T\\ \alpha_0&=\frac{r_0^Tr_0}{d_0^TAd_0}=\frac{2}{2}=1\\ x_1&=\{1,\,0,\,-1\}^T\\ r_1&=r_0-\alpha_0Ad_0=\{0,\,1,\,0\}^T\\ \beta_0&=\frac{1}{2}=0.5,\quad d_1=r_1+\beta_0d_0=\{0.5,\,1,\,-0.5\}^T \end{aligned}

Iteration 2

Ad1={0.5, 0.5, 0.5}Tα1=10.5=2x2={2, 2, −2}Tr2={−1, 0, −1}Tβ1=21=2,d2={0, 2, −2}T\begin{aligned} Ad_1&=\{0.5,\,0.5,\,0.5\}^T\\ \alpha_1&=\frac{1}{0.5}=2\\ x_2&=\{2,\,2,\,-2\}^T\\ r_2&=\{-1,\,0,\,-1\}^T\\ \beta_1&=\frac{2}{1}=2,\quad d_2=\{0,\,2,\,-2\}^T \end{aligned}

Iteration 3

Ad2={−4, 0, −4}Tα2=28=0.25x3={2, 2.5, −2.5}Tr3={0, 0, 0}T\begin{aligned} Ad_2&=\{-4,\,0,\,-4\}^T\\ \alpha_2&=\frac{2}{8}=0.25\\ x_3&=\{2,\,2.5,\,-2.5\}^T\\ r_3&=\{0,\,0,\,0\}^T \end{aligned}

Answer: x1=2, x2=2.5, x3=−2.5x_1=2,\ x_2=2.5,\ x_3=-2.5. Check: 3(2)+2(−2.5)=13(2)+2(-2.5)=1, 2.5−2.5=02.5-2.5=0, 2(2)+2.5−7.5=−12(2)+2.5-7.5=-1.

✓ Answer checked by Claude Opus 5.5 (high effort)

All Computational Techniques in Civil Engineering chapter 2 questions →