Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.
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*}$$

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

1 Answer 1

up vote 6 down vote accepted

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] ]]
share|improve this answer
    
Welcome to SE! GCD is a good idea. –  HyperGroups Aug 29 '13 at 14:48

Your Answer

 
discard

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.