What you want to do is row reduce the matrix and keep track of your steps along the way. For example if you wanted to perform 3(Row1)+R3 to a matrix A, then you represent that by
<br />
E=\begin{pmatrix}<br />
1&0&3 \\<br />
0&1&0 \\<br />
0&0&1 <br />
\end{pmatrix}<br />
A
So make a matrix like that for each on of your steps; then if we call U your completely reduced matrix, then your original matrix, call it O is, O=LU where L=E_1^{-1}E_2^{-1} \cdots E_n^{-1}. Hope that helps.