Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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)]
share|improve this question
Simplify[Cos[t w - t z]] – R. M. Feb 3 '13 at 0:22
up vote 1 down vote accepted

You need to Map it:

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

Or with infix notation:

Factor /@ Cos[t w - t z]
share|improve this answer
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]] – VF1 Feb 3 '13 at 0:57
Thanks @VF1, that is the general question i was trying to address – AimForClarity Feb 5 '13 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.

share|improve this answer

Your Answer


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.