Skip to main content

Linear solution techniques; CG algorithm

Short answer

Linear systems are solved by direct methods such as Gauss elimination, LU and Cholesky, which factor the matrix, or by iterative methods such as Jacobi, Gauss-Seidel, SOR and CG, which refine a guess without fill-in. CG minimizes (1/2)x^T A x - b^T x using A-conjugate search directions and converges in at most n steps for symmetric positive definite A.

Explain different solution techniques of linear equations. Write the algorithm for the conjugate gradient method.

Linear system [A]{x}={b}[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=LLTA=LL^T for symmetric positive definite AA, 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.
DirectIterative
Fixed operation countNumber of iterations depends on tolerance
Fill-in within band/skylineKeeps sparsity
Good for many load cases (factor once)Good for very large systems

Algorithm of the conjugate gradient method

The conjugate gradient (CG) method solves Ax=bAx = b for a symmetric, positive definite matrix AA. It is equivalent to minimising the quadratic energy

Π(x)=12xTAx−bTx\Pi(x) = \tfrac{1}{2}x^T A x - b^T x

whose minimum is exactly the solution of Ax=bAx=b. The minimum is searched along directions dkd_k that are A-conjugate, i.e. diTAdj=0d_i^T A d_j = 0 for i≠ji \ne j. Each step minimises Π\Pi along one direction without spoiling the earlier ones, so in exact arithmetic the solution is reached in at most nn steps for an n×nn \times n system. The residual r=b−Axr = b - Ax is the negative gradient of Π\Pi.

  1. Choose a starting vector x0x_0 (usually 00). Compute the residual r0=b−Ax0r_0 = b - Ax_0 and set the first search direction d0=r0d_0 = r_0.
  2. For k=0,1,2,…k = 0, 1, 2, \dots repeat:
    • Step length: αk=rkTrkdkTAdk\alpha_k = \dfrac{r_k^T r_k}{d_k^T A d_k}
    • Update the solution: xk+1=xk+αkdkx_{k+1} = x_k + \alpha_k d_k
    • Update the residual: rk+1=rk−αkAdkr_{k+1} = r_k - \alpha_k A d_k
    • Check convergence: stop if ∥rk+1∥<\|r_{k+1}\| < tolerance.
    • Direction factor: βk=rk+1Trk+1rkTrk\beta_k = \dfrac{r_{k+1}^T r_{k+1}}{r_k^T r_k}
    • New direction: dk+1=rk+1+βkdkd_{k+1} = r_{k+1} + \beta_k d_k
  3. The last xk+1x_{k+1} is the solution.

✓ Answer checked by Claude Opus 5.5 (high effort)

All Computational Techniques in Civil Engineering chapter 2 questions →