Consider the following integral:

Integrate[(Sin[x] + Cos[x])^a Sin[x]^b Cos[x]^c, x]

On my system Mathematica 11 just returns the input back, which suggests that this integral does not appear in the database.

However, if we add definite boundaries to the integral:

Integrate[(Sin[x] + Cos[x])^a Sin[x]^b Cos[x]^c, {x, 0, Pi/2}]

all of a sudden the integral evaluates to a bunch of hypergeometric functions.

How can this be? If Mathematica does not know the indefinite integral, how can it obtain the definite one? Is it possible to still somehow extract the indefinite integral from Mathematica?

  • 1
    $\begingroup$ Are b and c nonnegative integers? $\endgroup$
    – Carl Woll
    Commented Jan 17, 2018 at 21:02
  • 1
    $\begingroup$ Some definite integrals can be evaluated without the fundamental theorem of calculus. Some techniques are usually taught in a first course on complex analysis. $\endgroup$
    – Michael E2
    Commented Jan 17, 2018 at 21:14
  • $\begingroup$ @CarlWoll b,c are complex numbers. But if something non-trivial can be said about the integer case, I would be very interested in that as well! $\endgroup$
    – Kagaratsch
    Commented Jan 17, 2018 at 21:15
  • $\begingroup$ @MichaelE2 Yes, I am familiar with residues, but I can't see any residues in this example. Perhaps you know how to apply complex analysis in this case? I'd be very interested to know! $\endgroup$
    – Kagaratsch
    Commented Jan 17, 2018 at 21:16
  • 1
    $\begingroup$ for b=0 MMA 11.2 spit enormous expression with AppellF1 function $\endgroup$ Commented Jan 17, 2018 at 21:54

2 Answers 2


The main problem arises from the a.

Restricting the a - values to positive integers, you can get a solution for the indefinite integral with arbitrary b and c.

Write the a-term as binomial sum and multiply with the b-term and c-term:

g[x_, a_, b_, c_] := 
       Sum[Binomial[a, k] Sin[x]^(k + b) Cos[x]^(a - k + c), {k, 0, a}]

General solutions for the sincos-term

sincos = Integrate[Sin[x]^(k + b) Cos[x]^(a - k + c), x]

(*   -((Cos[x]^(1 + a + c - k) Hypergeometric2F1[1/2 (1 - b - k), 1/2 (1 + a + c - k), 
         1/2 (3 + a + c - k), Cos[x]^2] Sin[x]^(1 + b + k) (Sin[x]^2)^(
         1/2 (-1 - b - k)))/(1 + a + c - k))   *)

The desired integral is then

int[x_, a_, b_, c_] := Sum[Binomial[a, k] sincos, {k, 0, a}]

For the case where b and c are nonnegative integers, you could do the following:

f[d_, e_, n_] = Integrate[(d Sin[x] + e Cos[x])^n, x];

int[a_, b_Integer?NonNegative, c_Integer?NonNegative] := Simplify[
    Derivative[b, c, 0][f][1, 1, a+b+c]/Pochhammer[a+1, b+c]

For example:

r = int[3,2,1];
r //TeXForm

$\frac{(\sin (x)+\cos (x)) \left(\sqrt{\sin (2 x)+1} (15 \sin (x)-7 \sin (3 x)-17 \cos (x)-3 \cos (3 x)+2 \cos (5 x))-24 \sin ^{-1}\left(\cos \left(x+\frac{\pi }{4}\right)\right)\right)}{96 \sqrt{\sin (2 x)+1}}$


D[r, x] //Simplify

Cos[x] Sin[x]^2 (Cos[x] + Sin[x])^3

  • $\begingroup$ Interesting approach in that case! $\endgroup$
    – Kagaratsch
    Commented Jan 17, 2018 at 21:59

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.