Why row reduce doesn't "act symbolically" on square matrices?

Suppose I do the following:

Now, If I compute:

Then "Mathematica stops being symbolic". Why does this happen? I want the computation to show matrix entries in terms of $$a,b,c,d$$, similar to the first example. Is it possible to do that?

• Hmm, yeah, I'm not even sure how Mathematica "knows" this. After all, what if b == e == 0? You'd hope the symbolic result would hold for all values of a, b, d, e, but it seems Mathematica's making some hidden assumptions at some point. Mar 25, 2021 at 22:57
• For that matter, why does MatrixRank[{{a, b}, {c, d}}] give 2... Mar 25, 2021 at 23:01
• What specific different result did you expect? Mar 25, 2021 at 23:56
• Symbolic computations in Mathematica are often generically correct, meaning that the results ignore excepts on a locus of codimension ≥ 1. Even the first result is wrong if b == 2 a. I don't really see a big difference between the two examples. Mar 26, 2021 at 0:56
• @murray No. That's not what it is designed to do. It works over the field of rational functions in the variables present. See also this previous MSE thread (for which the present thread is essentially a duplicate). See also this. And this too might be relevant. Mar 26, 2021 at 14:30

2 Answers

This gives the weird result in a comment that has nothing to do with the matrix {{a, b}, {d, e}} in the question:

LinearSolve[{{c, d}, {a, b}}]@"getU" // Together


• The matrix may be obtained from LUDecomposition[mat] as well. Mar 26, 2021 at 1:11
• This is really what I have been looking for! Could you explain what is the @getU? Mar 26, 2021 at 1:58
• @BillyRubina It gets the "U" matrix of the LU decomposition, which is the result of Gaussian elimination. The "U" stands for upper triangular matrix. Mar 26, 2021 at 2:05

And from the documentation for RowReduce: RowReduce performs a version of Gaussian elimination, adding multiples of rows together so as to produce zero elements when possible. The final matrix is in reduced row echelon form. If m is a non-degenerate square matrix, RowReduce[m] is IdentityMatrix[Length[m]].