# Contour integration

## Homework Statement

Show that, for $m>0$,

$$\int_{0}^{\infty}dx\frac{\cos[mx]}{\left(x^{2}+1\right)^{2}}=\frac{\pi}{4}\left(1+m\right)\exp[-m]$$

## Homework Equations

Residue theorem:

$$\oint_Cdz\frac{\cos[mz]}{(z^2+1)^2}=\pi i\mathrm{Res}\left[\frac{\cos[mz]}{(z^2+1)^2},\,i\right]$$

## The Attempt at a Solution

$$\mathrm{Res}\left[\frac{\cos[mz]}{\left(z+i\right)^{2}\left(z-i\right)^{2}},\, i\right]=\frac{d}{dz}\left((z-i)^{2}\frac{\exp[imz]}{(z+i)^{2}(z-i)^{2}}\right)_{z=i}$$

$$=\frac{d}{dz}\left(\frac{\exp[imz]}{(z+i)^{2}}\right)_{z=i}$$
$$=\left.\frac{im\exp[imz]}{(z+i)^{2}}-\frac{2\exp[imz]}{(z+i)^{3}}\right|_{z=i}$$

$$=\frac{im\exp[-m]}{4i^{2}}-\frac{2\exp[-m]}{8i^{3}}$$

$$=\frac{m\exp[-m]}{4i}+\frac{\exp[-m]}{4i}\\&=\frac{1}{4i}(m+1)\exp[-m]$$

$$\therefore\int_0^\infty dx\frac{\cos[mx]}{(x^2+1)^2}=\frac{\pi}{4}(m+1)\exp[-m]$$

I get the answer no problem, but I'm not sure about is why this is for $m>0$ only. If I let $m<0$, I get (by the same/similar arguments and mathematics as above)

$$\int_0^\infty dx\frac{\cos[mx]}{(x^2+1)^2}=\frac{\pi}{4}(1-m)\exp[m]$$

And I'm not sure why this wouldn't be allowed? Any suggestions of where to look?

Last edited:

Aha, I figured it out. It's not that it's not an allowed term, it's that $\cos(-x)=\cos(x)$ so the integration would be exactly the same here as well.

Your solution is a little sloppy and incorrect, even though you got the correct answer.

1) You need to specify the contour that you are integrating over.
2) You basically state in your first line of finding the residue that cos(mz)=exp(imz), which isn't true.
3) The function that I think you should be integrating in the line integral is
$$f(z) = \frac{e^{imz}}{(z^2+1)^2}$$
4) The residue theorem has a $2\pi i$ term, not just $\pi i$.
5) When doing these type of integrals, your line integral will contain some extra terms. You need to show that the extra integral term goes to zero as the radius of your contour goes to infinity, and if you use f(z) as above, you will have an imaginary valued integral as well.

Your solution is a little sloppy and incorrect, even though you got the correct answer.

1) You need to specify the contour that you are integrating over.
2) You basically state in your first line of finding the residue that cos(mz)=exp(imz), which isn't true.
3) The function that I think you should be integrating in the line integral is
$$f(z) = \frac{e^{imz}}{(z^2+1)^2}$$
4) The residue theorem has a $2\pi i$ term, not just $\pi i$.
5) When doing these type of integrals, your line integral will contain some extra terms. You need to show that the extra integral term goes to zero as the radius of your contour goes to infinity, and if you use f(z) as above, you will have an imaginary valued integral as well.

(1) I specify this in the actual assignment, I was looking for help on the last little bit. It's the semi-circle of the positive real & imaginary numbers.

(2) I neglected $\Re$ from in front of $\exp[imz]$ which then becomes true: $\cos[mx]=\Re[\exp[imx]]$

(3) I thought that was sorta what I was doing.

(4) This is why there's only the $\pi i$:

$$2\int_0^\infty \frac{\cos[mx]}{(x^2+1)^2}dx=\int_{-\infty}^\infty\frac{\cos[mx]}{(x^2+1)^2}dx\rightarrow\oint_C\frac{\cos[mz]}{(z^2+1)^2}dz=2\pi i\mathrm{Res}\left[\frac{\cos[mx]}{(x^2+1)^2},\,i\right]$$

So the twos cancel, reducing the coefficient of the residue to $\pi i$

(5) My professor said that we do not have to prove for every function that the extra terms go to zero. "Doing it once for the general case in class is enough to know it happens in all cases and you should just use the result [of what we did in class]" is what he said specifically.

