# Row-Reduced-Echelon-Form with Equation Parameters for Consistent Systems

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

• 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

## 2 Answers

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.

%/.a->4
{0, 0, 0, -108}


Start with:

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


Which gives the result:

$$\begin{bmatrix} 1 & 2 & 3 & a\\ 4 & 5 & 6 & a^2\\ 7 & 8 & 9 & a^3 \end{bmatrix}$$

Then:

r1 = A[];
r2 = A[];
r3 = A[];


Then:

MatrixForm[A = {r1, r2 - 4 r1, r3 - 7 r1}]


Which gives the result:

$$\begin{bmatrix} 1 & 2 & 3 & a\\ 0 & -3 & -6 & -4a+a^2\\ 0 & -6 & -12 & -7a+a^3 \end{bmatrix}$$

Then:

r1 = A[];
r2 = A[];
r3 = A[];


And finally:

MatrixForm[A = {r1, r2, r3 - 2 r2}] // Simplify


Which gives the result:

$$\begin{bmatrix} 1 & 2 & 3 & a\\ 0 & -3 & -6 & -4a+a^2\\ 0 & 0 & 0 & (-1+a)^2a \end{bmatrix}$$