3
$\begingroup$

When I compute the determinant analytically in Mathematica, I do it with

Det[{{a, b}, {c, d}}]

which gives the output

-b c + a d

I would like to see this formula even if the determinant is zero as

Det[{{a, b}, {-a, -b}}]

which yields the output

0

instead of something like

-b (-a) + a (-b)

This is just a small example, but my matrices are a little larger, and I need to figure out analytically why some determinants are zero and some are not.

Any ideas?

$\endgroup$

2 Answers 2

9
$\begingroup$

One possibility is to temporarily inactivate the arithmetic operators, like so:

Block[{Times = Inactive[Times], Plus = Inactive[Plus]}, 
      Det[{{a, b}, {-a, -b}}]]
   a*(-1*b)+-1*b*(-1*a)
$\endgroup$
3
$\begingroup$

You could try:

m = {{a, b}, {-a, -b}};

Det[Map[ToBoxes, m, {2}]] // DisplayForm
(* -b (-a)+a (-b) *)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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