# Why doesn't Mathematica expand Cos[x]^3 Sin[x]^2?

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?

-

## migrated from math.stackexchange.comApr 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

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

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

And it works:

-

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


or

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


or

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


Edit

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]]} & /@ %

-
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