# Substitution into integral [duplicate]

I have to do a substitution (u = pi/2-x) into an definite integral, which I have defined as f[u]. When I evaluate my code, no result is produced.

The code I have written is

substitute[Integrate[f[u], x], {x, 0, Pi/2}], u -> pi/2-x]


Is there something I am missing in my code that I am unaware of?

My f[u]is ((Sin[x])^n/(Cos[x])^n + (Sin[x])^n). and I am trying to substitute u = u = pi/2-x into$$$$ it.

## marked as duplicate by Bob Hanlon, Daniel Lichtblau, m_goldberg, MarcoB, Community♦Apr 19 at 21:48

• There is no Mathematica command substitute (look at documentation for ReplaceAll). pi should be Pi (all built-in symbols start with a capital letter). Pattern Blank(_) is only used on LHS of function definition not when using the function. What is the definition of your function f? – Bob Hanlon Apr 18 at 23:40
• f is (Sin^n)[x_]/((Cos^n)[x_] + (Sin^n)[x_]) – Katie Apr 18 at 23:49
• On a previous question you were told that Sin^n and Cos^n are the wrong syntax and shown the proper syntax. Edit your question to include the definition of f using the proper syntax. Also edit to make best effort to correct other issue that have been pointed out. – Bob Hanlon Apr 19 at 0:00
• It's not the first time I see someone trying to use the nonexistent function substitute. (Someone even posts answer using substitute! ) What textbook are you guys refering to? – xzczd Apr 19 at 6:15
• Possible duplicate: mathematica.stackexchange.com/questions/59820/… – Michael E2 Apr 19 at 10:39

You have to solve for x with respect to u then name it y then substitute with it because your original function f[x] depend on x there's only x

f[x_] := ((Sin[x])^(n)/(Cos[x])^(n)) + (Sin[x]^n)

y = x /. Solve[u == (pi/2) - x, x] /. Rule -> Equal

final = Integrate[f[x], x, {x, 0, Pi/2}] /. x -> y


• I guess the OP doesn't care that your answer still contains a u, even though the only parameters in the original problem are pi and n (although pi might be a typo for Pi`). Note that your integrate code is equivalent to $\int \int _0^{\frac{\pi }{2}}f(x) \, dx \, dx$. I doubt that's the right way to interpret the OP's syntax error. – Michael E2 Apr 21 at 15:36