def back_substitute(u, s)
			raise 'u must be an upper triangular matrix' unless u.upper_triangular?

			x = Array.new s.row_size

			(x.size - 1).downto 0 do |i|
				x[i] = s[i, 0]

				(i + 1).upto(x.size - 1) do |j|
					x[i] -= u[i, j] * x[j]
				end

				x[i] /= u[i, i]
			end

			Matrix.column_vector x
		end
def back_substitute(u, s)
			raise 'u must be an upper triangular matrix' unless u.upper_triangular?

			x = Array.new s.row_size

			(x.size - 1).downto 0 do |i|
				x[i] = s[i, 0]

				(i + 1).upto(x.size - 1) do |j|
					x[i] -= u[i, j] * x[j]
				end

				x[i] /= u[i, i]
			end

			Matrix.column_vector x
		end
Solve equation of form [u][x] = [s] for [x]
 u must be a upper triangular matrix.