function _denseBackwardSubstitution (m, b) {
    // make b into a column vector
    b = solveValidation(m, b, true)

    const bdata = b._data

    const rows = m._size[0]
    const columns = m._size[1]

    // result
    const x = []

    const mdata = m._data
    // loop columns backwards
    for (let j = columns - 1; j >= 0; j--) {
      // b[j]
      const bj = bdata[j][0] || 0
      // x[j]
      let xj

      if (!equalScalar(bj, 0)) {
        // value at [j, j]
        const vjj = mdata[j][j]

        if (equalScalar(vjj, 0)) {
          // system cannot be solved
          throw new Error('Linear system cannot be solved since matrix is singular')
        }

        xj = divideScalar(bj, vjj)

        // loop rows
        for (let i = j - 1; i >= 0; i--) {
          // update copy of b
          bdata[i] = [subtractScalar(bdata[i][0] || 0, multiplyScalar(xj, mdata[i][j]))]
        }
      } else {
        // zero value at j
        xj = 0
      }
      // update x
      x[j] = [xj]
    }

    return new DenseMatrix({
      data: x,
      size: [rows, 1]
    })
  }
Finds one solution of a linear equation system by backward substitution. Matrix must be an upper triangular matrix. Throws an error if there's no solution.

`U * x = b`

Syntax:

   math.usolve(U, b)

Examples:

   const a = [[-2, 3], [2, 1]]
   const b = [11, 9]
   const x = usolve(a, b)  // [[8], [9]]

See also:

   usolveAll, lup, slu, usolve, lusolve

@param {Matrix, Array} U       A N x N matrix or array (U)
@param {Matrix, Array} b       A column vector with the b values

@return {DenseMatrix | Array}  A column vector with the linear system solution (x)