LU Decomposition of a matrix $A$. I'm supposed to compute the L,U factors s.t. A = LU.
A = \begin{bmatrix}
0.1  & 1 \\
1 & 1 \\ 
\end{bmatrix}
I get solutions that require a permutation matrix but can't seem to solve one without it... Any hints?
L = \begin{bmatrix}
1 & 0 \\
.1 & 1 \\ 
\end{bmatrix}
U = \begin{bmatrix}
1  & 1 \\
0 & .9 \\ 
\end{bmatrix}
P = \begin{bmatrix}
0  & 1 \\
1 & 0 \\ 
\end{bmatrix}
Edit: I've tried solving this by hand, and other things. I also threw it into MatLab's lu function. And the result doesn't fit the definition of what a Lower/Upper matrix is.
Matlab gave: (which is essentially L = PL from above)
L = \begin{bmatrix}
.1 & 1 \\
1 & 0 \\ 
\end{bmatrix}
U = \begin{bmatrix}
1  & 1 \\
0 & .9 \\ 
\end{bmatrix}
 A: MATLAB yields the following results for the following code, which does indeed fit the traditional definition:
[L,U,P]=lu([0.1 1; 1 1])

L =

    1.0000         0
    0.1000    1.0000


U =

    1.0000    1.0000
         0    0.9000


P =

     0     1
     1     0

If you call lu without the third output argument, what you get is $P^{-1}L$. It turns out that $P^{-1} = P$, but in general, what MATLAB is doing is the "LU factorization with partial pivoting".
In other words, sometimes we want to find $L$ and $U$ such that $A=LU$, but the general algorithm might require permutations in both rows and columns of $A$, so we're really computing $PAQ=LU$.
Instead, we can compute $PA=LU$ with only row (or column, but not both) permutations. If we multiply over by $P^{1}$, we get $A = P^{-1}LU$, which is what MATLAB will give you with the optional third output argument.
In practice, it doesn't really matter, as long as you get your solution. The decomposition is unique up to pivoting, so you can pivot your lower and upper triangular matrices until they're not in the canonical upper/lower triangular form, but you still get the desired properties.
