# Why can't I use complex contour integration to evaluate the real integral $\int_0^\infty f(x)\cos(ax)\, dx$?

If I want to evaluate the integral of real functions like $$\int_0^\infty f(x)\cos(ax) dx$$ where $$a$$ is a real constant, why can't I simply do contour integration by using the complex function $$f(z)cos(az)dz$$?

My Attempt

I know using Euler's formula that $$\cos ax = e^{iax} - i\sin(ax)$$ and based on other examples with integrals of this form, it seems like the correct corresponding complex function to solve is:

$$\oint_C f(z)e^{iaz} = \pi iRe \Big\{ f(z)e^{iaz} \Big\}$$, where C is the quarter circle contour. If this is true, I don't quite understand why.

Since all I know about $$f(x)$$ is that it's a rational function, I also don't know if $$\int_0^\infty f(x)\cos(ax) dx = \frac{1}{2}\int_{-\infty}^\infty f(x)\cos(ax) dx$$

I haven't covered Fourier Series yet and am working to solve this by using Residues.

Thanks!

• It would be very impressive if contour integration could manage $f(x)\cos(ax)$ in general; I'm afraid it can't. You generally need specific knowledge of the function to know how its bounds behave and what its residues are Mar 17, 2022 at 18:45

Well - the real integral from $$0$$ to $$\infty$$ is a limit of a path integral along the x-axis from $$0$$ to $$N$$, taking the limit $$\lim_{N -> \infty}$$. The logical way to calculate this is look at a closed loop integral in the complex plane of the function that has real values $$f(x)\cos(ax)$$ - so we can take $$g(z) = f(z)e^{iaz}$$ for this. For the closed path integral then you should take something that allows you to calculate the respective path integrals. For example a quarter circle and a path back to $$0$$ along the imaginary axis. Then apply the residue theorem for any singular points of $$f(z)$$ within the closed path and take the limit of $$N$$ to $$\infty$$.
And you may need to use another contour if you are unable to calculate the respective path integrals, or when those do not vanish when $$N$$ goes to $$\infty$$.