# Is there an analytical solution for the integral of a ratio of sin functions like this one? [closed]

Has anyone encountered the following integral ?: $$I = \int_{0}^{\pi/2}\frac{\sin\left(ax\right)}{\sin\left(bx\right)}\,{\rm d}x$$ Besides the numerical computation, is there a general analytic solution ?.

• For many cases, e.g. $a=2,b=3$, WA says the integral doesn't converge. (I wonder which are such cases, generally?) Commented Jun 20 at 15:32
• @r.e.s. It won't converge if the denominator is zero when the numerator is not, and this is probably an equivalence. Commented Jun 20 at 15:41
• @J.S. Right, I should have said "for which $(a,b)$ is this the case?" -- i.e., for which the denominator is zero when the numerator isn't. Commented Jun 20 at 15:47
• Unless $a,b$ are special values, the integrand will not be related to the upper limit $\pi/2$. So this definite integral will likely be as difficult as the indefinite integral. Commented Jun 20 at 15:49
• @pstall : You really should edit the constraints on $a$ and $b$ in terms of $c$ into your Question since that's your actual question. Commented Jun 20 at 17:21

If $$a$$ and $$b$$ are arbitrary, there's nothing special about $$\pi/2$$, and you're basically asking for an antiderivative of $$\sin(ax)/\sin(bx)$$. This probably does not have a "closed form": it certainly is not elementary.

On the other hand, if $$a$$ is a positive integer and $$b=1$$, you can use $$\sin(ax)/\sin(x) = U_{a-1}(\cos(x))$$ where $$U_n$$ are Chebyshev polynomials of the second kind. If $$a$$ is odd, the integral is $$\pi/2$$, if even it seems to be

$$\int_{0}^{\pi/2} \frac{\sin(2nx)}{\sin(x)} \; dx = \sum_{i=0}^{n-1} \frac{2 (-1)^i}{2i+1}$$

lets use Euler's formula So $$I(a,b)=2i \int_0^{\frac{\pi}{2}} \frac{e^{-bix}}{1-e^{-2bix}} \sin (ax)dx$$ So the converge of integral is when $$b\in (-2,2) , b\ne 0$$ So $$I(a,b)=2i\sum_{k=0}^\infty \int_0^{\frac{\pi}{2}} e^{-bi(2k+1)x} \sin (ax)dx$$ and since $$I(a,b)$$ is real So we can take real part only So $$I(a,b)=2\sum_{k=0}^\infty \int_0^{\frac{\pi}{2}} \sin(b(2k+1)x) \sin (ax)dx$$ now if $$a\ne n b , n\in N$$ we have $$I(a,b)=2\sum_{k=0}^\infty \frac{b \sin(\frac{\pi}{2}a)\cos(\frac{\pi}{2}b(2k+1))-a \sin(\frac{\pi}{2}b(2k+1))\cos(\frac{\pi}{2}a)}{a^2-b^2(2k+1)^2}$$ I don't have ideas to simplify this series but maybe we can use some special functions to get the closed form for that

but for $$a=nb , n\in N=\{1,2,3,...\}$$ we have $$I(nb,b)=\int_0^{\frac{\pi}{2}} \frac{1-e^{-2bnix}}{1-e^{-2bix}} e^{(nb-b)ix} dx=\sum_{k=0}^{n-1} \int_0^{\frac{\pi}{2}} e^{-2bk ix} e^{(nb-b)ix} dx$$ So by taking real part $$I(nb,b)=\sum_{k=0}^{n-1} \int_0^{\frac{\pi}{2}} \cos\left(bx(n-2k-1)\right)dx$$ So $$I(nb,b)=\frac{1}{b}\sum_{k=0}^{n-1} \frac{\sin\left(\frac{\pi}{2}b (n-2k-1)\right)}{n-2k-1}$$ note : take limit when $$k=\frac{n-1}{2}$$

