# Compute $\int_0^\pi\frac{\cos nx}{a^2-2ab\cos x+b^2}\, dx$

How to compute the following integral \begin{equation} \int_0^\pi\frac{\cos nx}{a^2-2ab\cos x+b^2}\, dx \end{equation}

I have been given two integral questions by my teacher. I cannot answer this one. I have also searched the similar question here but it looks like nothing is similar so I think this is not a duplicate. I could compute the integral if \begin{equation} \int_0^\pi\frac{dx}{a^2-2ab\cos x+b^2} \end{equation} The $\cos nx$ part makes the integral is really difficult. I want to use the result to compute this integral (the real question given by my teacher) \begin{equation} \int_0^\pi\frac{x^2\cos nx}{a^2-2ab\cos x+b^2}\, dx \end{equation} My question is how to compute the first integral (in the grey-shaded part) preferably with elementary ways (high school methods)?

• Is $n$ an integer? – Peter Woolfitt May 31 '14 at 10:44
• @PeterWoolfitt I think $n$ is not necessarily integer – Anastasiya-Romanova 秀 May 31 '14 at 10:54
• For $n=0$, use the Weierstrass substitution to show that $I_0=\dfrac\pi{a^2-b^2}$ . Then try establishing the recurrence relation $I_n=\dfrac ba\cdot I_{n-1}$ , perhaps by using some basic or elementary angle addition formulas for the cosine function. – Lucian May 31 '14 at 11:47
• Unfortunately, the formula for integers does not apply to fractional cases, so differentiating it is not possible, since it is discontinuous, and a more general formula would imply special functions. Indeed, even for small values of n, the integral your teacher gave you requires polylogarithms. – Lucian May 31 '14 at 12:01
• @Lucian I tried but failed. I've asked my friend, $n$ only for integer. The answer is $\left(\cfrac{a}{b}\right)^n\cfrac{\pi}{b^2-a^2}$ – Anastasiya-Romanova 秀 May 31 '14 at 12:15

