Linear Algebra with Sage

<Reduced Row Echelon Form>

Made by SKKU Linear Algebra Lab (2011)

Solve following LSE using RREF.

$\left\{ \begin{array}{ll} y+2z=9\\ 5x+10y-15z=1\\ 3x+6y-8z=0 \end{array}\right.$

<There are 3 cases : Unique solution, Infinitely many solutions, No solution>

(?쇰컲?곸쑝濡?二쇱뼱吏??됰젹??REF ?먮뒗 RREF 瑜?援ы븳 ?? ?꾩쓽 3媛吏 寃쎌슦 以??대뒓 寃쎌슦?몄?瑜??쎄쾶 ?뚯븙???? 寃쎌슦???곕씪 ?닿껐?섎㈃ ?쒕떎.)

First, we do find REF or RREF of a given matrix.

Define matrices (怨꾩닔?됰젹怨??곸닔?됰젹 ?앹꽦 諛??뺤씤)

 A=matrix(QQ,[[0,1,2],[5,10,-15],[3,6,-8]]) v=matrix(3,1,[9,1,0]) print A print v

[  0   1   2]

[  5  10 -15]

[  3   6  -8]

[9]

[1]

[0]

Make a augmented matrix (泥④??됰젹 ?앹꽦)

 Av=A.augment(v);Av

[  0   1   2   9]

[  5  10 -15   1]

[  3   6  -8   0]

ERO: $R_1 \leftrightarrow R_2$

 Av.swap_rows(0,1);Av # 1?됯낵 2?됱쓣 諛붽씔??

[  5  10 -15   1]

[  0   1   2   9]

[  3   6  -8   0]

ERO: $\frac{1}{5} R_1 \rightarrow R_1$

 Av.rescale_row(0,1/5);Av # 1?됱뿉 1/5諛곕? ?쒕떎.

[  1   2  -3 1/5]

[  0   1   2   9]

[  3   6  -8   0]

ERO: $R_3 - 3 R_1 \rightarrow R_3$

 Av.add_multiple_of_row(2,0,-3);Av # 1?됱뿉 -3諛곕? ???ㅼ쓬 3?됱뿉 ?뷀븳??

[   1    2   -3  1/5]

[   0    1    2    9]

[   0    0    1 -3/5]

Find an echelon form of matrix (REF ?먮뒗 RREF 援ы븯湲?

 Av.echelon_form() # 二쇱뼱吏??됰젹 Av媛 ZZ濡??뺤쓽?섎㈃ REF瑜?蹂댁뿬二쇨퀬, QQ濡??뺤쓽?섎㈃ RREF瑜?蹂댁뿬以??

[   1    0    0  -22]

[   0    1    0 51/5]

[   0    0    1 -3/5]

Find a RREF of matrix (RREF 援ы븯湲?

 Av.rref() # 二쇱뼱吏??됰젹 Av???뺤쓽(ZZ, QQ)????곴??놁씠 RREF瑜?蹂댁뿬以??

[   1    0    0  -22]

[   0    1    0 51/5]

[   0    0    1 -3/5]

Then, If Case 1(Unique solution): RREF$(A)=I$,

Solve the LSE using inverse matrix (紐낅졊?대? ?댁슜??LSE????援ы븯湲?

 A\v # A.inverse()*v

[ -22]

[51/5]

[-3/5]

If Case 2 and 3(Infinitely many solutions, No solution): RREF$(A)\neq I$,