2025 Week 2: Linear systems 1, Direct methods
Overview
The lecture develops direct methods for solving linear systems, from solvability and conditioning to Gaussian elimination, pivoting, and LU decomposition. It emphasizes that matrix structure matters: condition numbers reveal sensitivity to roundoff, repeated right-hand sides favor reusing LU factors, and sparsity must be preserved because factorization can introduce fill-in.
Key takeaways
- A singular coefficient matrix has determinant zero because its rows are linearly dependent; changing the right-hand side can turn the same matrix into either an inconsistent system or one with infinitely many solutions.
- A nonzero determinant alone does not ensure a numerically reliable solution: near-dependent equations can make the condition number large and amplify small roundoff errors.
- Gaussian elimination forms an upper-triangular system for back substitution, while LU decomposition preserves the elimination factors so multiple right-hand sides can be solved efficiently.
- Pivoting addresses zero or poor diagonal pivots, and a permutation factor records the row swaps used by practical LU implementations.
- Sparse and banded structure can greatly reduce storage and work, but factorization may create fill-in; explicitly forming an inverse usually destroys the useful sparsity pattern.
Chapters
- The canonical scalar equation is a times x equals b, while systems with multiple unknowns are written as A x = b.
- A is an m by n coefficient matrix, x contains n unknowns, and b contains m right-hand-side values.
- A square matrix has m = n, but having as many equations as unknowns does not guarantee a unique solution.
- The fundraising example uses chairs at $20, tables at $50, a $700 budget, and 20 total items.
- The constraints become 20C + 50T = 700 and C + T = 20.
- Plotting both equations in Google Colab makes their intersection visible and helps check whether a solution is plausible.
- Multiplying C + T = 20 by 20 and subtracting it from the budget equation gives 30T = 300.
- The solution is 10 tables and 10 chairs.
- Elimination generalizes more cleanly than repeated substitution as systems grow beyond two unknowns.
- When table prices and the budget change so both equations describe the same line, infinitely many combinations satisfy the constraints.
- The corresponding coefficient matrix has determinant zero and is singular.
- A zero determinant means the matrix cannot be inverted, regardless of which numerical solver is applied.
- Changing the budget while keeping dependent coefficient rows can produce parallel, distinct lines and no solution.
- Elimination exposes the contradiction as an equation such as 0 = 100.
- The coefficient matrix A is unchanged between the infinite-solution and no-solution cases; the right-hand side determines which outcome occurs.
- If one equation is a multiple of another, the equations are linearly dependent and do not provide independent constraints.
- For the two-variable example, a determinant of zero corresponds to dependent rows and parallel or coincident lines.
- Blindly using a least-squares method or pseudoinverse may return a value even when it is not the unique solution the problem requires.
- Perturbing the table price to 20 minus epsilon makes the determinant approach zero as epsilon approaches zero.
- The system remains theoretically solvable for nonzero epsilon, but the solution grows rapidly as the equations become nearly dependent.
- Roundoff can make nearly overlapping lines indistinguishable, creating large uncertainty in the computed intersection.
- Scaling an equation by a nonzero constant changes coefficient magnitudes but does not change the system's exact solution.
- Vector and matrix norms provide ways to measure magnitude; examples include the Euclidean norm and the maximum-element norm.
- A matrix condition number measures sensitivity to perturbations, with values near 1 indicating better-conditioned systems and large values indicating sensitivity.
- The NumPy function numpy.linalg.cond computes a matrix condition number without explicitly forming the inverse.
- In the furniture example, the condition number rises sharply as the table price approaches $20.
- The lecture uses conditioning as a diagnostic for numerical reliability, not as a guarantee that every solver will return a meaningful answer.
- The second lecture segment revisits conditioning as a relationship between uncertainty in a function's input and output.
- For a linear system A x = b, perturbations satisfy A times delta x = delta b.
- The condition number bounds worst-case relative error amplification between the solution and the right-hand side.
- Solving the perturbation equation gives delta x = A inverse times delta b.
- Using matrix norms leads to a relative-error bound involving the product of the norm of A and the norm of A inverse.
- The same condition number applies to a linear transformation and its inverse, reflecting sensitivity in both directions.
- A small circle of possible input values can become a stretched or compressed region under a matrix transformation.
- The inverse transformation maps output uncertainty back to input uncertainty, so worst-case directions matter in both spaces.
- A condition number near 1 corresponds to little relative distortion, while a large value signals sensitivity.
- An eigenvector is a direction that a matrix transformation scales without changing its direction.
- The lecture relates the largest and smallest stretching directions to the system's sensitivity.
- For general matrices, singular values provide the appropriate measure of extreme stretching; they also extend the idea to rectangular matrices.
- The Frobenius norm is the square root of the sum of squared matrix entries, while an infinity norm can be based on a maximum.
- The condition number is at least 1 and reaches 1 for transformations with no relative distortion in the chosen norm.
- Preconditioning aims to improve the conditioning of a system before solving it.
- Big O notation describes how computational work grows with problem dimension n, rather than with the numerical values inside a matrix.
- Standard dense matrix multiplication takes O(n cubed), while adding two n by n matrices takes O(n squared).
- The lecture warns that measured runtime also includes memory movement and other computer activity, so timing is an imperfect proxy for algorithmic complexity.
- Gaussian elimination applies row operations to transform A x = b into U x = b prime, where U is upper triangular.
- Back substitution solves the last variable first, then uses that result to solve upward through the system.
- The augmented matrix applies the same row operations to both A and b, preserving the solution.
- Each elimination step chooses a pivot row and uses a multiple of it to zero entries below the pivot.
- Swapping rows changes the determinant's sign, scaling a row scales the determinant, and subtracting a multiple of one row from another leaves it unchanged.
- The elimination multipliers become entries of the lower-triangular factor in LU decomposition.
- The worked 3 by 3 example eliminates entries column by column to form an upper-triangular matrix.
- Elimination costs approximately n cubed over 3 operations, while back substitution costs O(n squared).
- Gauss-Jordan elimination also zeros entries above the diagonal, but its greater elimination work makes it less attractive than Gaussian elimination with back substitution.
- A zero on the diagonal can prevent elimination even when the underlying system has a solution.
- Swapping equations fixes the ordering problem, and a permutation matrix represents that row swap algebraically.
- Practical LU routines use pivoting to avoid unsuitable pivots and improve numerical behavior.
- A matrix is strictly row diagonally dominant when each diagonal entry's absolute value exceeds the sum of the other absolute values in its row.
- The lecture compares two row orderings of the same system to show that one may be diagonally dominant while the other is not.
- Diagonal dominance is useful in numerical analysis, but it is not a universal guarantee that every numerical difficulty has disappeared.
- Applications often solve A x = b repeatedly with the same A but different right-hand sides.
- Repeating elimination for each new b wastes work because the matrix-dependent elimination can be reused.
- LU decomposition stores the transformation in factors that can be applied to later right-hand sides.
- LU decomposition represents a matrix as a product of a lower-triangular matrix L and an upper-triangular matrix U.
- The system L U x = b is split by defining an intermediate variable y, then solving L y = b followed by U x = y.
- Each triangular solve takes O(n squared), although computing the factorization itself generally takes O(n cubed).
- The upper-triangular matrix U is produced during elimination.
- The multipliers used to eliminate entries populate L, typically with ones on its diagonal.
- Different conventions and pivoting choices can produce different valid L and U factors for the same A.
- Numerical libraries commonly return a permutation matrix or equivalent row-order information in addition to L and U.
- The permutation factor records row pivoting used to handle zero or poor pivots.
- The lecture's package example reconstructs the original matrix using the permutation and triangular factors.
- Factoring A costs O(n cubed), but each new right-hand side can then be solved with two O(n squared) triangular solves.
- Reusing the factors is beneficial when an engineer needs solutions for multiple b vectors.
- Parallel and multifrontal methods can improve wall-clock performance for large systems, though communication between processors adds overhead.
- A need not be square in applications such as curve fitting, although the lecture defers detailed pseudoinverse methods to a later topic.
- A pseudoinverse can return a result for singular or rectangular systems, so the meaning of that result must be checked.
- Direct solvers are described as robust for difficult systems but costly in memory, system size, and parallel scaling.
- Sparse matrices contain many zero entries, so specialized storage can retain only nonzero values and their locations.
- Finite element systems often have structured nonzero patterns, while finite difference methods commonly produce banded matrices.
- Fill-in occurs when factorization turns zero entries into nonzeros, increasing storage and computational cost.
- The identity matrix leaves a vector unchanged, and the inverse of a diagonal matrix is found by inverting its diagonal entries.
- Permutation matrices encode row exchanges, while symmetric matrices have matching entries across the main diagonal.
- Symmetric positive definite matrices are important for methods such as conjugate gradients, which the lecture reserves for later.
- A tridiagonal matrix has three populated diagonals, and pentadiagonal matrices have five; both arise in discretized engineering problems.
- Block matrices group submatrices and can expose repeated structure or identity blocks in multiphysics systems.
- Block-diagonal structure can simplify solving because separate diagonal blocks can be treated independently.
- The inverse of a sparse or banded matrix is generally dense, even when the original matrix has many zeros.
- Explicit inversion can turn a clean sparse pattern into a dense matrix, greatly increasing storage and computation.
- The recommended numerical approach is to factor A and solve triangular systems rather than form and store A inverse.
- The assignment link opens a locked Google Colab notebook, so students must save their own editable copy.
- The completed notebook is due the following Thursday and should be submitted in IPYNB format.
- Another environment is acceptable if the work is converted back to an IPYNB file.
Transcript excerpt
0:03 Okay guys, let's uh let's get started. 8:30. Um yeah, sorry I couldn't be there for the lab yesterday. I hope it was uh worthwhile. Um the the Dash system that uh that produced that worksheet for the Python 3 tutorial. Uh they were ideally I was trying to get them to come in and do a lecture, but they we couldn't work it out at uh at short notice. So that that's on me. Um but I hope at least that was uh that was useful. Um, moving forward that'll be the uh the assignment time you guys to go in, you can work on your assignments, you can talk to us TAs, you guys can work together, whatever you want. And then the next week will be the the oral examination part of it as we uh as we spoke about it last time. Um, okay. So linear systems, now is when things uh start to get a little bit more interesting. Um, linear
0:51 systems are the workhorse of scientific computing. Everything basically comes down to it. And linear systems includes the canonical solve, right? So you have a constant scaler time x is equal to b and you solve for x. Right? Literally all you have to do is divide through. Okay. Uh in contrast x squared or anything where the unknown is anything other than linear is nonlinear by definition. That's just kind of the catchall. As it turns out, we can basically use almost always the same techniques to handle nonlinear equations. And they all kind of boil down to linear equations on the inside. Uh, I was messing around with this one yesterday. Uh, Jupiter books doesn't like to format normal math as well as the align statements. So, you're going to have to use your imagination for now.
This is the start of the transcript. Save this video free for the whole transcript, searchable and time-coded.
In this course
Related notes
Summary, takeaways, and chapters were generated by AI from the video's transcript and may contain errors. The video belongs to its creator, Numerical Methods for Engineering.