# Calculating the following integral using complex analysis: $\int_{0}^{\pi}e^{a\cos(\theta)}\cos(a\sin(\theta))\, d\theta$

I am trying to solve a question from my complex analysis test that I didn't manage to do during the test in order to practice for the next exam.

The problem is as follows:

Calculate $\int_{0}^{\pi}e^{a\cos(\theta)}\cos(a\sin(\theta))\, d\theta$

Where the method used should be using complex analysis.

What I tried:

I have noticed $$e^{a\cos(\theta)}\cos(a\sin(\theta))=Re(e^{acis(\theta)})$$ where $cis(\theta):=\cos(\theta)+i\sin(\theta)$

Hence the integral is $$\int_{0}^{\pi}Re(e^{a(\cos(\theta)+i\sin(\theta))}\, d\theta$$

I did the change of variables: $z=ae^{i\theta}$, $dz=iae^{i\theta}\, d\theta\implies d\theta=\frac{dz}{iz}$.

When $\theta=0$ we have that $z=a$ and when $\theta=\pi$ we get $z=-ia$

and so I wrote that the integral is

$$\int_{a}^{-ia}Re(e^{z})\,\frac{dz}{iz}$$

Now I don't understand how I got $e^{z}$, which seems wrong to me, but what the checker actually marked in red and wrote a question mark by were the integration limits: $a,-ia$ .

Can someone please help me understand what was wrong with what the integration limits, and how to actually solve this integral ?

Any help is greatly appreciated!

• When $\theta=\pi$ you get $z=-a$ – Emmet Mar 19 '13 at 11:10
• Without complex analysis, it can be evaluated like this: Consider the integral as a function of $a$, differentiate w.r.t. to $a$ and out comes that the derivative is $0$, so the integral doesn't depend on $a$. Hence one can just set $a:=0$ and compute. One has to appeal to various convergence theorems for the Lebesgue integral to argue that this works. – kahen Mar 19 '13 at 11:13

As noted in Emmet´s comment, there is an error in your computation: when $\theta=\pi$ $z=-a$, not $-i\,a$ ($e^{\pi i}=-1$).
The computation becomes easier by noting that the integrand is even, so that it is one half of the integral between $0$ and $2\,\pi$. After the change of variables the integral becomes a line integral along the unit circle, and you can apply Cauchy's theorem or the calculus of residues.
I will work backwards. Consider the integral $$\int_{|z|=1}\frac{e^{az}}{i\,z}\,dz.$$ By Cauchy's theorem its value is $2\,\pi$. Now let $z=e^{it}$. Then \begin{align*} \int_{|z|=1}\frac{e^{az}}{i\,z}\,dz&=\int_0^{2\pi}e^{ae^{it}}\frac{i\,e^{it}\,dt}{i\,e^{it}}\\ &=\int_0^{2\pi}e^{a(\cos t+i\sin t)}dt\\ &=\int_0^{2\pi}e^{a\cos t}\cos(a\sin t)\,dt+i\int_0^{2\pi}e^{a\cos t}\sin(a\sin t)\,dt. \end{align*} Finally, we get $$\int_0^{\pi}e^{a\cos t}\cos(a\sin t)\,dt=\pi.$$
• Why is the first integral $2 \pi e$ and not $2 \pi$. Don't we need to find $e^{a \cdot 0} = 1$ ? – muzzlator Mar 19 '13 at 12:33
• @muzzlator - I too get a different answer, but I get $\frac{e^{a\cdot 0}}{i}$ – Belgi Mar 19 '13 at 13:39
• There should be no $i$. Remember the integral formula has $\frac{1}{2 \pi i}$ on the outside of the integral – muzzlator Mar 19 '13 at 13:49