Finding the integral $\int\frac{e^{x}}{e^{2x}+1}$ This question has been puzzling me for a bit and I'd like an explanation for what I'm doing wrong as my answer doesn't coincide with the correct one.
Let's say we're asked to find:
$$\int \frac{e^{x}}{e^{2x}+1}\mathrm{d}x$$
The way I chose to solve this was factor out an $e^{2x}$ from the denominator and work my way from there. So what I get is:
$$\int \frac{e^{x}}{e^{2x}(1+1/e^{2x})}dx$$
This could be rewritten as:
$$\int \frac{1}{e^{x}(1+(1/e^{x})^2)}dx$$
If we let:
$$u = \frac{1}{e^x}$$
$$du = -e^{-x} dx$$
$$dx = -e^xdu$$
So, now we're at:
$$\int \frac{1}{e^{x}(1+u^2)}(-e^x)du$$
Cancelling out the $e^x$ and removing the minus sign outside of the integral gives us:
$$-\int \frac{1}{1+u^2}du$$
This leaves us with:
$$-\int \frac{1}{1+u^2}du = -\tan^{-1}(\frac{1}{e^x})+c$$ 
However, I know the answer is wrong because the correct one is $\tan^{-1}(e^x) + c$. Can someone please tell me where I screwed up? Many thanks in advance!
 A: As Jean-Claude Arbaut said, you didn't screw up. We have the identity
$$\tan^{-1}(\frac{1}{y})=\frac{\pi}{2}-\tan^{-1}(y).$$
So it follows that
$$
-\tan^{-1}(1/e^x)=\tan^{-1}(e^x)-\pi/2=\tan^{-1}(e^x)+c.
$$
A: Your answer is right ..
Here is a  easier approach
$$e^x=\tan z$$
$$\int \frac{e^{x}}{e^{2x}+1}dx$$
$$\int \frac{\sec^2 z}{\tan^2 z+1}dz$$
$$=z+c=\tan^{-1}e^x+c$$
A: You have been messing a little with the signs.
$$\int\frac{e^x\,dx}{e^{2x}+1}=\int\frac{d(e^x)}{(e^x)^2+1}=\arctan(e^x)+c.$$
A: If we directly take $e^x=t$ right at the beginning, we get:
$$\int \frac{e^x}{e^{2x}+1} \mathrm{d}x$$
$$=\int \frac{\mathrm{d}t}{t^2+1}$$
$$=\tan^{-1}t+ \mathrm{C}$$
$$=\tan^{-1}(e^x)+\mathrm{C}$$
A: One of the best thing you can do with indefinite integrals is take the derivative of your result and check if it is the integrand function:
$$\frac{\text{d}}{\text{d}x} \left[-\arctan \left (\frac{1}{e^x}\right)+c\right]=\frac{\text{d}}{\text{d}x} \left[-\arctan \left (e^{-x}\right)+c\right]=-\frac{1}{1+e^{-2x}}({-e^{-x}})=\frac{e^{-x}}{1+e^{-2x}}=$$
$$=\frac{\frac{1}{e^x}}{1+\frac{1}{e^{2x}}}=\frac{\frac{1}{e^x}}{\frac{e^{2x}+1}{e^{2x}}}=\frac{1}{\frac{e^{2x}+1}{\frac{1}{e^x}}}=\frac{e^{x}}{e^{2x}+1}$$
So your result is absolutely correct, no matter what (except for calculation mistakes).
Of course it is not always this simple, maybe you'll need some identities to have back the integrand function; but this is for sure better than thinking you're wrong without checking.
