Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Practice implementing and analyzing direct methods for linear systems.


Q5.1: Triangular Solves

(312024005)\begin{pmatrix} 3 & 1 & 2 \\ 0 & 2 & 4 \\ 0 & 0 & 5 \end{pmatrix}

$$

(200130421)\begin{pmatrix} 2 & 0 & 0 \\ 1 & 3 & 0 \\ 4 & 2 & 1 \end{pmatrix}

$$


Q5.2: Gaussian Elimination

Solve the following system using Gaussian elimination (show all steps):

x1+2x2+3x3=62x1+3x2+x3=63x1+x2+2x3=6\begin{aligned} x_1 + 2x_2 + 3x_3 &= 6 \\ 2x_1 + 3x_2 + x_3 &= 6 \\ 3x_1 + x_2 + 2x_3 &= 6 \end{aligned}

Q5.3: LU Decomposition


Q5.4: Flop Counting


Q5.5: Pivoting

Consider: $$

(0111)\begin{pmatrix} 0 & 1 \\ 1 & 1 \end{pmatrix}

$$


Q5.6: Implementation

Implement the following in Python:

Test on random 100×100100 \times 100 matrices and compare with scipy.linalg.lu.


Q5.7: Stability Investigation


Self-Assessment Questions

Test your understanding with these conceptual questions:

  1. Complexity: How many flops does Gaussian elimination require for an n×nn \times n matrix?

  2. LU Advantage: If you need to solve Ax=b\mathcal{A}\mathbf{x} = \mathbf{b} for 100 different b\mathbf{b} vectors, is it better to use Gaussian elimination 100 times or compute LU once?

  3. Pivoting: Why does dividing by small numbers cause problems in floating point arithmetic?

  4. Back Substitution: Why is back substitution O(n2)\mathcal{O}(n^2) rather than O(n3)\mathcal{O}(n^3)?