# Integration Help

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]

• 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 – enano9314 Apr 17 at 20:56
• – Michael E2 Apr 18 at 0:16
• 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.) – Michael E2 Apr 18 at 13:47

This works for me:

Table[Integrate[Sin[x]^n/(Sin[x]^n+Cos[x]^n),{x,0,Pi/2}],{n,1,5}]


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

• Recommend that you add a Plot to make it easier to understand why the result is a constant. – Bob Hanlon Apr 17 at 21:11
• Good suggestion. Editing. – Kevin Ausman Apr 17 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}]


π/4

• I believe you have the parentheses in the wrong place relative to the original question. Right idea for the solution, though. – Kevin Ausman Apr 17 at 21:05
• Yes, just realized that, thanks for pointing it out. – amator2357 Apr 17 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\, .$$

ClearAll[symmetrizeIntegrate];
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  *)