# Let $A=\pi^2\int_{0}^{1}\frac{\sin(\pi x)}{1 + \sin(\pi x)}dx$ and $B=\int_{0}^{\pi}\frac{x\sin( x)}{1 + \sin( x)}dx$. Find $\frac{A}{B}$.

I am trying to solve the following problem:

Let $$A=\pi^2\int_{0}^{1}\frac{\sin(\pi x)}{1 + \sin(\pi x)}dx \quad \text{and}\quad B=\int_{0}^{\pi}\frac{x\sin( x)}{1 + \sin( x)}dx.$$ Find the value of $$\dfrac{A}{B}$$.

I thought on using integration by parts.

It is clear that $$A=\pi^2\int_{0}^{1}\frac{\sin(\pi x)}{1 + \sin(\pi x)}dx = \pi\int_{0}^{\pi}\frac{\sin( x)}{1 + \sin( x)}dx.$$ If we consider $$f(x) = \dfrac{\sin( x)}{1 + \sin( x)}$$, we have that $$A = \pi\int_{0}^{\pi}f(x)dx$$ and $$B = \int_{0}^{\pi}xf(x)dx$$. Applying integration by parts, we obtain $$B = \int_{0}^{\pi}xf(x)dx = x^2f(x)\Big|_0^\pi - \int_{0}^{\pi} x(f(x)+xf'(x))dx.$$ Since $$f(\pi)=0$$, $$B = -\frac{1}{2}\int_{0}^{\pi} x^2f'(x)dx.$$ Likewise, we get that $$A = -\pi\int_{0}^{\pi}xf'(x)dx.$$ However, I don't see how to advance using integration by parts.

Can you give me some advice to find the desired value?

Lemma: $$\int_{0}^{\pi} xf(\sin(x))\, dx = \frac{\pi}{2}\int_{0}^{\pi} f(\sin(x)) \, dx$$ Proof: Taking the substitution $$u = \pi -x$$ gives us $$\int_{0}^{\pi} xf(\sin(x))\, dx = \int_{\color{blue}{\pi}}^{\color{blue}{0}}(\pi - u)f(\sin(\pi - u)) (\color{blue}{- \, du}) = \int_{0}^{\pi} (\pi - u)f(\sin(\pi - u)) \, du$$ but since $$\sin(\pi - u)=\sin(u)$$ from the definition of the sine function, we see that $$\require{cancel}$$ \begin{align} \underbrace{ \int_{0}^{\pi} xf(\sin(x))\, dx }_{\color{purple}{I}} = \int_{0}^{\pi} (\pi - u)f(\sin(u)) \, du &= \pi\int_{0}^{\pi} f(\sin(u)) \, du - \underbrace{\int_{0}^{\pi} uf(\sin(u)) \, du}_{\color{purple}{I}}\\ \implies 2 \color{purple}{I} &= \pi\int_{0}^{\pi} f(\sin(u))\, du\\ \implies \int_{0}^{\pi} xf(\sin(x))\, dx &= I = \frac{\pi}{2}\int_{0}^{\pi} f(\sin(u)) \, du \end{align} Q.E.D.
With the previous lemma the problem becomes simple. Notice that $$\frac{\sin(x)}{1+ \sin(x)}$$ is indeed $$f(x) = \frac{x}{1+x}$$ composed with $$\sin(x)$$, so we can apply the lemma to integral $$B$$ and get that $$B = \int_{0}^{\pi} x\underbrace{\frac{\sin(x)}{1+ \sin(x)}}_{f(\sin(x))} \, dx = \frac{\pi}{2} \int_{0}^{\pi} \frac{\sin(x)}{1+ \sin(x)} \,dx \tag{1}$$ Now, for $$A$$ we take the substitution $$u = \pi x$$. This gives $$A = \pi^2 \int_{0}^{1}\frac{\sin(\pi x)}{1+ \sin(\pi x)}\, dx = \pi^{\cancel{2}}\int_{\color{blue}{0}}^{\color{blue}{\pi}}\frac{\sin(u)}{1+ \sin(u)}\left( \frac{\color{blue}{du}}{\cancel{\color{blue}{\pi}}}\right)=\pi \int_{0}^{\pi} \frac{\sin(u)}{1+ \sin(u)} \,du \tag{2}$$ And combining equations $$(1)$$ and $$(2)$$ we get $$\frac{A}{B} = \frac{\cancel{\pi} \cancel{\int_{0}^{\pi} \frac{\sin(u)}{1+ \sin(u)} \,du}}{\frac{\cancel{\pi}}{2} \cancel{\int_{0}^{\pi} \frac{\sin(x)}{1+ \sin(x)} \, dx}} = \boxed{2}$$
$$B+B=\pi\int\dfrac{\sin x}{1+\sin x}dx$$
Set $$x=\pi y\implies dx=\pi dy$$ to find $$B+B=A$$