Solution.
Let f ( z ) = z 2 − 1 z 2 + 1 e i z z f\p{z} = \frac{z^2 - 1}{z^2 + 1} \frac{e^{iz}}{z} f ( z ) = z 2 + 1 z 2 − 1 z e i z . For 0 < ε < R 0 < \epsilon < R 0 < ε < R , let γ ε , R \gamma_{\epsilon,R} γ ε , R be the contour
γ ε , R = [ ε , R ] ∪ { R e i θ | 0 ≤ θ ≤ π } ∪ [ − R , − ε ] ∪ { ε e i θ | 0 ≤ θ ≤ π } \gamma_{\epsilon,R}
= \br{\epsilon, R} \cup \set{Re^{i\theta} \st 0 \leq \theta \leq \pi} \cup \br{-R, -\epsilon} \cup \set{\epsilon e^{i\theta} \st 0 \leq \theta \leq \pi} γ ε , R = [ ε , R ] ∪ { R e i θ ∣ ∣ 0 ≤ θ ≤ π } ∪ [ − R , − ε ] ∪ { ε e i θ ∣ ∣ 0 ≤ θ ≤ π }
oriented counter-clockwise. On the large semi-circle C R C_R C R , we have
∣ ∫ C R f ( z ) d z ∣ ≤ ∫ 0 π R 2 + 1 R 2 − 1 e − R sin θ d θ = 2 ( R 2 + 1 ) R 2 − 1 ∫ 0 π / 2 e − R sin θ d θ ≤ 2 ( R 2 + 1 ) R 2 − 1 ∫ 0 π / 2 e − 2 R θ / π d θ = π ( R 2 + 1 ) R ( R 2 − 1 ) ( 1 − e − R ) → R → ∞ 0. \begin{aligned}
\abs{\int_{C_R} f\p{z} \,\diff{z}}
&\leq \int_0^\pi \frac{R^2 + 1}{R^2 - 1} e^{-R\sin\theta} \,\diff\theta \\
&= \frac{2\p{R^2 + 1}}{R^2 - 1} \int_0^{\pi/2} e^{-R\sin\theta} \,\diff\theta \\
&\leq \frac{2\p{R^2 + 1}}{R^2 - 1} \int_0^{\pi/2} e^{-2R\theta/\pi} \,\diff\theta \\
&= \frac{\pi\p{R^2 + 1}}{R\p{R^2 - 1}} \p{1 - e^{-R}}
\xrightarrow{R\to\infty} 0.
\end{aligned} ∣ ∣ ∫ C R f ( z ) d z ∣ ∣ ≤ ∫ 0 π R 2 − 1 R 2 + 1 e − R s i n θ d θ = R 2 − 1 2 ( R 2 + 1 ) ∫ 0 π /2 e − R s i n θ d θ ≤ R 2 − 1 2 ( R 2 + 1 ) ∫ 0 π /2 e − 2 Rθ / π d θ = R ( R 2 − 1 ) π ( R 2 + 1 ) ( 1 − e − R ) R → ∞ 0.
On C ε C_\epsilon C ε , we get a half residue in the limit: Notice that f ( z ) + 1 z f\p{z} + \frac{1}{z} f ( z ) + z 1 is holomorphic near z = 0 z = 0 z = 0 since f f f has residue − 1 -1 − 1 there, so it is bounded near z = 0 z = 0 z = 0 by some M > 0 M > 0 M > 0 . Hence,
∣ ∫ C ε f ( z ) + 1 z d z ∣ ≤ M ∣ C ε ∣ → ε → 0 0 ⟹ lim ε → 0 ∫ C ε f ( z ) d z = π i . \begin{gathered}
\abs{\int_{C_\epsilon} f\p{z} + \frac{1}{z} \,\diff{z}}
\leq M\abs{C_\epsilon} \xrightarrow{\epsilon\to0} 0 \\
\implies
\lim_{\epsilon\to0} \int_{C_\epsilon} f\p{z} \,\diff{z}
= \pi i.
\end{gathered} ∣ ∣ ∫ C ε f ( z ) + z 1 d z ∣ ∣ ≤ M ∣ C ε ∣ ε → 0 0 ⟹ ε → 0 lim ∫ C ε f ( z ) d z = πi .
Finally, our γ ε , R \gamma_{\epsilon,R} γ ε , R contains a pole at z = i z = i z = i , which gives the residue
Res ( f ; i ) = lim z → i ( z − i ) f ( z ) = lim z → i z 2 − 1 z + i e i z z = e − 1 . \Res{f}{i}
= \lim_{z\to i} \,\p{z - i}f\p{z}
= \lim_{z\to i} \frac{z^2 - 1}{z + i} \frac{e^{iz}}{z}
= e^{-1}. Res ( f ; i ) = z → i lim ( z − i ) f ( z ) = z → i lim z + i z 2 − 1 z e i z = e − 1 .
Thus, by the residue theorem, sending ε → 0 \epsilon \to 0 ε → 0 and R → ∞ R \to \infty R → ∞ , we get
∫ − ∞ ∞ x 2 − 1 x 2 + 1 e i x x d x = 2 π i e − 1 − π i . \int_{-\infty}^\infty \frac{x^2 - 1}{x^2 + 1} \frac{e^{ix}}{x} \,\diff{x}
= 2\pi i e^{-1} - \pi i. ∫ − ∞ ∞ x 2 + 1 x 2 − 1 x e i x d x = 2 πi e − 1 − πi .
Taking imaginary parts and noting that the integrand is even, we have
∫ 0 ∞ x 2 − 1 x 2 + 1 sin x x d x = π e − π 2 . \int_0^\infty \frac{x^2 - 1}{x^2 + 1} \frac{\sin{x}}{x} \,\diff{x}
= \frac{\pi}{e} - \frac{\pi}{2}. ∫ 0 ∞ x 2 + 1 x 2 − 1 x sin x d x = e π − 2 π .