1) I know what you mean, but what you said doesn't make any sense.
2) Yes, but then you just leave it off. See (3).
3) You need to state that you are using the f(z) I posted. This is definitely the function that you want to perform the line integral on. Your relevant equations statement says that you are only using cos(mz), which leads to you technically evaluating the residue incorrectly. Also, this means that you are missing the sin term when doing the line integral. It doesn't matter, but it is good to keep track of it.
4) I know where the 2 went, but how you stated the residue theorem in the relevant equations is wrong. You stated it correctly in your reply.
5) That's fine, but you need to be careful as sometimes the integral around the semi-circle contour does not go to zero.

I realize I am being picky here, but sloppy habits can lead to incorrect solutions and answers when performing these types of integrals. Like I said, weird things can happen, like the integral around the semi-circle contour giving non-zero values. Also, using the f(z) I stated gives you the value of two integrals, because you end up showing that the original integral with sin in place of the cos is zero.

1) I know what you mean, but what you said doesn't make any sense.
2) Yes, but then you just leave it off. See (3).
3) You need to state that you are using the f(z) I posted. This is definitely the function that you want to perform the line integral on. Your relevant equations statement says that you are only using cos(mz), which leads to you technically evaluating the residue incorrectly. Also, this means that you are missing the sin term when doing the line integral. It doesn't matter, but it is good to keep track of it.
4) I know where the 2 went, but how you stated the residue theorem in the relevant equations is wrong. You stated it correctly in your reply.
5) That's fine, but you need to be careful as sometimes the integral around the semi-circle contour does not go to zero.

I realize I am being picky here, but sloppy habits can lead to incorrect solutions and answers when performing these types of integrals. Like I said, weird things can happen, like the integral around the semi-circle contour giving non-zero values. Also, using the f(z) I stated gives you the value of two integrals, because you end up showing that the original integral with sin in place of the cos is zero.

(1) the range $-R\leq x\leq R$ and $z=R\exp[i\theta]$ for $0\leq \theta\leq\pi$...is that a better definition?

(2) I made the claim that the real part of the residue of the function $exp[imz]/(z^2+1)^2$ would be the same as the residue of the function $\cos[mz]/(z^2+1)^2$. But as it turns out in the problem, there is no imaginary part to eliminate from the answer. Is this an okay claim to make?

(3) & (4) I see what you mean. I have it down correctly on paper, but again, I was only asking why we couldn't have the $m<0$, so I wasn't too worried about dotting my i's and crossing my t's

(5) Out of curiosity, when can it arise that the second term does not go to zero?

And don't worry about being picky, I enjoy criticism. Anything anyone can say to help me get better is something I look forward to.

1) That's good to me.
2) It isn't correct because when you take the derivative of Re(exp(imz)) you end up taking the derivative of just exp(imz), but Re(exp(imz))=cos(mz). The residue of Re(exp(imz))=cos(mz) and exp(imz), which is what you ended up doing (although it's not what you stated), might not be the same because they're different functions. That's where the mistake is, and that's why you want to use the f(z) I gave. This is so that your residue ends up what you need it to be. When you use this f(z), you will break up exp(imz) into cos(mz)+isin(mz) when doing the integral over [-R,R], and that isin(mz) is the imaginary term I am referring to.
5) I can't remember any off the top of my head. I'll try to find one.

Thanks a whole lot for all your help, I think I have the problem solved well.

Believe it or not, I'm in graduate school now and am seeing contour integrals for the first time (well, I sorta had it in my undergrad, but the professor got so confused about teaching it after 2 weeks that he gave up and moved onto the next section of the text!)

No problem. You basically had most of it, there were just some small technicalities. Yea, I didn't see them in my first course in complex analysis in undergraduate school at all. We barely got to residues. I had noticed that you were a physicist, and I resisted the temptation to say "silly physicist..." multiple times. :)

Are you taking some sort of mathematical methods course? I plan on taking a quantum field theory course soon, and I have heard they are often used there.

No problem. You basically had most of it, there were just some small technicalities. Yea, I didn't see them in my first course in complex analysis in undergraduate school at all. We barely got to residues. I had noticed that you were a physicist, and I resisted the temptation to say "silly physicist..." multiple times. :)

Are you taking some sort of mathematical methods course? I plan on taking a quantum field theory course soon, and I have heard they are often used there.

This is for my Electrodynamics course. My professor just introduced it to us on Thursday and assigned the problem, so I haven't yet seen where it would arise in ED. Before this, we've been covering Green's function (more on Dirichlet than Neumann problems) in relation to Poisson/Laplace's equation and were working towards Green's function in relation to Helmholtz's equation. Not sure where contour integrals will pop up in the next week or so, but my professor, so far, hasn't introduced anything we wouldn't need in the coming days/weeks.