5
$\begingroup$

I need to row-reduce the following matrix,

{{a, b, 0, 0, 0, 0, 0, 0, 1}, {0, 0, 0, 0, a1, b1, 0, 0, 1},
 {0, 0, c, d, 0, 0, 0, 0, 1}, {0, 0, 0, 0, 0, 0, c1 ,d1, 1}, 
 {0, b1, 0, -d1, a, 0, -c, 0, 0}, {-b1, 0, d1, 0, b, 0, -d, 0, 0}, 
 {0, -a1, 0, c1, 0, a, 0, -c, 0}, {a1, 0, -c1, 0, 0, b, 0, -d, 0}}

After Mathematica does the computation, the bottom row is a row of zeros. This is to be expected (based on my problem). However, the second to bottom row is a row of zeros with a 1 at the end. When the algebra is done "by hand", one really should obtain a row of zeros with some linear combination of the variables involved instead of 1. Mathematica divides by this expression. This expression could be zero, and in my problem, I want that last matrix entry to be zero. How can I tell Mathematica not to simplify?

If you be kind,can you also upload the answer you are getting, so I can double-check with mine?

$\endgroup$
  • $\begingroup$ From what you write it seems likely that you have given values to the variables in question at some time previous to your matrix calculation. You should clear those variables before making the computation. $\endgroup$ – m_goldberg Jul 1 '17 at 6:30
  • $\begingroup$ When the algebra is done "by hand" Can you show the hand solution then which is different from Mathematica solution? $\endgroup$ – Nasser Jul 1 '17 at 7:05
  • $\begingroup$ @Nasser Yes. Set a = a1 = 1, b = b1 = 0, c = c1 = 0, d = d1 = 1. Get a different answer. Mathematica makes a mistake because it divides by zero in the general variable case. $\endgroup$ – Donald Trump Jul 1 '17 at 7:09
  • 1
    $\begingroup$ I am not sure I understand. But you can try (RowReduce[mat, ZeroTest -> (PossibleZeroQ[Simplify[#]] &)]) // MatrixForm if you want to see the content not simplified. But your question is not clear. Are you saying the second row from the bottom is supposed to be all zeros and not have 1 as it last entry? $\endgroup$ – Nasser Jul 1 '17 at 7:14
  • 1
    $\begingroup$ I do not think it is possible to tell M that x/x is not 1 when x is symbol with no value. At least I do not know how to do it. Assuming[x == 0, Simplify[x/x]] gives 1 always. I think the front end replaces x/x by 1 before the kernel even gets hold of it. But I am not sure. $\endgroup$ – Nasser Jul 1 '17 at 7:37
1
$\begingroup$

You can choose a different ZeroTest option:

RowReduce[
    {
    {a,b,0,0,0,0,0,0,1},
    {0,0,0,0,a1,b1,0,0,1},
    {0,0,c,d,0,0,0,0,1},
    {0,0,0,0,0,0,c1,d1,1},
    {0,b1,0,-d1,a,0,-c,0,0},
    {-b1,0,d1,0,b,0,-d,0,0},
    {0,-a1,0,c1,0,a,0,-c,0},
    {a1,0,-c1,0,0,b,0,-d,0}
    },
    ZeroTest->PossibleZeroQ
] //TeXForm

$\left( \begin{array}{ccccccccc} 1 & 0 & 0 & 0 & 0 & \frac{b}{\text{a1}} & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 & 0 & -\frac{a}{\text{a1}} & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 & 0 & 0 & 0 & \frac{d}{\text{c1}} & 0 \\ 0 & 0 & 0 & 1 & 0 & 0 & 0 & -\frac{c}{\text{c1}} & 0 \\ 0 & 0 & 0 & 0 & 1 & \frac{\text{b1}}{\text{a1}} & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 1 & \frac{\text{d1}}{\text{c1}} & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & \text{a1} \text{c1} (\text{b1} c (\text{a1} b c \text{c1}-a \text{a1} \text{c1} d)-c (a \text{a1} d-\text{a1} b c) (\text{a1} \text{d1}-\text{b1} \text{c1}))-\text{a1}^2 c (\text{a1} b c \text{c1}-a \text{a1} \text{c1} d) \text{d1} & 1 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & \text{a1} \text{c1} \left(b \text{b1} c^2 (\text{a1} b c \text{c1}-a \text{a1} \text{c1} d)-c (a \text{a1} d-\text{a1} b c) (a \text{a1} d \text{d1}-b \text{b1} c \text{c1})\right)-a \text{a1}^2 c d (\text{a1} b c \text{c1}-a \text{a1} \text{c1} d) \text{d1} & 0 \\ \end{array} \right)$

$\endgroup$

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.