<s>[INST] $f(x) =\lim_{n \to \infty} \frac{(1+ \sin \frac{\pi}x)^n - 1} { (1+ \sin \frac{\pi}x)^n +1}$, $x \in (0,1]$. To show that $f$ is integrable on $[0,1]$ A function defined on $[0,1]$ by $f(0) = 0$ and 
$f(x) = \lim_{n \to \infty} \frac{(1+ \sin \frac{\pi}x)^n - 1} { (1+ \sin \frac{\pi}x)^n +1}$, $x \in (0,1]$. To show that $f$ is integrable on  $[0,1]$ and $\int_0^1f = 1 - \log4$.
My Try: We see that $f(x) = 0 , \forall x = 1, \frac 1 2, \frac 1 3, \ldots$ , 
for, $\frac 1 2 < x <1 \implies \pi < \frac{\pi}{x} < 2 \pi \implies 0 < 1+ \sin \frac{\pi}x <1$ 
how to find $f(x)$ from here?
and $\frac 1 3 < x < \frac 1 2 \implies 2\pi < \frac{\pi}{x} < 3 \pi \implies 1 < 1+ \sin \frac{\pi}x <2$
In a same way other will repeat... how to proceed from here?  
 [/INST] Let $\displaystyle f_n:(0,1]\to \mathbb R,x\to\frac{(1+ \sin \frac{\pi}x)^n - 1} { (1+ \sin \frac{\pi}x)^n +1}$ .
Let $x\in (0,1]$ be a fixed real number.
If $x\in (\frac{1}{2p+1},\frac{1}{2p})$ for some $p\in \mathbb N$, then $\sin (\frac{\pi}x)>0$. Hence $f_n(x)\to 1$ as $n\to \infty$
If $x\in (\frac{1}{2p+2},\frac{1}{2p+1})$ for some $p\in \mathbb N$, then $\sin (\frac{\pi}x)< 0$. Hence $f_n(x)\to -1$ as $n\to \infty$
This yields a closed form for $f$:


*

*if $x\in (\frac{1}{2p+1},\frac{1}{2p})$ then $f(x)=1$

*if $x\in (\frac{1}{2p+2},\frac{1}{2p+1})$ then $f(x)=-1$
To prove $f$ is integrable, you can use Lebesgue DCT theorem.
Then $\displaystyle \int_{0}^1 f = \lim_{n\to \infty} \int_{1/(n+1)}^1 f(t) dt=\lim_{n\to \infty} \sum_{k=1}^n \int_{1/(k+1)}^{1/k} (-1)^k=\sum_{k=1}^\infty (-1)^k (\frac{1}{k}-\frac{1}{k+1})=1-\ln(4).$
</s>