for example if $$b=1 , a=2n$$ we get $$I(2n,1)=\sum_{k=0}^{2n-1} \frac{\sin\left(\frac{\pi}{2} (2n-2k-1)\right)}{2n-2k-1}=\sum_{k=0}^{2n-1} \frac{(-1)^{n-k-1}}{2n-2k-1}=\sum_{k=0}^{n-1} \frac{2(-1)^{k}}{2k+1}$$ which is same results given in the answers

• T.Y. for your result. I will evaluate the series as far as reasonable with some specific values for a and b. Commented Jun 20 at 22:21

From OP's comments to the question:

Let $$0. Then (via Mathematica 12.3), \begin{align*} \int_0^{\pi/2}\; \frac{\sin(c x)}{\sin((1-c)x)} \,\mathrm{d}x &= \frac{-1}{2-2c} \left( (2-2c) {}_2 F_1\left(1, \frac{1}{2-2c}; 1+\frac{1}{2-2c}; -\mathrm{e}^{\mathrm{i}\pi c} \right) - \right. \\ & \left. \mathrm{i}\pi \cot\left(\frac{\pi}{2-2c}\right)+\left(-\mathrm{e}^{\mathrm{i}\pi c}\right)^{1/(2-2c)} \mathrm{B}_{-\mathrm{e}^{\mathrm{i}\pi c}} \left( 1 - \frac{1}{2-2c}, 0 \right) \right) \text{,} \end{align*} where $$B_z(a,b)$$ is the incomplete beta function and $${}_2 F_1(\vec{a}; \vec{b}; z)$$ is a generalized hypergeometric series and \begin{align*} \int_0^{\pi/2}\; \frac{\sin((2-c) x)}{\sin((1-c)x)} \,\mathrm{d}x &= \frac{-1}{2-2c} \left( \left(-\mathrm{e}^{\mathrm{i}\pi c} \right)^{1/(2-2c)} \left( \left(-\mathrm{e}^{\mathrm{i}\pi c}\right)^{1/(c-1)} \mathrm{B}_{-\mathrm{e}^{\mathrm{i}\pi c}} \left( 1+\frac{1}{2-2c}, 0 \right) + \right.\right. \\ &\left.\left. \mathrm{B}_{-\mathrm{e}^{\mathrm{i}\pi c}} \left(\frac{-1}{2-2c}, 0 \right) \right) - \mathrm{i}\pi \cot\left( \frac{\pi}{2-2c} \right) \right) \end{align*}

It's plausible that there are only a finite number of typo's in the above.

I have no idea how to generate these results by hand. I suspect Mathematica used a contour integration based on the appearance of $$\mathrm{e}^{\mathrm{i}\pi c}$$ and the $$\mathrm{i}\pi\cot(\dots)$$s.

P.S. Although these are "analytic solutions", it's not clear that they are in any way useful. These were generated via

Assuming[{0<c<1},
FullSimplify[
Integrate[
Evaluate[FullSimplify[
Sin[a x]/Sin[b x] /.{a -> c, b -> 1-c}]],
{x, 0, Pi/2}]]
]


and then the same thing, but with the rewrite rules changed to

... /. {a -> 2-c, b -> 1-c}]],

• @E.T. T.Y. for your input. These particular integrals arise in an entropy calculation I'm pursuing through the Boltzmann formulation. I do not have access to Mathematica, but would like to evaluate your result. I think the second vector input to the generalized hypergeometric function is not complete. Can you supply the correction? Commented Jun 20 at 21:59
• @pstall : It's a ${}_2F_1$, so $\vec{a}$ has two elements and $\vec{b}$ has one -- and I see "two elements, semicolon, one element, semicolon, argument", so the vectors are complete. Commented Jun 20 at 23:03
• @pstall : Worth understanding dlmf.nist.gov/16.2#iii to know that this ${}_2F_1$ is convergent for all $0<c<1$, but convergence would fail if $c$ were an odd integer. Analytic continuation can give different values at the same input, so it's possible that the expression in this Answer gives values from a branch different than the one you want. If you want to take the limit $c \rightarrow 1$, start here. Commented Jun 20 at 23:14
• @pstall you can use Mathematica free online Commented Jun 21 at 1:12