# How to compute $\int_{-\infty}^{\infty} \frac{1+\cos(x)}{(x -\pi)^2}dx$?

I want to compute $$\int_{-\infty}^{\infty} \frac{1+\cos(x)}{(x -\pi)^2}dx$$

My approach is $$\int_{-\infty}^{\infty} \frac{1+\cos(x)}{(x -\pi)^2}dx=\int_{-\infty}^{\infty} \frac{1}{(x -\pi)^2}dx+\int_{-\infty}^{\infty} \frac{\cos(x)}{(x -\pi)^2}dx.$$

However, the first term on the RHS does not exist since there is a singularity $$\pi$$.

How to overcome this problem?

Now follow the hint, I get $$\int_{-\infty}^{\infty} \frac{\sin x}{x}dx$$

BTW, if I want to use residue calculus to do this problem, how to do it? I am confused the pole at origin. Thanks!

• It is certainly true that writing a convergent integral as the sum of two divergent integrals is not helpful. Commented Nov 4, 2020 at 15:36
• You can evaluate your original integral as $$\int_{-\infty - i0}^{\infty - i0} \frac {2 + e^{i x} + e^{-i x}} {2 (x - \pi)^2} dx = 2 \pi i \operatorname* {Res}_{x = \pi} \frac {e^{i x}} {2 (x - \pi)^2}.$$ Commented Nov 5, 2020 at 2:10

HINT: With the substitution $$x\to x+\pi$$, we get

$$\int_{-\infty}^\infty \frac{1-\cos x}{x^2}dx$$

then integrate by parts with $$u=1-\cos x$$ and $$dv=dx/x^2$$. You should end up with a familiar integral...

I used @Franklin Pezutti Dyer's hint:

$$-\int_{-\infty}^{+\infty}(1-\cos{x})d\left(\frac{1}{x}\right)=-\int_{-\infty}^{\infty}\frac{\sin{x}}{x}dx=-\pi$$

• You have a sign error after the first $=$, since we get $\int_{\Bbb R}(1-\cos x)^\prime\tfrac1xdx$.
– J.G.
Commented Nov 4, 2020 at 15:36

$$u=x-\pi,du=dx$$ $$\int_{-\infty}^\infty\frac{1+\cos(x)}{(x-\pi)^2}dx=\int_{-\infty}^\infty\frac{1+\cos(u+\pi)}{u^2}du=\int_{-\infty}^\infty\frac{1-\cos(u)}{u^2}du$$ and now if we look at this for $$u\to\infty$$: $$\frac{1-\cos(u)}{u^2}\approx\frac 1{u^2}$$ and we can also calculate that: $$\lim_{u\to 0}\frac{1-\cos(u)}{u^2}=\frac12$$ so we can determine that the function is finite for the domain its in and is convergent due to the comparison test.

You can also use the fact that: $$1-\cos(x)=2\sin^2\left(\frac x2\right)$$