title: Wrong solution of a linear equation, or why does A*(A\B) not equal B?
body: <p>How is it possible that the result of <code>A*(A\D)</code> below is not equal to <code>D</code> ?</p>
  
  <p><img src="https://i.stack.imgur.com/3au2X.jpg" alt="enter image description here"></p>
  
  <p>It should yield <code>D</code> - here is an extract of the Octave documentation :</p>
  
  <blockquote>
    <p>Systems of linear equations are ubiquitous in numerical analysis. To
    solve the set of linear equations Ax = b, use the left division
    operator, ‘\’: x = A \ b</p>
  </blockquote>
  
  <p>Below is the code for those who want to try it:</p>
  
  <pre><code>A = [1,1,1;0,0,0;2,1,2;2,1,2;3,5,6]
  D = [1;2;3;4;5]
  % A is of rank 3:
  rank(A)
  % therefore the system Ax=D has a unique solution
  x = A\D
  % but Octave has not given the good solution:
  A*x
  </code></pre>
  
  <p>Somebody says me that Matlab yields exactly the same result.</p>
  
  <p><strong>EDIT 10/10/2012:</strong> After having read the answers, let me point where I did a serious mistake: the claim <em>"A is of rank 3 therefore the system Ax=D has a unique solution"</em> is absolutely wrong ! By the way the piece of documentation shown above is quite disconcerting. </p>