# SuanShu, a Java numerical and statistical library

com.numericalmethod.suanshu.algebra.linear.matrix.doubles.linearsystem

## Class BackwardSubstitution

• java.lang.Object
• com.numericalmethod.suanshu.algebra.linear.matrix.doubles.linearsystem.BackwardSubstitution

• public class BackwardSubstitution
extends Object
Backward substitution solves a matrix equation in the form Ux = b by an iterative process for an upper triangular matrix U. The process is so called because for an upper triangular matrix, one first computes xn, then substitutes that backward into the next equation to solve for xn-1, and repeats until x1. Note that some diagonal entries in U can be 0s, provided that the system of equations is consistent. For example, $\begin{bmatrix} 1 & 2 & 3\\ 0 & 0 & 5\\ 0 & 0 & 0 \end{bmatrix} \times \begin{bmatrix} 10\\ 0\\ 0 \end{bmatrix} = \begin{bmatrix} 10\\ 0\\ 0 \end{bmatrix}$
Wikipedia: Forward and Back Substitution
• ### Constructor Summary

Constructors
Constructor and Description
BackwardSubstitution()
• ### Method Summary

All Methods
Modifier and Type Method and Description
Matrix solve(UpperTriangularMatrix U, Matrix B)
Matrix solve(UpperTriangularMatrix U, Matrix B, double epsilon)
Vector solve(UpperTriangularMatrix U, Vector b)
Solve Ux = b.
Vector solve(UpperTriangularMatrix U, Vector b, double epsilon)
• ### Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
• ### Constructor Detail

• #### BackwardSubstitution

public BackwardSubstitution()
• ### Method Detail

• #### solve

public Vector solve(UpperTriangularMatrix U,
Vector b)
Solve Ux = b.
Parameters:
U - an upper triangular matrix, representing the system of linear equations (the homogeneous part)
b - a vector
Returns:
a solution x such that Ux = b
Throws:
LinearSystemSolver.NoSolution - if there is no solution to the system
• #### solve

public Vector solve(UpperTriangularMatrix U,
Vector b,
double epsilon)
• #### solve

public Matrix solve(UpperTriangularMatrix U,
Matrix B)
• #### solve

public Matrix solve(UpperTriangularMatrix U,
Matrix B,
double epsilon)