So I have to integrate $$\frac{\sin^n x}{\sin^n x + \cos^n x}$$ and am coding this in Mathematica with

 (((Sin^n)[x])/(((Sin^n)[x]) + ((Cos^n)[x]))) 

with the bounds $0$ and $\pi/2,$ where $n$ takes on various integer values.

I programmed the problem so that $n=1$ then $n=2$, etc...but every time I try to get the output, I only get back the integration symbol. For example, if I program $n=2$ and then do the integration command- the output is

 (((Sin^2)[x])/(((Sin^2)[x]) + ((Cos^2)[x]))), 

but does not solve it. Anyone know how to help or fix this??

Update: Even with the syntax fixed, Mathematica does not solve it, with or without assumptions:

Integrate[Sin[x]^n/(Sin[x]^n + Cos[x]^n), {x, 0, Pi/2},
 Assumptions -> n > 0 && n \[Element] Integers]
  • 1
    $\begingroup$ Hello! It seems that you haven't included any code. Can you please include that here in the post? Based on your textual description my guess is that you are using (Sin^2)[x] when that syntax is incorrect, you should instead write it as Sin[x]^2 $\endgroup$
    – enano9314
    Commented Apr 17, 2019 at 20:56
  • $\begingroup$ Related: math.stackexchange.com/questions/82489/… $\endgroup$
    – Michael E2
    Commented Apr 18, 2019 at 0:16
  • $\begingroup$ Was it closed simply because of a syntax error by the OP? The integral with fixed syntax can be evaluated at specific values for n, as shown in two of the answers, but it cannot be evaluated with a unspecified parameter n. (Of course we often get this kind of question, which reveals limitiations of Integrate.) $\endgroup$
    – Michael E2
    Commented Apr 18, 2019 at 13:47

3 Answers 3


This works for me:


And it gives the output {Pi/4,Pi/4,Pi/4,Pi/4,Pi/4}.

enter image description here

  • 1
    $\begingroup$ Recommend that you add a Plot to make it easier to understand why the result is a constant. $\endgroup$
    – Bob Hanlon
    Commented Apr 17, 2019 at 21:11
  • $\begingroup$ Good suggestion. Editing. $\endgroup$ Commented Apr 17, 2019 at 21:38

Perhaps you're writing your function in the wrong format Emma. The following works fine:

n = 2;
Integrate[Sin[x]^n/(Sin[x]^n + Cos[x]^n),{x, 0, π/2}]


  • $\begingroup$ I believe you have the parentheses in the wrong place relative to the original question. Right idea for the solution, though. $\endgroup$ Commented Apr 17, 2019 at 21:05
  • 1
    $\begingroup$ Yes, just realized that, thanks for pointing it out. $\endgroup$
    – amator2357
    Commented Apr 17, 2019 at 21:09

A common trick (see this Math.SE post):

$$\int_a^b f(x) \; dx \ {\buildrel x = a+b-u \over =} -\int_b^a f(a + b - u) \; du = \int_a^b f(a + b - x) \; dx\, ,$$ so therefore $$\int_a^b f(x) \; dx = \int_b^a {f(x) + f(a + b - x) \over 2} \; dx\, .$$

SetAttributes[symmetrizeIntegrate, HoldAll];
symmetrizeIntegrate[Integrate[f_, {x_, a_, b_}, opts___]] := 
 Integrate[(f + (f /. x -> a + b - x))/2, {x, a, b}, opts]

symmetrizeIntegrate[Integrate[Sin[x]^n/(Sin[x]^n + Cos[x]^n), {x, 0, \[Pi]/2}]]
(*  π/4  *)

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.