title: (IndexError) Back Substitution for n x n Matrix
body: <p>I trying to implement Back-Substitution using Python, solving <strong>x</strong> from <strong>Lx = b</strong> but I got Error.</p>
  
  <p>And I don't know how I can make iterations to know what is wrong.</p>
  
  <p>Am I misunderstanding a concept?</p>
  
  <pre><code>import numpy as np
  def backSub(L: np.ndarray, b: np.ndarray)-&gt; np.ndarray:
      length = len(L)
      x = np.zeros(length)
      for k in range(length - 1, -1, -1):
          x[k] = (b[k] - np.dot(L[k, k + 1:], x[k + 1:])) / L[k, k]
  
      return x
  
  
  M = np.array([[2, 0,0],
               [1, 3, 0],
               [2, 3, 4]])
  
  s = np.array([[2, 2, 0]])
  
  print(backSub(M, s))
  </code></pre>
  
  <p>when I run my Programm, I got this:</p>
  
  <p><strong>Output</strong></p>
  
  <pre><code>x[k] = (b[k] - np.dot(L[k, k + 1:], x[k + 1:])) / L[k, k]
  IndexError: index 2 is out of bounds for axis 0 with size 1
  </code></pre>
  
  <p><strong>expected Output</strong></p>
  
  <p>Just a Vector <strong>x</strong> from **L x = b **</p>