# LU decomposition with row pivoting

Okay so consider a matrix $$A = \left( \begin{array}{ccc} 0 & 1 & 1 \\ 1 & -2 & -1 \\ 1 & -1 & 1 \end{array} \right)$$ so obviously to get the upper and lower traiangular matrix for LU factorization I first pivot and then eliminate so I get $$A = \left( \begin{array}{ccc} 1 & -2 & -1 \\ 0 & 1 & 1 \\ 1 & -1 & 1 \end{array} \right)$$ then making everything 0 under the diagonal I get the following

$$U = \left( \begin{array}{ccc} 1 & -2 & -1 \\ 0 & 1 & 1 \\ 0 & 0 & 1 \end{array} \right)$$ and $$L = \left( \begin{array}{ccc} 1 & 0 & 0 \\ 0 & 1 & 0\\ 1 & 1 & 1 \end{array} \right)$$

Then since we pivoted we also get a permutation matrix $P$ $$P = \left( \begin{array}{ccc} 0 & 1 & 0 \\ 1 & 0 & 0 \\ 0 & 0 & 1 \end{array} \right)$$

But if I try to go back using $A = P^TLU = (P^{-1}L)U$ I do not get my original matrix back. Note: the question is only asking to find the permutation matrix. I got the right permutation matrix and it matches the answer at the back of the book but I have a feeling I am just getting lucky.

-
"I do not get my original matrix back." - really? Could you show your multiplication and the result? – J. M. Dec 7 '11 at 4:37
My mistake. How do iclose this without marking an answer – Tyler Hilton Dec 7 '11 at 4:50
There should be a delete link below your question and above the comments. – J. M. Dec 7 '11 at 4:51

You considered the matrix $A$
$$A = \left( \begin{array}{ccc} 0 & 1 & 1 \\ 1 & -2 & -1 \\ 1 & -1 & 1 \end{array} \right)$$ and you multiplied by the matrix $P$ to get $$PA = \left( \begin{array}{ccc} 1 & -2 & -1 \\ 0 & 1 & 1 \\ 1 & -1 & 1 \end{array} \right)$$
Your computations for $A$, $P$, $L$ and $U$ are right. Since $P = P^T = P^{-1}$ these are all the same. Computing the product $LU$ and $PA$ gives the same answer. I don't know what went wrong with your things.