# Symbolic derivation of LU

I've been needing to derive some LU factorizations by hand, analytically, and i was wondering if anyone knew if it were possible to get Mathematica to do this symbolically so that I may be able to check my work.

• does LUDecomposition[Array[Subscript[a, ##] &, {3, 3}]] give what you need? – kglr Jun 6 '19 at 8:08
• It is not clear what is meant by "analytically". This is an algorithm at play and it would not readily be expressed as a closed-form formula. – Daniel Lichtblau Jun 6 '19 at 16:34

There is a function for this in Mathematica: https://reference.wolfram.com/language/ref/LUDecomposition.html

All their examples are numerical, but it works symbolically as well.

ClearAll[a1,a2,a3,b1,b2,b3,c1,c2,c3]
m = {{a1, a2, a3}, {b1, b2, b3}, {c1, c2, c3}};
MatrixForm[m]


{lu, p, c} = LUDecomposition[m];
l = lu SparseArray[{i_, j_} /; j < i -> 1, {3, 3}] + IdentityMatrix[3];
u = lu SparseArray[{i_, j_} /; j >= i -> 1, {3, 3}];

MatrixForm[l]
MatrixForm[u]


And if you multiply them together, you get the original matrix back:

MatrixForm[l.u]


• The computation tacitly assumes none of the divisors are zero. (BTW, have you see this sort of thing: lsf = LinearSolve[m]; {lsf@"getU", lsf@"getL"}? – Michael E2 Jun 6 '19 at 20:47