How do you use Factor so that it will factor expressions inside the arguments of some bigger expression.

For example

 Factor[ Cos[t w - t z]]


 Cos[t w - t z]

but i would like it to give:

 Cos[t(w - z)]
  • $\begingroup$ Simplify[Cos[t w - t z]] $\endgroup$
    – rm -rf
    Feb 3, 2013 at 0:22

2 Answers 2


You need to Map it:

Map[Factor, Cos[t w - t z]]

Or with infix notation:

Factor /@ Cos[t w - t z]
  • $\begingroup$ For more complicated expressions, MapAll may prove useful, working on all levels: compare Factor //@ Cos[t w - t z + Sin[a x + a y]] to Factor /@ Cos[t w - t z + Sin[a x + a y]] $\endgroup$
    – VF1
    Feb 3, 2013 at 0:57
  • $\begingroup$ Thanks @VF1, that is the general question i was trying to address $\endgroup$ Feb 5, 2013 at 2:17

You want to use Collect instead of Factor.

Cos[Collect[t w - t z, t]]

This gives:

Cos[t (w - z)]

Hope it helps.


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.