I would like some clarification on the lu(A) function. A = [1, -1, 2; 3, -1, 7; 2, -4, 5] which is invertible and LU-factorable without row interchange, so the LU matrices should be unique. By hand, I get L = [1, 0, 0; 3, 1, 0; 2, -1, 1] and U = [1, -1, 2; 0, 2, 1; 0, 0, 2], but why do I get the following results? First, the L isn't lower triangular, and second one there is a permutation matrix while A can be made row-echelon without row interchange? What can't I get A = L*U with L in the 'right' format, instead of P*A = L*U. A = 1 -1 2 3 -1 7 2 -4 5 >> [l, u] = lu(A) l = 0.33333 0.20000 1.00000 1.00000 0.00000 0.00000 0.66667 1.00000 0.00000 u = 3.00000 -1.00000 7.00000 0.00000 -3.33333 0.33333 0.00000 0.00000 -0.40000 >> [l, u, p] = lu(A) l = 1.00000 0.00000 0.00000 0.66667 1.00000 0.00000 0.33333 0.20000 1.00000 u = 3.00000 -1.00000 7.00000 0.00000 -3.33333 0.33333 0.00000 0.00000 -0.40000 p = Permutation Matrix 0 1 0 0 0 1 1 0 0