Let $n\in\mathbb{N}$ and $x\in]0,\pi[$, I am asked to calculate the following : $$ I_n = \int_0^{\pi} \dfrac{\cos(nx)\cos(x) - \cos(nt)\cos(t)}{\cos(x) -\cos(t)}dt$$ From testing on small values of $n$, it seems that this integral is equal to $n\pi\cdot \cos^n(x)$ but I can't seem to prove it. I tried finding a recurrence formula but didn't succeed.

Here is my working for $n=0$, $n=1$ and $n=2$ : For $n=0$, $$ I_0=\int_0^{\pi}\dfrac{\cos(x) -\cos(t)}{\cos(x) - \cos(t)}dt = \pi$$ For $n=1$, $$ I_1 = \int_0^{\pi} \dfrac{\cos^2(x) -\cos^2(t)}{\cos(x)-\cos(t)}dt=\int_0^{\pi}\cos(x) + \sin(t)dt = \pi\cdot \cos(x)$$ For $n=2$ : $$ I_2 = \int_0^{\pi} \dfrac{2\cos^3(x) - 2\cos^3(t) -\cos(x) + \cos(t)}{\cos(x) - \cos(t)}dt$$ $$ I_2 = 2\int_0^{\pi}\cos^2(x) +\cos(x)\cos(t) + cos^2(t) dt - \pi$$ $$ I_2 = 2\pi\cos^2(x) + \int_0^{\pi}\cos(2t)+1dt - \pi$$ $$ I_2 = 2\pi\cos^2(x) $$

This is my first post here, please tell me if I did anything wrong. I tried searching this integral on this website without any success.

  • 2
    $\begingroup$ Hello, welcome to MSE. This isn't a bad post as a new contributor, but you (and us) would benefit by adding some proofs for your 'testing' - show us your working for $n=1,2$. Good job on using MathJax! $\endgroup$ – TheSimpliFire Jan 4 at 16:56
  • $\begingroup$ @TheSimpliFire Added my working for n = 1, 2, thanks for the tip and the welcome., I need to calculate this integral to complete a problem from by problemset, which consists in calculating $\int_0^{\pi} \dfrac{\cos(nx) - \cos(nt)}{\cos(x) - \cos(t)}dt$ $\endgroup$ – aleph0 Jan 4 at 17:13
  • $\begingroup$ Very nice solution (+1). $\endgroup$ – TheSimpliFire Jan 4 at 17:14
  • $\begingroup$ @aleph0 So you need to calculate$$\int\limits_0^{\pi}\mathrm dt\,\frac {\cos nx-\cos nt}{\cos x-\cos t}$$? $\endgroup$ – Frank W. Jan 4 at 17:16
  • 1
    $\begingroup$ Are you sure that the result is correct? $\endgroup$ – Zacky Jan 4 at 17:41

Here's a solution that only rests on the following simple trigonometric identity: $$\cos(a+b)+\cos(a-b)=2\cos(a)\cos(b)\tag{1}$$ We'll get back to it later, but for now, notice that $$\begin{split} I_n(x)&=\int_0^{\pi} \frac{\cos(nx)\cos(x) - \cos(nt)\cos(t)}{\cos(x) -\cos(t)}dt\\ &=\int_0^{\pi}\frac{[\cos(nx)-\cos(nt)]\cos(x) + \cos(nt)[\cos(x)-\cos(t)]}{\cos(x) -\cos(t)}dt\\ &=\cos(x)\int_0^{\pi}\frac{\cos(nx)-\cos(nt)}{\cos(x) -\cos(t)}dt+\int_0^\pi\cos(nt)dt \end{split}$$ In other words, $$I_n(x)=\cos(x)J_n(x)+\pi\delta_{n=0}\tag{2}$$ where we define $$J_n(x)=\int_0^\pi \frac{\cos(nx)-\cos(nt)}{\cos(x)-\cos(t)}dt$$ and the Kronecker symbol $\delta_{n=0}$, which is equal $0$, unless $n=0$, in which case it's equal to $1$.

Now, let's go back to (1). Plugging $a=nx$ and $b=x$ into that identity implies that $$\cos((n+1)x)+\cos((n-1)x)=2\cos x \cos(nx)$$ Subtracting the same equation with $t$ to this one yields $$ \begin{split} \cos((n+1)x)-\cos((n+1)t) \\ +\cos((n-1)x)-\cos((n-1)t)=\\ 2\cos x \cos(nx)-2\cos(t)\cos(nt) \end{split}$$ Dividing by $\cos(x)-\cos(t)$, and integrating over $[0,\pi]$ leads to $$J_{n+1}(x)+J_{n-1}(x)=2I_n(x)\tag{3}$$ Finally, combining [2] and [3] gets us, for $n\geq 0$, $$J_{n+2}(x)-2\cos(x)J_{n+1}(x)+J_{n}(x)=0$$

The solution to this second-order recurrence relation is $$J_n(x)=\alpha e^{inx}+\beta e^{-inx}$$ Since, $J_0=0$ and $J_1=\pi$, $$J_n(x)=\frac {\pi \sin(nx)}{\sin x}$$ and $$I_n(x)=\pi\cos(x)\frac{\sin(nx)}{\sin(x)} \mbox{ for } n\geq 1 \mbox{, and }I_0=\pi$$

  • $\begingroup$ Thanks a lot for that solution ! $\endgroup$ – aleph0 Jan 4 at 22:41
  • $\begingroup$ You're welcome! $\endgroup$ – Stefan Lafon Jan 4 at 23:05
  • $\begingroup$ I think there is a small mistake: We have $I_n = (J_{n+1} \color{red}{+} J_{n-1})/2$, which turns the final result into $I_n (x) = \pi \cos(x) \frac{\sin(n x)}{\sin(x)}$ . $\endgroup$ – ComplexYetTrivial Jan 5 at 8:27
  • $\begingroup$ Thanks for catching this! I updated the answer. $\endgroup$ – Stefan Lafon Jan 6 at 0:40

A nice way to evaluate generalized integrals is to consider them as the coefficients of an infinite series. Therefore, the coefficient of the $n$th term is simply the integral under question. Before we begin though, there is one identity to note:

$$\sum\limits_{n\geq0}z^n\cos nx=\frac {1-z\cos x}{z^2-2z\cos x+1}$$ Proof: Rewrite $\cos nx$ as the real part of $e^{nix}$. Using the infinite geometric sequences, we get that$$\sum\limits_{n\geq0}\left(ze^{ix}\right)^n=\frac 1{1-ze^{ix}}$$Now, take the real part of both sides. Clearly, the left - hand side becomes $z^n\cos nx$. Meanwhile, the right - hand side becomes, through some clever rationalization$$\begin{align*}\operatorname{Re}\left[\frac 1{1-ze^{ix}}\right] & =\operatorname{Re}\left[\frac 1{1-z\cos x-zi\sin x}\right]\\ & =\operatorname{Re}\left[\frac {1-z\cos x+zi\sin x}{(1-z\cos x)^2+z^2\sin^2x}\right]\\ & =\frac {1-z\cos x}{z^2-2z\cos x+1}\end{align*}$$completing the proof.

With that in mind, we are ready to begin. Since the OP has stated in the comments that he is trying to evaluate the integral$$I_n=\int\limits_0^{\pi}\mathrm dt\,\frac {\cos nx-\cos nt}{\cos x-\cos t}$$I will show a way to evaluate it in this answer. To wit, denote the generating function of the integral as $G(z)$


And remember that the coefficient of $z^n$ simply gives $I_n$. Interchange the sum and the integral, and using the identity we've derived above, get

$$\begin{align*}G(z) & =\int\limits_0^{\pi}\frac {\mathrm dt}{\cos x-\cos t}\sum\limits_{n\geq0}z^n\biggr[\cos nx-\cos nt\biggr]\\ & =\int\limits_0^{\pi}\frac {\mathrm dt}{\cos x-\cos t}\left[\frac {1-z\cos x}{z^2-2z\cos x+1}-\frac {1-z\cos t}{z^2-2z\cos t+1}\right]\end{align*}$$

Combining the two fractions, and recalling that any terms in $z$ are constants, the function becomes

$$G(z)=\frac {z(1-z^2)}{z^2-2z\cos x+1}\int\limits_0^{\pi}\frac {\mathrm dt}{z^2-2z\cos t+1}$$

The remaining integral can be easily evaluated using a Weierstrass substitution. Substitute $w=\tan\left(\tfrac t2\right)$ so that

$$\begin{array}{|c|c|c|}\hline w=\tan\left(\dfrac t2\right) & \mathrm dt=\dfrac {2\,\mathrm dw}{1+w^2} & \cos t=\dfrac {1-w^2}{1+w^2}\\\hline\end{array}$$

The remaining rational function can be evaluated in an elementary fashion

$$\begin{align*}G(z) & =\frac {2z(1-z^2)}{z^2-2z\cos x+1}\int\limits_0^{\infty}\frac {\mathrm dw}{w^2(1+z)^2+(1-z)^2}\\ & =\frac {2z}{z^2-2z\cos x+1}\arctan\left(\frac {1+z}{1-z}w\right)\,\Biggr\rvert_0^{\infty}\\ & =\frac {\pi z}{z^2-2z\cos x+1}\end{align*}$$

From the second line, it's important to observe that the argument of the inverse tangent will remain positive if and only if $|z|<1$. When $|z|<1$, then the denominator is positive, as well as the numerator. Therefore, $\tfrac {1+z}{1-z}>0$. However, if $|z|>1$, then the argument is less than zero and there is an extra negative sign. For the purpose of this question, we'll consider when $|z|<1$.

Now all we have to do is find the coefficient of $z^n$. There is a nice and convenient way to do this by using

$$2\cos x=e^{ix}+e^{-ix}$$

Factoring the denominator by grouping gives

$$\begin{align*}\frac z{z^2-2z\cos x+1} & =\frac z{(1-ze^{ix})(1-ze^{-ix})}\\ & =z\sum\limits_{k\geq0}z^k e^{kix}\sum\limits_{l\geq0}z^l e^{-lix}\end{align*}$$

Now observe what happens when we expand the products together$$\begin{multline}(1+ze^{ix}+z^2e^{2ix}+\cdots)(1+ze^{-ix}+z^2e^{-ix}+\cdots)\\=1+z(e^{ix}+e^{-ix})+z^2(e^{2ix}+1+e^{-2ix})+\cdots\end{multline}$$

The sum within the parenthesis seems to start off at the index of the $n$th term and decrease by a factor of two! Using this, it's possible to rewrite the coefficients conveniently as

$$a_k=\sum\limits_{m=0}^ke^{(k-2m)ix}=\frac {\sin x(k+1)}{\sin x}$$

Hence$$\frac {\pi z}{z^2-2z\cos x+1}=\pi\sum\limits_{k\geq1}\frac {\sin xk}{\sin x}z^k$$

And setting $k$ as $n$ gives the term $z^n$. Therefore, our integral is simply$$\int\limits_0^{\pi}\mathrm dt\,\frac {\cos nx-\cos nt}{\cos x-\cos t}\color{blue}{=\frac {\pi\sin xn}{\sin x}}$$

  • $\begingroup$ @StefanLafon I'm having a little bit of trouble with that; more than I thought initially. I'm trying to mold the infinite sum into$$\frac 1{z^2-2z\cos x+1}$$on the right - hand side and a $z^n$ term on the left. It's not going very well I must say $\endgroup$ – Frank W. Jan 4 at 18:00
  • $\begingroup$ Impressive. To find the coefficients, notice that $\frac {2i\sin x} {z^2-2x\cos(x)+1} = \frac 1 {z+e^{-ix}}-\frac 1 {z+e^{ix}}$. $\endgroup$ – Stefan Lafon Jan 4 at 18:01
  • $\begingroup$ Correct the sign mistake in previous comment and show the $n$th integral is $$I_n=\pi\frac{\sin nx}{\sin x}$$ $\endgroup$ – Did Jan 4 at 18:05
  • $\begingroup$ Thanks a lot for your time and effort. This is a very interesting solution but the use of generating functions seems a bit overkill and I don't understand all the details, as I have not yet studied generating functions in details. This problem is supposed to be a medium difficulty problem of first year at university . The tip below the problem suggested to calculate the integral in the question. $\endgroup$ – aleph0 Jan 4 at 18:10
  • 1
    $\begingroup$ @Zacky Oh okay. I missed it. $\endgroup$ – Frank W. Jan 4 at 18:55

Completing Frank's solution:

$$ [z^n]\frac{\pi z}{z^2-2z\cos x+1} = \frac{\pi}{2}[z^{n}]\left(\frac{1}{z-e^{ix}}+\frac{1}{z-e^{-ix}}\right) $$ equals, by geometric series, $$ \frac{\pi}{2}\left(-e^{-(n+1)ix}-e^{(n+1)ix}\right)=-\pi\cos((n+1)x). $$


I will do the integral for $n=3$, unfortunately this will disprove your given result. (unless I did a mistake) $$I_3= \int_0^\pi \frac{\cos(3x)\cos x -\cos(3t)\cos t}{\cos x-\cos t}dt$$ Since $\cos(3 y)=4\cos^3 y -3\cos y$ we have: $$\cos(3x)\cos x -\cos (3t)\cos t=4(\cos^4 x-\cos^4t)-3(\cos^2 x-\cos^2 t)$$ $$=4(\cos x-\cos t)(\cos x+\cos t) (\cos^2 x+\cos^2t)-3(\cos x-\cos t)(\cos x+\cos t)$$ $$\Rightarrow I_3=\int_0^\pi (\cos x+\cos t)(4(\cos ^2 x+\cos^2 t)-3)dt$$ $$\overset{\pi-t\to t}=\int_0^\pi (\cos x-\cos t)(4(\cos^2 x+\cos^2 t)-3)dt$$ $$\Rightarrow 2I_3=2\cos x\int_0^\pi (4(cos^2 x+\cos^2 t)-3)$$ $$\Rightarrow I_3= 4\pi \cos^3 x +\cos x \underbrace{\int_0^\pi \cos^2 tdt}_{=\frac{\pi}{2}}-3\pi \cos x=2\pi(\cos x+2\cos(3x))$$

For $n=4$ we have: $$\cos(4x)=8\cos^4 x-8\cos^2 x+1$$ Denoting $cx=\cos x$ and $ct=\cos t\,$ we get the integrand to be: $$\frac{8(cx^5-ct^5)-8(cx^3-ct^3)+(cx-ct)}{cx-ct}$$ And using the fact that: $$a^5-b^5=(a-b)(a^4+a^3b+a^2b^2+ab^3+b^4$$ $$\Rightarrow I_4=8\int_0^\pi(cx^4+cx^3 ct+cx^2 ct^2 +cx ct^3+ct^4)dt$$ $$-8\int_0^\pi (cx^2+cxct+ct^2) dt +\int_0^\pi dt$$ We have: $$\int_0^\pi ct dt=\int_0^\pi ct^3 dt =0$$ $$\int_0^\pi ct^2 dt= \frac{\pi}{2},\ \int_0^\pi ct^4 dt=\frac{3\pi}{8}$$ $$\Rightarrow I_4=(8\pi cx^4 +4\pi cx^2 +3\pi )-(8\pi cx^2 +4\pi)+\pi$$ $$=8\pi cx^4 -4\pi cx^2 =4\pi \cos^2 x \cos(2x)$$

  • 1
    $\begingroup$ I'm getting a slightly different answer too than what the OP conjectured. $\endgroup$ – Frank W. Jan 4 at 18:00
  • 1
    $\begingroup$ It seems like it only works for $n=1$ and $n=2$ until now. Note that even $n=0$ fails. $\endgroup$ – Zacky Jan 4 at 18:01
  • $\begingroup$ Thanks for doing that. I guess my conjecture was wrong... $\endgroup$ – aleph0 Jan 4 at 18:08

An alternative solution to the problem:

For $n \in \mathbb{N}$ and $x \in (0,\pi)$ define $$J_n (x) \equiv \int \limits_0^\pi \frac{\cos(n x) - \cos(n t)}{\cos(x) - \cos(t)} \, \mathrm{d} t \, . $$ We can use the identities ($(2)$ follows from the geometric progression formula) \begin{align} \cos(\xi) - \cos(\tau) &= - 2 \sin \left(\frac{\xi + \tau}{2}\right) \sin \left(\frac{\xi - \tau}{2}\right) \, , \, \xi,\tau \in \mathbb{R} \, , \tag{1} \\ \frac{\sin(n y)}{\sin(y)} &= \mathrm{e}^{-\mathrm{i}(n-1)y} \sum \limits_{k=0}^{n-1} \mathrm{e}^{2\mathrm{i} k y} \, , \, n \in \mathbb{N} \, , \, y \in \mathbb{R} \, , \tag{2} \\ \int \limits_0^{2 \pi} \mathrm{e}^{\mathrm{i}(k-l) t} \, \mathrm{d} t &= 2 \pi \delta_{k,l} \, , \, k,l \in \mathbb{Z} \, , \tag{3} \end{align} to compute \begin{align} J_n (x) &= \frac{1}{2} \int \limits_0^{2\pi} \frac{\cos(n x) - \cos(n t)}{\cos(x) - \cos(t)} \, \mathrm{d} t \stackrel{(1)}{=} \frac{1}{2} \int \limits_0^{2\pi} \frac{\sin \left(n\frac{x+t}{2}\right)}{\sin \left(\frac{x+t}{2}\right)} \frac{\sin \left(n\frac{x-t}{2}\right)}{\sin \left(\frac{x-t}{2}\right)} \, \mathrm{d} t \\ &\stackrel{(2)}{=} \frac{1}{2} \mathrm{e}^{-\mathrm{i} (n-1) x} \sum \limits_{k,l=0}^{n-1} \mathrm{e}^{\mathrm{i} (k+l) x} \int \limits_0^{2 \pi} \mathrm{e}^{\mathrm{i}(k-l) t} \, \mathrm{d} t \stackrel{(3)}{=} \pi \mathrm{e}^{-\mathrm{i} (n-1) x} \sum \limits_{k=0}^{n-1} \mathrm{e}^{2 \mathrm{i} k x} \\ &\stackrel{(2)}{=} \pi \frac{\sin(nx)}{\sin(x)} \, . \end{align} This result directly leads to \begin{align} I_n(x) &\equiv \int \limits_0^\pi \frac{\cos(n x) \cos(x) - \cos(n t) \cos(t)}{\cos(x) - \cos(t)} \, \mathrm{d} t = \int \limits_0^\pi \left[\cos(x)\frac{\cos(n x) - \cos(n t)}{\cos(x) - \cos(t)} + \cos(n t)\right]\, \mathrm{d} t \\ &= \cos(x) J_n(x) + 0 = \pi \cos(x) \frac{\sin(nx)}{\sin(x)} \, . \end{align}

  • $\begingroup$ Great solution ! Thank you. $\endgroup$ – aleph0 Jan 5 at 11:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.