Calculate $\int_\mathbb{R}\frac{\cos\lambda x-1}{x^2}\,dx$ where $\lambda\in \mathbb{R}$. Calculate
$$
\int_\mathbb{R}\frac{\cos\lambda x-1}{x^2}\,dx 
$$
where $\lambda\in \mathbb{R}$.

We have
$$
\frac{\partial\left(\frac{cos\lambda x-1}{x^2}\right)}{\partial \lambda}=\frac{\sin\lambda x}{x}.
$$
But I am not sure whether
$$
\frac{\partial }{\partial \lambda}\int\cdots = \int \frac{\partial }{\partial \lambda}\cdots.
$$
 A: For $\lambda = 0$ the integral is $0$ trivially. So assume $\lambda \neq 0$.
First write it as $$2\int_{0}^{\infty}\dfrac{\cos(\lambda x)-1}{x^{2}}\,dx$$
Try and apply Integration by parts first.
$$-\frac{\cos\lambda x -1}{x}\Bigg\vert_{0}^{\infty} -\int_{0}^{\infty}\lambda\dfrac{\sin(\lambda x)}{x}\,dx$$.
It's easy to see that the $\lim_{x\to \infty}\frac{\cos\lambda x -1}{x}=0$
and $\lim_{x\to 0}\frac{\cos\lambda x -1}{x}=0$
Substitute $\lambda x= u$ to reduce it to the Dirichlet Integral.
And $$\int_{0}^{\infty}\dfrac{\sin(x)}{x}\,dx = \frac{\pi}{2}$$ .
See here
There are tons of other links.
A: Using Residu Theorem
You have that $$\int_{\mathbb R}\frac{\cos(\lambda x)-1}{x^2}\,\mathrm d x=\Re\int_{\mathbb R}\frac{e^{i\lambda x}-1}{x^2}\,\mathrm d x.$$
Consider $$\Gamma _{\varepsilon,R} =C_1^R\cup L_1^{R,\varepsilon} \cup C_2^\varepsilon \cup L_2^{R,\varepsilon },$$
where
\begin{align*}
C_1^R&:=\{Re^{i\theta }\mid \theta \in [0,\pi]\}\\
C_2^\varepsilon &:=\{\varepsilon e^{i\theta }\mid \theta \in [\pi,2\pi]\}\\
L_1^{R,\varepsilon }&:=[-R,-\varepsilon ]\\
L_{2}^{R,\varepsilon }&:=[\varepsilon ,R].
\end{align*}
Using Residue theorem $$\int_{\Gamma _{R,\varepsilon }}\frac{e^{i\lambda z}-1}{z^2}\,\mathrm d z=-2\pi \lambda .$$
Taking $R\to \infty $ and $\varepsilon \to 0$ allows you to conclude.
