# Factor inside argument

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]]


gives

 Cos[t w - t z]


but i would like it to give:

 Cos[t(w - z)]

-
Simplify[Cos[t w - t z]] –  rm -rf Feb 3 at 0:22

You need to Map it:

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


Or with infix notation:

Factor /@ Cos[t w - t z]

-
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 at 0:57
Thanks @VF1, that is the general question i was trying to address –  AimForClarity Feb 5 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.

-