1
$\begingroup$
m = {{2, 6, 4}, {2, 6, 5}, {-3, 6, 6}};

Consider I'm doing calculation by hand.

I want to collect the multiple 6 of second column, how to do that?

I'd like the result something like the following. The main purpose is to show the solution steps(in Notebook or Latex)

$$\begin{align*}det(m)=6~det\left(\begin{array}{ccc} 2& 1 & 4 \\ 2 & 1 & 5 \\ -3 & 1 & 6 \\\end{array}\right);\end{align*}$$

Maybe something collect[m] function, and generate all possible results?

or

$$\begin{align*}det(m)=2~det\left(\begin{array}{ccc} 1 & 3& 2\\ 2 & 6& 5 \\ -3 & 6& 6 \\\end{array}\right);\end{align*}$$

$\endgroup$
6
  • $\begingroup$ @Nasser Maybe something collect[m] function, and generate all possible results? $\endgroup$ Commented Aug 29, 2013 at 14:16
  • 2
    $\begingroup$ Do you know how to multiply matrices by scalars? Your expectation is not compatibile with standard conventions but rather completely unnatural. $\endgroup$
    – Artes
    Commented Aug 29, 2013 at 14:22
  • 1
    $\begingroup$ @Artes multiply matrices is not the same as multiply a determinant? $\endgroup$ Commented Aug 29, 2013 at 14:24
  • $\begingroup$ @Nasser sorry, I need your comments, they are useful to improve my question. $\endgroup$ Commented Aug 29, 2013 at 14:24
  • 1
    $\begingroup$ @HyperGroups If you need a determinant you should explicitely write $det(matrix)$ $\endgroup$
    – Artes
    Commented Aug 29, 2013 at 14:26

1 Answer 1

6
$\begingroup$

in two steps:

m={{1,6,4},{2,6,5},{-3,6,6}};
MatrixForm[Apply[Times,GCD@@@m]] * MatrixForm[rm= (#/GCD@@#)&/@m ]
MatrixForm[Apply[Times,GCD@@@Transpose[rm]]] * MatrixForm[Transpose[(#/GCD@@#)&/@Transpose[rm]] ]

in one step:

MatrixForm[Apply[Times,GCD@@@m]  *
 Apply[Times,GCD@@@Transpose[(#/GCD@@#)&/@m]]] * MatrixForm[Transpose[(#/GCD@@#)&/@Transpose[(#/GCD@@#)&/@m] ]]
$\endgroup$
1
  • $\begingroup$ Welcome to SE! GCD is a good idea. $\endgroup$ Commented Aug 29, 2013 at 14:48

Your Answer

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

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