Back substitution (source code)

= Back substitution
{title2=$x_i=(b_i-\sum_{j>i}a_{ij}x_j)/a_{ii}$}

An upper <triangular matrix> system with nonzero diagonal is solved from the last row upward. Once $x_{i+1},\ldots,x_n$ are known, use $x_i=(b_i-\sum_{j>i}a_{ij}x_j)/a_{ii}$. The nonzero diagonal guarantees a unique solution; this is the final solve after a <QR factorization>.