# Thread: a challenging integral (perhaps)

1. ## a challenging integral (perhaps)

$\int^{\pi}_{-\pi} \frac{\sin nx}{(1+2^{x}) \sin x} \ dx$ for n =0,1,2,...

2. put $x\mapsto-x$ and your integral equals $\int_{-\pi }^{\pi }{\frac{2^{x}\sin nx}{\left( 1+2^{x} \right)\sin x}\,dx},$ thus $\int_{-\pi }^{\pi }{\frac{\sin nx}{\left( 1+2^{x} \right)\sin x}\,dx}\,+\,\int_{-\pi }^{\pi }{\frac{2^{x}\sin nx}{\left( 1+2^{x} \right)\sin x}\,dx}=\int_{-\pi }^{\pi }{\frac{\sin nx}{\sin x}\,dx}=2\int_{0}^{\pi }{\frac{\sin nx}{\sin x}\,dx}.$

on the last integral let $I_n=\int_0^\pi\frac{\sin nx}{\sin x}\,dx$ and get that $I_n-I_{n-2}=0,$ thus $I_n=\left\{\begin{array}{cl}\pi,&\text{if }n\text{ is odd.}\\
0,&\text{if }n\text{ is even.}\end{array}\right.$

3. Originally Posted by Krizalid
put $x\mapsto-x$ and your integral equals $\int_{-\pi }^{\pi }{\frac{2^{x}\sin nx}{\left( 1+2^{x} \right)\sin x}\,dx},$ thus $\int_{-\pi }^{\pi }{\frac{\sin nx}{\left( 1+2^{x} \right)\sin x}\,dx}\,+\,\int_{-\pi }^{\pi }{\frac{2^{x}\sin nx}{\left( 1+2^{x} \right)\sin x}\,dx}=\int_{-\pi }^{\pi }{\frac{\sin nx}{\sin x}\,dx}=2\int_{0}^{\pi }{\frac{\sin nx}{\sin x}\,dx}.$

on the last integral let $I_n=\int_0^\pi\frac{\sin nx}{\sin x}\,dx$ and get that $I_n-I_{n-2}=0,$ thus $I_n=\left\{\begin{array}{cl}\pi,&\text{if }n\text{ is odd.}\\
0,&\text{if }n\text{ is even.}\end{array}\right.$
There shouldn't be a two in front of $I_{n}$

$\int^{\pi}_{-\pi} \frac{\sin nx}{(1+2^{x})\sin x} \ dx = \int_{-\pi}^{0} \frac{\sin nx}{(1+2^{x})\sin x} \ dx + \int^{\pi}_{0} \frac{\sin nx}{(1+2^{x})\sin x} \ dx$

$= \int_{0}^{\pi} \frac{\sin nx}{(1+2^{-x})\sin x} \ dx + \int^{\pi}_{0} \frac{\sin nx}{(1+2^{x})\sin x} \ dx$

$= \int_{0}^{\pi} \frac{2^{x} \sin nx}{(1+2^{x})\sin x} \ dx + \int^{\pi}_{0} \frac{\sin nx}{(1+2^{x})\sin x} \ dx$

$= \int_{0}^{\pi} \frac{\sin nx}{\sin x} \ dx$

4. and for anyone who cares

$I_{n}-I_{n-2} = \int^{\pi}_{0} \frac{\sin nx}{\sin x} \ dx - \int^{\pi}_{0} \frac{\sin (n-2)x}{\sin x} \ dx$

$= \int^{\pi}_{0} \frac{\sin nx - \sin (n-2)x}{\sin x} \ dx$

$= 2 \int^{\pi}_{0} \frac{\sin x \cos (n-1)x}{\sin x} \ dx = 2 \int^{\pi}_{0} \cos (n-1)x \ dx$

$= \frac{2}{n-1} \sin (n-1)x \Big|^{\pi}_{0} = 0$

and obviously $I_{0} = 0$

and $I_{1} = \int^{\pi}_{0} \frac{\sin x}{\sin x} \ dx = \int^{\pi}_{0} \ dx = \pi$

5. note that i never said that your integral equals $2I_n,$ the latter was because $\frac{\sin nx}{\sin x}$ is even, what i actually did was

$\int_{-\pi }^{\pi }{\frac{\sin nx}{\left( 1+2^{x} \right)\sin x}\,dx}=\frac{1}{2}\left( \int_{-\pi }^{\pi }{\frac{2^{x}\sin nx}{\left( 1+2^{x} \right)\sin x}\,dx}+\int_{-\pi }^{\pi }{\frac{\sin nx}{\left( 1+2^{x} \right)\sin x}\,dx} \right),$ and that yields the same you got.

6. Originally Posted by Krizalid
note that i never said that your integral equals $2I_n,$ the latter was because $\frac{\sin nx}{\sin x}$ is even, what i actually did was

$\int_{-\pi }^{\pi }{\frac{\sin nx}{\left( 1+2^{x} \right)\sin x}\,dx}=\frac{1}{2}\left( \int_{-\pi }^{\pi }{\frac{2^{x}\sin nx}{\left( 1+2^{x} \right)\sin x}\,dx}+\int_{-\pi }^{\pi }{\frac{\sin nx}{\left( 1+2^{x} \right)\sin x}\,dx} \right),$ and that yields the same you got.
OK. My bad.

7. A general formula can be found for: $I(n,m) = \int_{-\pi}^{\pi}\left(\frac{\sin(n\cdot x)}{\sin(x)}\right)^mdx$

Remember $\sin(z)=\tfrac{\exp(z\cdot i)-\exp(-z\cdot i)}{2\cdot i}$ hence: $I(n,m) = \int_{-\pi}^{\pi}\left(\frac{e^{n\cdot x\cdot i}-e^{-n\cdot x\cdot i}}{e^{x\cdot i}-e^{-x\cdot i}}\right)^mdx$

Note that: $\tfrac{b^n-a^n}{b-a}=\sum_{k=0}^{n-1}a^k\cdot b^{n-1-k}$ let $a=e^{-x\cdot i}$; $b=e^{x\cdot i}$ then : $\frac{e^{n\cdot x\cdot i}-e^{-n\cdot x\cdot i}}{e^{x\cdot i}-e^{-x\cdot i}} = e^{(n-1)\cdot x\cdot i}\cdot \sum_{k=0}^{n-1}e^{-2 k\cdot x\cdot i }$

Thus: $I(n,m) = \int_{-\pi}^{\pi}e^{(n-1)\cdot m\cdot x\cdot i}\cdot \left(\sum_{k=0}^{n-1}e^{-2k\cdot x\cdot i }\right)^mdx = 2\pi \cdot [x^{(n-1)\cdot m}]\left\{ \left(\sum_{k=0}^{n-1}x^{2k}\right)^m \right\}$ - that is to say $2\pi$ multiplied by the coefficient of $x^{(n-1)\cdot m}$ of that polynomial in there - (*)

(*) Because $\int_{-\pi}^{\pi}e^{n\cdot x\cdot i}dx$ is $2\cdot\pi$ for $n=0$ and 0 for all other integer value of $n$.

In particular then:

• $I(2n+1, 1) = 2\pi$
• $I(n, 2) = 2 \pi \cdot n$, since our answer is the number of pairs of integers (x, y) with $0\leq x,y\leq n-1$ such that $x+y = n -1$, fix a valid $x$ and that determines $y$.