Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I often do row-reduced-echelon-form (RREF) calculations that involve parameters using the RowReduce command.

Most times, I want to know which parameters make the system consistent.

For example:

 RowReduce[{{1, 2, 3, a}, {4, 5, 6, a^2}, {7, 8, 9, a^3}}]

Mathematica reduces this to its lowest form, which results in an inconsistent system because the last row is {0,0,0,1}.

However, if you look at the details of the the steps it takes (using WA with rref {{1, 2, 3, a}, {4, 5, 6, a^2}, {7, 8, 9, a^3}}), it shows the point where you could see that choosing $a = 0$ or $a = 1$ would produce a consistent system with infinite solutions. Either of these values for $a$ makes the last row of the rref {0,0,0,0}.

Is there a way to get Mathematica to show this reduction without losing that important fact or to state which values of the parameters make the system consistent? Maybe I should be using a different command or approach.

It is also interesting that rref is able to successfully find the result for this two parameter example:

 RowReduce[{{a, b, 1, 1},{1, a b, 1, b},{1, b, b, 1}}]
share|improve this question
Quick remark: If you hit the matrix with` LUDecomposition` you will see a relevant matrix element (row 3, col 4) with zeros of a=0 and a=1. Not sure how general or reliable this germ of an idea might be though. – Daniel Lichtblau Oct 4 '13 at 14:25
@DanielLichtblau: I will give it a go, thank you for the hint! Regards – Amzoti Oct 4 '13 at 14:32
This should give useful info: Reduce[{{1, 2, 3, a}, {4, 5, 6, a^2}, {7, 8, 9, a^3}}.{x, y, z, w} == {0, 0, 0}, {x, y, z, w}] – Daniel Lichtblau Oct 4 '13 at 15:23
up vote 3 down vote accepted

Too long for a comment:

Putting in a check for a in the ZeroTest lets Mathematica be aware that it can be zero sometimes:

RowReduce[{{1, 2, 3, a}, {4, 5, 6, a^2}, {7, 8, 9, a^3}}, 
  ZeroTest -> (! FreeQ[#, a] || PossibleZeroQ[#] &)
  ] //Last // Simplify
(* {0, 0, 0, -3 (-1 + a)^2 a} *)

But note that it doesn't get normalized down to 1 in cases when it's non-zero, so it's no longer in echelon form.

{0, 0, 0, -108}
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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