Let $I_n(a,b)$ be the desired integral. Note that $I_n(a,b)=I_n(b,a)$, and $I_n(a,b)=I_n(-a,-b)$. So, we may suppose that $|b|< a$ Note that \eqalign{ \frac{a^2-b^2}{a^2-2ab\cos x+b^2}&=\frac{a}{a-e^{ix}b}+\frac{be^{-ix}}{a-e^{-ix}b}\cr &=\sum_{n=0}^\infty \left(\frac{b}{a}\right)^ne^{inx}+\frac{be^{-ix}}{a}\sum_{n=0}^\infty \left(\frac{b}{a}\right)^ne^{-inx}\cr &=1+\sum_{n=1}^\infty \left(\frac{b}{a}\right)^ne^{inx}+ \sum_{n=1}^{\infty} \left(\frac{b}{a}\right)^{n}e^{-inx}\cr &=1+2\sum_{n=1}^\infty \left(\frac{b}{a}\right)^n\cos(n x) } It follows, using the uniform convergence of the series on $[0,\pi]$, that $$\int_0^\pi\frac{(a^2-b^2)\cos(mx)}{a^2-2ab\cos x+b^2}dx =\int_0^\pi\cos(mx)dx+2\sum_{n=1}^\infty \left(\frac{b}{a}\right)^n\int_0^\pi\cos(n x)\cos(mx)dx$$ But $\int_0^\pi\cos(n x)\cos(mx)dx=0$ if $n\ne m$, and $\int_0^\pi\cos^2(n x)dx=\pi/2$ if $n\ne0$. So \eqalign{I_m(a,b)= \int_0^\pi\frac{\cos(mx)}{a^2-2ab\cos x+b^2}dx &=\left\{\matrix{\frac{\pi}{a^2-b^2}&\hbox{if}&m=0\cr \frac{\pi}{a^2-b^2}\left(\frac{b}{a}\right)^m&\hbox{if}&m\ne0 } \right.} which is the desired formula for $|b|<a$.

• Very clever answer Professor, +1. You use Taylor series for $\displaystyle\frac{1}{1-y}=\sum_{n=1}^\infty y^n$ and it holds for $|y|<1$, does it also hold if $y$ is a complex number? What does this notation actually mean $|...|$? Absolute value for $y$ is a negative number or absolute value for $y$ is a complex number? Perhaps both? – Anastasiya-Romanova 秀 Jun 1 '14 at 14:25
• I think the case for $m\neq0$, the answer should be $\displaystyle\frac{\pi}{a^2-b^2}\left(\frac{b}{a}\right)^m$. – Anastasiya-Romanova 秀 Jun 1 '14 at 15:24
• @V-Moy: BTW, did you teacher presented you a solution to this problem? – Pranav Arora Jun 1 '14 at 17:34
• @GrahamHesketh Thanks for the link that you gave Sir. I really like it. $\ddot\smile$ – Anastasiya-Romanova 秀 Jun 2 '14 at 10:57
• Of course but they often keep it for their selves except when they prove it their work to our teacher. It's hard to make friends in this course because almost all of them individualistic. – Anastasiya-Romanova 秀 Jun 2 '14 at 11:10

Assume for definiteness that $a>b>0$.

Method 1:

For integer $n\geq0$, we can rewrite the integral as $$\frac{1}{4ab}\int_{-\pi}^{\pi}\frac{e^{in x}dx}{\cosh\gamma-\cos x}=\frac{1}{2ia^2}\oint_{|z|=1}\frac{z^{n}dz}{(z-e^{-\gamma})(1-e^{-\gamma}z)},$$ where $e^{\gamma}=\frac{a}{b}$. Computing the residue at $z=e^{-\gamma}$, we find for the last integral $$2\pi i \cdot \frac{1}{2ia^2}\cdot\frac{\left(\frac{b}{a}\right)^n}{1-\frac{b^2}{a^2}}=\frac{\pi}{a^2-b^2}\left(\frac{b}{a}\right)^n.$$

Method 2:

Similarly rewrite the integral as $$\frac{1}{2(a^2-b^2)}\int_{-\pi}^{\pi}\left(\frac{1}{1-\frac{b}{a}e^{ix}}+\frac{\frac{b}{a}e^{-ix}}{1-\frac{b}{a}e^{-ix}}\right)e^{in x}dx.$$ Then expand the integrand into series in $\frac{b}{a}$ and use that $\displaystyle\int_{-\pi}^{\pi}e^{inx}dx=2\pi\cdot\delta_{n,0}$.

• Thanks for your answer Sir but I'm not familiar with this method. I also know that $a^2-2ab\cos x+b^2=(a-be^{ix})(a-be^{-ix})$. +1 for your effort. (ô‿ô) – Anastasiya-Romanova 秀 May 31 '14 at 12:31

I don't have a proof yet, but with some computer assistance, this is what I believe to be the answer when $n$ is a non-negative integer.

\begin{align*} \int_0^\pi\frac{\cos nx}{a^2-2ab\cos x+b^2}\, dx &= \frac{\displaystyle \left(\left(a^{2n}+b^{2n}\right)\, \left(\Big\lvert \frac{a+b}{a-b}\Big\rvert +1\right)-2\, \sum_{k=0}^{2n}a^k\, b^{2n-k}\right)\, \pi}{\displaystyle 2\, a^n\, b^n\, (a+b)^2} \end{align*}

I think there might be a reduction formula for this, but at the moment I don't know.

• For integer $n$ the result is (very) easy to get by residues. – Start wearing purple May 31 '14 at 11:18
• $\bigg(\dfrac ba\bigg)^n\dfrac\pi{a^2-b^2}~$ looks much nicer. – Lucian May 31 '14 at 11:21
• Mr. @O.L. Please share your thought. I'd love to see it $\ddot\smile$ – Anastasiya-Romanova 秀 May 31 '14 at 11:23
• Mr. @Lucian also. $\ddot\smile$ – Anastasiya-Romanova 秀 May 31 '14 at 11:24
• Oh, I see. Thanks for your suggestions and the simplified form! I'm not adept with complex analysis yet. I too would like to see your answers. – gar May 31 '14 at 11:24