---
title: "Linear solution techniques; CG two iterations"
subject: "Computational Techniques in Civil Engineering"
chapter: 2
key: "semester_8/computational_techniques_in_civil_engineering:solution-techniques-cg-numerical-two-iter"
source: https://www.bctengineer.com/q/semester_8/computational_techniques_in_civil_engineering/solution-techniques-cg-numerical-two-iter
site: BCT Engineering
---

# Linear solution techniques; CG two iterations

Computational Techniques in Civil Engineering · Chapter 2: Solutions of linear equations

- Asked in: 2075 Bhadra, 3+5 marks
- Video: [Iterative Solvers: Method of Steepest Descent and Conjugate Gradient (Part 2)](https://www.youtube.com/watch?v=XRIi-BAzqU4) — Sandip Mazumder
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_8/computational_techniques_in_civil_engineering/solution-techniques-cg-numerical-two-iter
- Whole chapter: https://www.bctengineer.com/md/semester_8/computational_techniques_in_civil_engineering/chapter-2

## Question

Explain different solution techniques of linear equations. For the given linear system

$$
\begin{bmatrix} 12 & -6 & 0 \\ -6 & 12 & -6 \\ 0 & -6 & 6 \end{bmatrix}\begin{Bmatrix} x_1 \\ x_2 \\ x_3 \end{Bmatrix} = \begin{Bmatrix} 24 \\ 24 \\ 0 \end{Bmatrix}
$$

using the starting vector $x^{(0)} = (4, 4, 0)^T$, carry out two iterations of the conjugate gradient method and show the result.

## Short answer

Direct methods (Gauss elimination, LU, Cholesky) solve in finite steps; iterative methods (Jacobi, Gauss-Seidel, CG) improve a guess. With x0=(4,4,0), computing residuals and conjugate directions yields after two iterations x=(4,8,8).

## Answer

Linear system $[A]\{x\}=\{b\}$ is solved by:
1. **Direct methods** (finite number of steps, exact apart from round-off): Gauss elimination (reduce to upper triangular form, back-substitute), Gauss-Jordan, LU decomposition, Cholesky decomposition $A=LL^T$ for symmetric positive definite $A$, and the matrix inverse. In FEM they use banded or skyline storage.
2. **Iterative methods** (start from a guess and improve): Jacobi, Gauss-Seidel, successive over-relaxation, and the conjugate gradient method. They suit very large sparse systems since the matrix is never changed and no fill-in occurs. Jacobi and Gauss-Seidel need diagonal dominance for convergence; CG needs a symmetric positive definite matrix.

| Direct | Iterative |
|---|---|
| Fixed operation count | Number of iterations depends on tolerance |
| Fill-in within band/skyline | Keeps sparsity |
| Good for many load cases (factor once) | Good for very large systems |

#### Conjugate gradient, two iterations
$A=\begin{bmatrix}12&-6&0\\-6&12&-6\\0&-6&6\end{bmatrix}$, $b=\{24,24,0\}^T$, $x_0=\{4,4,0\}^T$.

$Ax_0=\{12(4)-6(4),\,-6(4)+12(4),\,-6(4)\}=\{24,24,-24\}^T$, so
$$
r_0=b-Ax_0=\{0,0,24\}^T,\quad d_0=r_0
$$

#### Iteration 1
$$
\begin{aligned}
Ad_0&=\{0,-144,144\}^T\\
\alpha_0&=\frac{r_0^Tr_0}{d_0^TAd_0}=\frac{576}{3456}=0.1667\\
x_1&=x_0+\alpha_0d_0=\{4,\,4,\,4\}^T\\
r_1&=r_0-\alpha_0Ad_0=\{0,\,24,\,0\}^T\\
\beta_0&=\frac{576}{576}=1,\quad d_1=r_1+\beta_0d_0=\{0,\,24,\,24\}^T
\end{aligned}
$$

#### Iteration 2
$$
\begin{aligned}
Ad_1&=\{-144,\,144,\,0\}^T\\
\alpha_1&=\frac{576}{3456}=0.1667\\
x_2&=x_1+\alpha_1d_1=\{4,\,8,\,8\}^T\\
r_2&=r_1-\alpha_1Ad_1=\{24,\,0,\,0\}^T
\end{aligned}
$$

**Answer: after two iterations $x^{(2)}=\{4,\,8,\,8\}^T$** with residual $\{24,0,0\}^T$. A third iteration gives the exact solution $x=\{8,12,12\}^T$ (the system has $n=3$ unknowns).

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. With x0 = (4,4,0), what is r0?
   A. {24,24,0}
   B. {0,0,24}
   C. {0,0,-24}
   D. {4,4,0}
   Answer: B. Ax0 = {24,24,-24}, so r0 = b - Ax0 = {0,0,24}. (Key point: Initial residual)

2. What is x after two iterations?
   A. {4,8,8}
   B. {4,4,4}
   C. {8,12,12}
   D. {4,8,4}
   Answer: A. x1 = {4,4,4}, x2 = {4,8,8}. (Key point: x after 2 iterations)

3. How many iterations until exact?
   A. Two
   B. One
   C. Four
   D. Three, since n = 3
   Answer: D. Third iteration gives {8,12,12}. (Key point: Exact solution)

## Related in Computational Techniques in Civil Engineering

- [Conjugate gradient three iterations (10,-6,0)](https://www.bctengineer.com/question.md?key=semester_8%2Fcomputational_techniques_in_civil_engineering%3Acg-three-iterations-a) — Computational Techniques in Civil Engineering, chapter 2
- [Linear solution techniques; CG algorithm](https://www.bctengineer.com/question.md?key=semester_8%2Fcomputational_techniques_in_civil_engineering%3Asolution-techniques-cg-algorithm) — Computational Techniques in Civil Engineering, chapter 2
- [Conjugate gradient numerical (5 iterations)](https://www.bctengineer.com/question.md?key=semester_8%2Fcomputational_techniques_in_civil_engineering%3Acg-numerical-3-0-1) — Computational Techniques in Civil Engineering, chapter 2
- [Conjugate gradient numerical (3,0,2 system)](https://www.bctengineer.com/question.md?key=semester_8%2Fcomputational_techniques_in_civil_engineering%3Acg-numerical-3-0-2) — Computational Techniques in Civil Engineering, chapter 2, asked 2×
- [Solution methods of linear equations with examples](https://www.bctengineer.com/question.md?key=semester_8%2Fcomputational_techniques_in_civil_engineering%3Asolution-methods-linear-examples) — Computational Techniques in Civil Engineering, chapter 2
- [Conjugate gradient numerical (2,-1 system)](https://www.bctengineer.com/question.md?key=semester_8%2Fcomputational_techniques_in_civil_engineering%3Acg-numerical-three-unknowns-a) — Computational Techniques in Civil Engineering, chapter 2, asked 2×

## Related in other subjects

- [N-R two iterations, 2-bus system](https://www.bctengineer.com/question.md?key=semester_5%2Fpower_system_analysis_ii%3Anr-two-bus-two-iterations) — Power System Analysis II, chapter 2
- [Conjugate beam: slope and deflection at free end](https://www.bctengineer.com/question.md?key=semester_4%2Ftheory_of_structures_i%3Aconjugate-beam-24kn-10knm) — Theory of Structures I, chapter 4
