On this page
Integrals like cos x/(1+e^x) from −π/2 to π/2 show up in JEE and board-exam practice because they look impossible to integrate directly. You won't find a neat antiderivative, and you don't need one. Add the integral to its mirror image and the e^x disappears. Below: the derivation, four worked examples, and the one case where the trick fails.
Why does x → −x work for f(x)/(1+e^x)?
The tool is substitution in a definite integral. OpenStax Calculus Volume 1 states it as Theorem 5.8: when you substitute u = g(x), the limits a and b become g(a) and g(b) (OpenStax, Substitution). With u = −x, the limits −a and a swap places, and the minus sign from du = −dx swaps them back.
Let f be even, so f(−x) = f(x).
Call the integral I: I = ∫ from −a to a of f(x)/(1+e^x) dx.
Put x = −t. The limits flip and flip back, so I = ∫ from −a to a of f(−t)/(1+e^(−t)) dt.
Multiply top and bottom by e^t: 1/(1+e^(−t)) = e^t/(1+e^t). Since f is even, f(−t) = f(t). Rename t as x: I = ∫ from −a to a of f(x)·e^x/(1+e^x) dx.
Add the two forms of I: 2I = ∫ from −a to a of f(x)·(1+e^x)/(1+e^x) dx = ∫ from −a to a of f(x) dx.
So I is half of ∫ from −a to a of f(x) dx.
For a continuous even function, the integral from −a to a equals twice the integral from 0 to a (OpenStax, Integrals of Even and Odd Functions). Half of that is the integral from 0 to a. That is the shortcut: I = ∫ from 0 to a of f(x) dx.
The same pairing holds for 1/(1+k^x) for any positive k, because 1/(1+k^x) + k^x/(k^x+1) = 1. So the shortcut covers 2^x, 3^x and so on, not only e^x. For the other symmetry and limit tricks, see our guide to properties of definite integrals.
What does this look like in an exam question?
The method is the same every time: check that f is even, then integrate f alone from 0 to a.
∫ from −π/2 to π/2 of cos x/(1+e^x) dx. cos x is even, so the answer is ∫ from 0 to π/2 of cos x dx = sin(π/2) − sin 0 = 1.
∫ from −1 to 1 of x²/(1+e^x) dx. x² is even, so the answer is ∫ from 0 to 1 of x² dx = 1/3.
∫ from −1 to 1 of x⁴/(1+2^x) dx. The base is 2, but the weights still pair to 1, so the answer is ∫ from 0 to 1 of x⁴ dx = 1/5.
∫ from −π to π of sin²x/(1+e^x) dx. sin²x is even (the square of an odd function), so the answer is ∫ from 0 to π of sin²x dx = π/2.
If you got a different number on any of these, the Fermi Problem Library has worked problems with a step-by-step solver that explains the reasoning rather than printing an answer, so you can find the line where yours went off.
Does the trick work if f is odd?
No, and this is the trap. Take f(x) = x. Step 3 now gives I = −∫ from −1 to 1 of x·e^x/(1+e^x) dx, with a minus sign, because f(−x) = −x. Adding the two forms leaves 2I = ∫ from −1 to 1 of x(1 − e^x)/(1 + e^x) dx. The denominators no longer cancel.
That new integrand is negative on both sides of zero: x and 1 − e^x always have opposite signs. So the integral of x/(1+e^x) from −1 to 1 is negative. It is not zero, even though the integral of x alone over −1 to 1 is zero, as our post on why the integral of an odd function from −a to a is zero explains. The weight breaks the symmetry.
The lesson: test f(−x) before you use the shortcut. If odd and even still blur together for you, the Fermi Concept Library gives each concept its own lesson and its place in the map.
How can you check the trick in 30 seconds?
Run this list before writing the answer:
Are the limits −a to a? If not, this is the wrong shortcut.
Is f even? Write out f(−x) and compare it with f(x).
Do the weights pair to 1? Check that g(x) + g(−x) = 1 for the part you are removing.
Then the answer is ∫ from 0 to a of f(x) dx. Integrate f only.
Sanity check: if f ≥ 0 on the interval, your answer cannot be negative.
The picture: for even f, the curves f(x)/(1+e^x) and f(x)·e^x/(1+e^x) are mirror images across the y-axis with equal areas that stack up to f.
Next time you see 1 + e^x under an even function over −a to a: add, halve, and integrate f from 0 to a.



