MATH 417 Lecture 18

From Notes
Jump to navigation Jump to search

« previous | Thursday, March 27, 2014 | next »

Quiz on Tuesday over Chapter 5 (diff eqs)

Linear Algebra

Matrices

Component-wise addition, subtraction, and scalar multiplication

Gaussian-Jordan Elimination

(Sections 6.1 and 6.2 Row echelon form:

Find solution to Ax=b

AbIx


  1. If a1,1=0, find another row j such that aj10 and switch
  2. Divide row 1 by a11
  3. Add row 1 scaled by ai,1 to remaining rows i
  4. Recur on submatrices to get upper triangular matrirx
  5. Jordan steps perform similar operations to upper half of matrix (starting from bottom) to get identity matrix.

Gaussian and Jordan's steps each take O(23n3) operations. Hence solving system of equations is O(43n3)

In Matlab, x = A \ b is a fast matrix equation solver. Don't use x = A^(-1) * b


Instability

Example

Let ϵ<12

[ϵ111][x1x2]=[12]

[ϵ11112]

Performing gaussian elimination gives solutions

x1=1ϵ(1x2) x2=21ϵ11ϵ for very small ϵ, we get x21ϵ1ϵ=1, which is actually a pretty good estimation, but substituting it back into x1gives1ϵ0=0, whereas the exact solution for ϵ=0 is x1=x2=1.

In reality, we are not solving for Ax=b, we are actually solving for (A+ΔA)x^=(b+Δb). We really care how close x^ is to x given |ΔA| and |Δb| are small values.


Matlab Exercise

x=[111]

Generate random matrix A and compute Ax=b

Solve for Ax^=b.

This usually works only 1 out of 10 times, so Gaussian elimination is unstable


Gaussian Elimination with Partial Pivoting

Added stability

At step i, we are operating on row i with current diagonal entry aii.

If aii=0, find j such that |aji|=maxikn|aki| and swap rows i and j.

Now whenever we multiply remaining rows k by (akiaii), we have |akiaii|1

Example

Applying this to our example above gives

[ϵ111][x1x2]=[12]

The solutions match with exact solutions: x2=12ϵ1ϵ11=1 and x1=2x21


Gaussian Elimination with Full Pivoting

When looking at a11,

  1. find aij such that |aij|=max1k,sn|aks| (largest entry in entire matrix)
  2. Interchange rows 1 and i and columns 1 and j
  3. Change x1 to xj (bookkeeping headache)

This is better, but still not perfect: there are still matrices that might cause it to fail.

(this method is what Matlab uses)


Eigenvalues and Eigenvectors

λ is an eigenvalue of A if there exists x0 such that Ax=λx.

This implies 0=Axλx=(AλI)x, which further implies |AλI|=0.

Computing this determinant gives a polynomial of λ of degree n (for n \times n matrix) that has roots λ (i.e. p(λ)=0).


Example

|ϵλ111λ|=0

Gives equation λ2(1+ϵ)λ+ϵ1=0

and solutions λ=1+ϵ±(1+ϵ)24(ϵ1)2

As ϵ0, we get |λ2λ1|3. Therefore Gaussian elimination will be stable.