I am trying to solve the exercise RREF.C10 from the A first course in Linear Algebra free book.
The exercise aims at finding the reduced row echelon form of the following linear system:
$\begin{align*} 2x_1-3x_2+x_3+7x_4&=14\\ 2x_1+8x_2-4x_3+5x_4&=-1\\ x_1+3x_2-3x_3&=4 \\ -5x_1+2x_2+3x_3+4x_4&=-19 \end{align*}$
After attempting a solution on paper, I looked for the solution with Sage:
C10A = matrix([[2,-3,1,7],[2,8,-4,5],[1,3,-3,0],[-5,2,3,4]])
C10b = vector([14,-1,4,-19])
C10M = C10A.augment(C10b, subdivide=True)
C10M
C10A.echelon_form()
C10M.echelon_form()
with the following outcome:
[ 2 -3 1 7| 14]
[ 2 8 -4 5| -1]
[ 1 3 -3 0| 4]
[ -5 2 3 4|-19]
[ 1 0 0 273]
[ 0 1 0 315]
[ 0 0 1 406]
[ 0 0 0 479]
[ 1 0 0 273 274]
[ 0 1 0 315 312]
[ 0 0 1 406 402]
[ 0 0 0 479 479]
Unfortunately the reported solution from the book is very different:
\begin{equation*} \begin{bmatrix} 1 & 0 & 0 & 0 & 1\\ 0 & 1 & 0 & 0 & -3\\ 0 & 0 & 1 & 0 & -4\\ 0 & 0 & 0 & 1 & 1 \end{bmatrix} \end{equation*}
I wonder what causes this discrepancy. Is Sage's implementation broken? Or is it just the solution from the book that is broken?
Moreover, why isn't Sage multiplying the last row for $\frac{1}{479}$ in order to have a leading $1$?
Setting explicitly the type of the numbers to rationals (
QQ), actually solved the problem, giving the unique reduced row echelon form, instead of just one row echelon form: