Mathematica automatically evaluates Sin and Cos when TrigReduce is applied. For example, TrigReduce[Cos[2*t]*Cos[2*t]] results in 1/2 (1 + Cos[4 t]). In my application I would like TrigReduce to keep the Sin and Cos as is. I'd like to have 1/2 (Cos[0 t] + Cos[4 t]) as the output of the preceding example. I tried to use Inactivate, but that seems to prevent TrigReduce from working as well.

  • $\begingroup$ I have thousands of large expressions that needed to trigReduce. Finding the patterns is nearly impossible. The only way(except writing my own TrigReduce functions) I can think of is to prevent it from evaluating the terms. $\endgroup$
    – cqd123123
    Commented Nov 22, 2020 at 0:14
  • 3
    $\begingroup$ Can you replace Cos with myCos, use TrigReduce, then replace myCos with Cos ? $\endgroup$
    – LouisB
    Commented Nov 22, 2020 at 1:12
  • 5
    $\begingroup$ Best would be to write a targeted function for this specific purpose. $\endgroup$ Commented Nov 22, 2020 at 1:42

1 Answer 1


There is one way:

    expr1 = Cos[2*t]^2 /. Cos[2 t]^2 :> Cos[(2 + x)*t]*Cos[2 t]

(*  Cos[2 t] Cos[t (2 + x)]   *)


expr2 = TrigReduce@expr

(*   1/2 (Cos[2 t - t (2 + x)] + Cos[2 t + t (2 + x)])  *)

Now we can simplify the subexpressions under the Cos sighs, and replace tx by HoldForm[0] and x - by 0:

MapAt[Simplify, expr2, {{2, 1, 1}, {2, 2, 1}}] /. 
  t x -> HoldForm[0] /. x -> 0


enter image description here

I have no idea how your other terms look like. Therefore, I cannot garanty that it will work for the whole your complex expression. However, you can try to invent something along this line.

Please do not forget that HoldForm[0] cannot be operated by Mma functions. If you need to further operate with the result, apply first ReleaseHold.

Have fun!


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.