How would one evaluate $\int\frac{x\sin(x)}{x^2+1}$ over the real line?
Another exam problem I'm looking at is to evaluate the following integral. $$ \int_{-\infty}^{\infty} \frac{x\hspace{-0.04 in}\cdot\hspace{-0.04 in}\sin(x)}{x^{\hspace{.02 in}2}+1} dx $$ This is a complex analysis exam, so the solution probably involves contours. $\:$ Since the integrand is an even function, one could potentially simplify by changing one endpoint to $0$. However, I have no idea how to make a contour work since the absolute value of the integrand grows exponentially away from the real axis. What does one need to do to evaluate that integral?
Define
$$f(z)=\frac{ze^{iz}}{z^2+1}\;,\;\;C_R:=\{z=Re^{it}\in\Bbb C\;;\;R,t\in\Bbb R\;,\;0\le t\le \pi\}\;,\;$$
$$\gamma_r:=[-R,R]\cup C_R\;,\;\;\text{positively oriented}$$
For $\;R>1\;$ , our function has one unique simple pole at $\;z=i\;$ within $\;\gamma_R\;$ , with residue
$$\text{Res}_{z=i}(f)=\lim_{z\to i}\;(z-i)f(z)=\frac{ie^{-1}}{2i}=\frac1{2e}$$
So by Cauchy's Theorems
$$\frac{2\pi i}{2e}=\frac{\pi i}e=\oint\limits_{\gamma_R}f(z)dz=\int\limits_{-R}^R\frac{xe^{ix}}{x^2+1}dx+\int\limits_{C_R}f(z)dz$$
But by Jordan's Lemma
$$\left|\;\int\limits_{\gamma_R} f(z)dz\;\right|\xrightarrow [R\to\infty]{}0\;$$
So we get
$$\frac{\pi i}e=\int\limits_{-\infty}^\infty\frac{x(\cos x+i\sin x)}{x^2+1}dx$$
Take now just the imaginary parts in both sides to get the result.