Skip to content

Instantly share code, notes, and snippets.

@rygorous
Created February 19, 2015 10:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rygorous/5e044f14549084fc08b0 to your computer and use it in GitHub Desktop.
Save rygorous/5e044f14549084fc08b0 to your computer and use it in GitHub Desktop.
Back substitution
R x = b => x = R^-1 b
compute using back substitution: Say R has the form
[a00 a01 a02]
R = [ 0 a11 a12]
[ 0 0 a22]
then our system Rx = b is
[a00 a01 a02] [x0] [b0]
[ 0 a11 a12] [x1] = [b1]
[ 0 0 a22] [x2] [b2]
so:
a22*x2 = b2 => x2 = b2 / a22
a11*x1 + a12*x2 = b1 => x1 = (b1 - a12*x2) / a11
a00*x0 + a01*x1 + a02*x2 = b0 => x0 = (b0 - a01*x1 - a02*x2) / a00
and so forth. That's back substitution (because builds the solution from the
last element to the first).
The equivalent process for lower triangular matrices is called forward substitution
and proceeds in the other direction.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment