Complex Integration of $\int_0^\infty e^{-ax}\cos(bx)\,dx$

Out of Stein's book, we're asked to show find a formula for $$\int_0^\infty e^{-ax}\cos(bx)\,dx,\quad a>0.$$While this is very doable via integration by parts, I'm asked to use contour integration, where we're suggested to integrate over a sector with angle $\omega$ such that $\cos(\omega)=a/\sqrt{a^2+b^2}.$

I've attempted this multiple times, and I keep having trouble with some integrals. I've set the contour up so that on the first segment, it's on the real axis, so we have the integral $$\int_0^R e^{-az}\cos(bz)\,dz.$$ Then I parameterize the arc as $z(\theta)=Re^{i\theta}$ for $0\leq\theta\leq \omega$, so the second integral becomes $$\int_0^\omega e^{-a(Re^{i\theta})}\cos(b(Re^{i\theta}))\left(iRe^{i\theta}\right)\,d\theta.$$The final segment I parameterized as $z(t)=Re^{i\omega}(1-t)$ and set up the final integral as $$\int_0^1e^{-a(Re^{i\omega}(1-t))}\cos\big(b(Re^{i\omega}(1-t))\big)(-Re^{i\omega})\,dt.$$I've tried finding some way to bound one of the last two integrals so that I can show one of them goes to $0$ as $R\to\infty$, but I've not had any luck. Will someone make a suggestion if my approach and parameterizations are correct? Thanks!

Update: My thoughts are really that the integral which goes to zero is the arc. I keep working it down in the following way; we know that it is \begin{align} &\leq R\int_0^\omega\left|e^{-aR(\cos\theta+i\sin\theta)}\cdot\left(\frac{e^{ibRe^{i\theta}}+e^{-ibRe^{i\theta}}}{2}\right)\right|\,d\theta\\ &\leq\frac{R}{2}\int_0^\omega\left|e^{-aR\cos\theta}\cdot\left(e^{ibR(\cos\theta+i\sin\theta)}+e^{-bR(\cos\theta+i\sin\theta)}\right)\right|\,d\theta\\ &\leq\frac{R}{2}\int_0^\omega\left|e^{-aR\cos\theta-bR\sin\theta}\right|+\left|e^{-aR\cos\theta+bR\sin\theta}\right|\,d\theta. \end{align} At this point, it is easy to show that the first term tends to zero, since $(-aR\cos\theta)<0$ and $bR\sin\theta>0$ (since $b$ and $\sin\theta$ have the same sign). The second term, however is what causes me trouble. I just finished working it out again, and I get that it only goes to zero if $a^2>b^2$, which isn't necessary in the general formula when achieved by integration by parts. I am really at a loss...

Added Solution: See the solution I've posted and please leave comments on your thoughts about it. Thanks!


We have \begin{align*} &\int_0^Re^{-Az}\,dz+\int_0^{\omega}e^{-A(Re^{i\theta})}iRe^{i\theta}\,d\theta+\int_0^Re^{-A(R-t)e^{i\omega}}(-e^{i\omega})\,dt\\ &=\frac{1}{A}+\underbrace{\int_0^{\omega}e^{-A(Re^{i\theta})}iRe^{i\theta}\,d\theta}_{\text{vanishes as $R\longrightarrow\infty$}}-\int_0^Re^{-At(\cos\omega+i\sin\omega)}(e^{i\omega})\,dt\\ &=\frac{1}{A}-\int_0^Re^{-at-ibt}\left(\frac{a}{A}+i\frac{b}{A}\right)\,dt\\ &=\frac{1}{A}-\frac{a}{A}\int_0^Re^{-at-ibt}\,dt-i\frac{b}{A}\int_0^Re^{-at-ibt}\,dt\\ &=\frac{1}{A}-\frac{a}{A}\int_0^Re^{-at}\big(\cos(bt)-i\sin(bt)\big)\,dt-i\frac{b}{A}\int_0^Re^{-at}\big(\cos(bt)-i\sin(bt)\big)\,dt\\ &=\frac{1}{A}-\frac{a}{A}\int_0^Re^{-at}\cos(bt)\,dt-\frac{b}{A}\int_0^Re^{-at}\sin(bt)\,dt\\ &\hspace{0.5in}+i\left(\frac{a}{A}\int_0^Re^{-at}\sin(bt)\,dt-\frac{b}{A}\int_0^{R}e^{-at}\cos(bt)\,dt\right). \end{align*}

Argument for Vanishing Here the integral over the arc vanishes since $$\begin{align*} \left|\int_0^{\omega}e^{-A(Re^{i\theta})}iRe^{i\theta}\,d\theta\right|&\leq R\int_0^\omega\left|e^{-AR\cos\theta}\right|\,d\theta\\&\leq R\int_0^\omega e^{-AR(1-2\theta/\pi)}\,d\theta \end{align*}$$and now it is easy to show that the integral goes to $0$.

Finsihed Solution Now we can set this up as a linear system since we know the real part and imaginary parts must be zero; so we have the equations \begin{align*} &\frac{1}{A}-\frac{a}{A}U-\frac{b}{A}V=0\\ &\hspace{0.15in}-\frac{b}{A}U+\frac{a}{A}V=0. \end{align*} Solving the system yields $$ U=\frac{a}{a^2+b^2} $$ and $$ V=\frac{b}{a^2+b^2} $$ as desired, where $U=\int_0^\infty e^{-ax}\cos(bx)\,dx$ and $V=\int_0^\infty e^{-ax}\sin(bx)\,dx$.


As long as $a>0$, $$ \begin{align} \int_0^\infty e^{-ax}\cos(bx)\,\mathrm{d}x &=\mathrm{Re}\left(\int_0^\infty e^{-(a-ib)x}\mathrm{d}x\right)\\ &=\mathrm{Re}\left(\int_0^\infty e^{-(a^2+b^2)x}\mathrm{d}(a+ib)x\right)\tag{$\ast$}\\ &=\mathrm{Re}\left(\frac{a+ib}{a^2+b^2}\int_0^\infty e^{-(a^2+b^2)x}\mathrm{d}(a^2+b^2)x\right)\\ &=\mathrm{Re}\left(\frac{a+ib}{a^2+b^2}\right)\\ &=\frac{a}{a^2+b^2} \end{align} $$ Step $(\ast)$ is simply adding $$ \mathrm{Re}\left(\int_\gamma e^{-(a-ib)z}\,\mathrm{d}z\right) $$ where $\gamma$ is the contour that goes from $0$ to $|z|=R$ along the curve $(a+ib)x$ ($x$ from $0$ to $\infty$), then follows $|z|=R$ to the positive real axis, and then back along the real axis to $0$. There are no singularities inside $\gamma$ so the integral is $0$. The integral along the arc of $|z|=R$ vanishes as $R\to\infty$.


Why the integral along the curve vanishes

Without loss of generality, assume $b>0$. Parameterizing $\gamma(t)=R(\cos(t)+i\sin(t))$ and setting $\tan(\theta)=b/a$ $$ \begin{align} &\left|\,\int_0^\theta e^{-(a-ib)R(\cos(t)+i\sin(t))}\,\mathrm{d}R(\cos(t)+i\sin(t))\,\right|\\ &=\left|\,R\int_0^\theta e^{-\sqrt{a^2+b^2}R(\cos(t-\theta)+i\sin(t-\theta))}\,i(\cos(t)+i\sin(t))\,\mathrm{d}t\,\right|\\ &\le R\int_0^\theta e^{-\sqrt{a^2+b^2}R\cos(t-\theta)}\,\mathrm{d}t\\ &=R\int_0^\theta e^{-\sqrt{a^2+b^2}R\cos(t)}\,\mathrm{d}t\\ &\le R\int_0^\theta e^{-\sqrt{a^2+b^2}R(1-2t/\pi)}\,\mathrm{d}t\\ &=Re^{-\sqrt{a^2+b^2}R}\int_0^\theta e^{\sqrt{a^2+b^2}R(2t/\pi)}\,\mathrm{d}t\\ &=\frac{\pi/2}{\sqrt{a^2+b^2}} Re^{-\sqrt{a^2+b^2}R}\left(e^{\sqrt{a^2+b^2}R(2\theta/\pi)}-1\right)\\ &=\frac{\pi/2}{\sqrt{a^2+b^2}} R\left(e^{\sqrt{a^2+b^2}R(2\theta/\pi-1)}-e^{-\sqrt{a^2+b^2}R}\right)\tag{$\lozenge$} \end{align} $$ Since $0\le\theta\lt\pi/2$, the coefficient of $R$ in each exponential is negative. Thus, $(\lozenge)$ tends to $0$ as $R\to\infty$.