Evaluate the improper integral $\int_{-\infty}^{\infty} \dfrac {e^{x}}{1+e^{2x}} dx$
My Attempt $$=\lim_{a\to -\infty} \int_{a}^{0} \dfrac {e^{x}}{1+e^{2x}} dx + \lim_{b\to \infty} \int_{0}^{b} \dfrac {e^{x}}{1+e^{2x}} dx$$ Substituting $e^x=t$ and evaluating gives the integration as $\tan^{-1} e^{x}$. Then solving the limits I get the value of definite integral as $\dfrac {\pi}{2}$. However the book says the limit doesn't exist. Is there any point where I made an error?
Let $f(x) = e^x/(1+e^{2x})$. Then with the substitution $u = e^x$, $du = e^x \, dx$, we obtain $$\int f(x) \, dx = \int \frac{du}{1+u^2} = \tan^{-1} u + C = \tan^{-1} e^x + C.$$ Taking the limit as $x \to \infty$, we obtain $$\int_{x=0}^\infty f(x) \, dx = \lim_{x \to \infty} \tan^{-1} e^x - \tan^{-1} e^0 = \frac{\pi}{2} - \frac{\pi}{4} = \frac{\pi}{4}.$$ This demonstrates that the improper integral is bounded above. Since $$f(-x) = \frac{e^{-x}}{1 + e^{-2x}} \cdot \frac{e^{2x}}{e^{2x}} = \frac{e^x}{e^{2x} + 1} = f(x)$$ for all real $x$, it follows that the given integral has value $\frac{\pi}{2}$.
It is also worth noting that on $[0, \infty)$, we must have $$0 < f(x) < e^{-x},$$ hence the integral is dominated on this interval by $$\int_{x=0}^\infty e^{-x} \, dx = 1.$$