Using Feynman's technique, I want to evaluate $$\int_0^{\infty}\frac{\cos{x}}{x^2+1} dx$$
I set
$$I(a)=\int_0^{\infty}\frac{\cos{ax}}{x^2+1} dx$$
which gives
$$I'(a)=\int_0^{\infty}\frac{-x\sin{ax}}{x^2+1} dx$$
$$I''(a)=\int_0^{\infty}\frac{-x^2\cos{ax}}{x^2+1} dx$$
However, when I try to form a differential equation, I get
$$I(a)-I''(a)=\int_0^{\infty}\cos{ax}\; dx$$
However, this integral doesn't converge and I'm stuck on how I can work my way around this. I know that to get the right answer, I need $I(a)-I''(a)=0$ but I can't get there. Can someone help me find the right way to do this question?
The trick for the problem is to take the first derivative integral and multiply the integrand by $\frac{x}{x}$:
$$\int_{0}^{\infty} \frac{-x^2}{x^2+1}\cdot\frac{\sin ax}{x}\:dx = -\int_0^\infty\frac{\sin ax}{x}\:dx+ \int_0^\infty \frac{\sin ax}{x(x^2+1)}\:dx$$
$$ \implies I'(a) = -\frac{\pi}{2}+ \int_0^\infty \frac{\sin ax}{x(x^2+1)}\:dx$$
Then we get
$$I''(a) = \int_0^\infty \frac{\cos ax}{x^2+1}\:dx = I(a)$$