TITLE: How do I evaluate $\int_{-1}^1\frac{dx}{(1+x^2)(e^x+1)}$?
QUESTION [11 upvotes]: How do I evaluate:

$$\int_{-1}^1\frac{dx}{(1+x^2)(e^x+1)}$$

The answer given in the book is written below.
$$\int_{-1}^1\frac{dx}{(1+x^2)(e^{-x}+1)} \tag{1}$$
$$=\int_{-1}^1\frac{e^x}{(1+x^2)(e^x+1)}dx \tag{2}$$
On adding $(1)$ and $(2)$, we get:
$$\Rightarrow 2I=\int_{-1}^1\frac{e^x+1}{(1+x^2)(e^x+1)}dx \tag{3}$$
$$=\int_{-1}^1\frac{dx}{1+x^2} =2\int_{0}^1\frac{dx}{1+x^2} \tag{4}$$
$$\Rightarrow I=\int_{0}^1\frac{dx}{1+x^2}=[ \tan^{-1}x]\:_{0}^{1}\:=\:\frac{\pi}{4} \tag{5}$$
$(2): \int_{a}^{b}{f(x)dx}=\int_{a}^{b}{f(a+b-x)dx}$
$(4): \frac{1}{1+x^2} \text{ is an even function}$
I understood how to solve the integral, but I'm not able to understand how the original integral changed to the integral in $(1)$.
It might be something basic, most probably related to exponents but please tell because I'm a complete beginner in calculus.

REPLY [2 votes]: $\newcommand{\bbx}[1]{\,\bbox[15px,border:1px groove navy]{\displaystyle{#1}}\,}
 \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack}
 \newcommand{\dd}{\mathrm{d}}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,}
 \newcommand{\ic}{\mathrm{i}}
 \newcommand{\mc}[1]{\mathcal{#1}}
 \newcommand{\mrm}[1]{\mathrm{#1}}
 \newcommand{\on}[1]{\operatorname{#1}}
 \newcommand{\pars}[1]{\left(\,{#1}\,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,}
 \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}}
 \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$
There is an identity $\ds{\pars{~\Theta\ \mbox{is the}\ Heaviside\ Theta\ Function~}}$:
\begin{align}
&{1 \over \expo{x} + 1} =
\left\{\begin{array}{lcl}
\ds{\underbrace{\Theta\pars{-x} + {\on{sgn}\pars{x} \over \expo{\verts{x}} + 1}}
_{\ds{\substack{\mbox{Note that the}\ }
\\
second\ term\ \mbox{is an}
\\
\underline{odd\ function}.}}} & \mbox{if} & \ds{x \not= 0}
\\[3mm]
\ds{1 \over 2} & \mbox{if} & \ds{x = 0}
\end{array}\right.
\\[1cm] & \mbox{Then,}\quad
\int_{-1}^{1}{\dd x \over \pars{1 + x^{2}}\pars{\expo{x} + 1}}
\\[2mm] & \phantom{\mbox{Then,}\ }=
\int_{-1}^{0}{\dd x \over 1 + x^{2}} = \bbx{\pi \over 4} \\ &
\end{align}