0
$\begingroup$

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.

$\endgroup$
  • 1
    $\begingroup$ does LUDecomposition[Array[Subscript[a, ##] &, {3, 3}]] give what you need? $\endgroup$ – kglr Jun 6 at 8:08
  • $\begingroup$ 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. $\endgroup$ – Daniel Lichtblau Jun 6 at 16:34
1
$\begingroup$

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]

enter image description here

{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]

enter image description here

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

MatrixForm[l.u]

enter image description here

$\endgroup$
  • $\begingroup$ 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"}? $\endgroup$ – Michael E2 Jun 6 at 20:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.