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

I found some examples of Mathematica's commands usage in an old manual but the program gives me different result than expected

Expand[Cos[x]^3 Sin[x]^2, Trig -> True]

should give

Cos[x]/8 - Cos[3x]/16 - Cos[5x]/16

but returns an unaltered expression.

I tried out Expand with Sin[x+y] added to the expression, factored that and then I get what I expected in the first place. Why is that? I am surprised because I found that example in a book about Mathematica at my university's library. Although the book is from 1991 I don't think an unaltered expression is what Expand should return. Am I wrong?

share|improve this question

migrated from Apr 20 '12 at 0:46

This question came from our site for people studying math at any level and professionals in related fields.

What was the version of Mathematica ? – Artes Dec 30 '12 at 21:49
up vote 15 down vote accepted

The function you want for this kind of case is TrigReduce:

rewrites products and powers of trigonometric functions in expr in terms of trigonometric functions with combined arguments.

And it works:

enter image description here

share|improve this answer

Expand doesn't work as you'd like even with Trig -> True. TrigReduce yields the experssion a bit different than expected. Instead, you can use Apart with the option Trig therein (by default Options[Apart, Trig] yields {Trig -> False}) to get exactly the expected output, e.g. :

Apart[ Cos[x]^3 Sin[x]^2, Trig -> True]
Cos[x]/8 - 1/16 Cos[3 x] - 1/16 Cos[5 x]

exploiting your approach one could do this :

Unevaluated[ Expand[ Cos[x]^3 Sin[x]^2, Trig -> True]] /. Expand -> Apart


(Expand /. Expand -> Apart)[Cos[x]^3 Sin[x]^2, Trig -> True]

another ways use both Apart or Expand composed with TrigToExp and its "inverse" ExpToTrig :

ExpToTrig @ Apart @ TrigToExp[ Cos[x]^3 Sin[x]^2]


ExpToTrig @ Expand @ TrigToExp[ Cos[x]^3 Sin[x]^2]


Let's write all functions with the Trig option :

Select[ Names["*"], ( Length[ Quiet[ Options[ ToExpression @ #, Trig]]] == 1) &]
 {"Apart", "ApartSquareFree", "Cancel", "Collect", "Denominator", "Expand",     
  "ExpandAll", "ExpandDenominator", "ExpandNumerator", "Exponent", "Factor", 
  "FactorList", "FactorSquareFree", "FactorSquareFreeList", "FactorTerms", 
  "FactorTermsList", "FullSimplify", "Numerator", "PolynomialGCD",
  "PolynomialLCM", "PolynomialMod", "Simplify", "Together"}

For their default settings :

{#, Quiet[ Options[ ToExpression @ #, Trig]]} & /@ %
share|improve this answer
Brilliant. I did not know Apart had that option, +1. – rcollyer Oct 27 '12 at 19:32
@rcollyer Thanks ! – Artes Oct 27 '12 at 19:49

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.