# Definite integral of $\frac{1}{a\sin x+b}$ with upper limit $\pi$

I am really confused about the following, I hope it's not a stupid question with an obvious answer.

I want to solve the definite integral

$$\int\limits_c^\pi\frac{1}{a\sin(x)+b}dx$$

with $$a>0$$, $$b>0$$, $$b>a$$, $$\pi/2\leq c <\pi$$. Computer algebra systems (CAS) such as Mathematica and Matlab (symbolic math toolbox) can only solve the definite integral when the stated assumptions are provided, otherwise they don't yield a solution. (This is a general question about math, not the implementation details of CAS).

This seems weird to me, because the indefinite integral calculates to

$$\int\frac{1}{a\sin(x)+b}dx=\frac{2 \arctan\left(\frac{a+b \tan \left(\frac{x}{2}\right)}{\sqrt{b^2-a^2}}\right)}{\sqrt{b^2-a^2}},$$ and what is most important about this result, as far as I know, is that it holds regardless of any constraints on the constants. (Apart from the fact that the term inside the square root has to be $$>0$$ in order to avoid a complex solution). So what I'd do next is to insert my limits $$c$$ and $$\pi$$ into the antiderivative, but it's obvious that inserting $$x=\pi$$ into this antiderivative gives us issues, because $$\tan(\pi/2)$$ is undefined.

My questions are: why can the definite integral be solved under the stated constraints $$a>0$$, $$b>0$$, $$b>a$$, $$\pi/2\leq c <\pi$$, and how does one arrive at this solution, given that the antiderivative seems undefined at $$x=\pi$$?

A few thoughts:

• Is there a different way to arrive at an equivalent formulation of the antiderivative which doesn't have this issue, either by performing the antiderivative calculation differently, or maybe by somehow simplifying $$\arctan(d+e\tan(x/2))$$ after it's calculated? After all, $$\arctan$$ is just the inverse function of $$\tan$$.
• Maybe we can work with the antiderivative provided above, knowing that because of the fact that the lower integration limit $$c$$ is smaller than $$\pi$$ we approach the upper limit $$\pi$$ from below, so we know that $$\tan(\pi/2)$$ equals infinity and we're basically calculating $$\arctan(\infty)$$, which is $$\pi/2$$? That seems quite hand-waving to me, though. But at least that seems to yield the correct result for the upper limit, by the way.
• (Why is the antiderivative undefined at all at some arguments? The original function $$1/(a\sin(x)+b)$$ with the stated assumptions is always $$>0$$ and continuous, so it's not obvious to me why it should not be possible to calculate the area under the curve within any interval.)

Thank you for your help, any insight is greatly appreciated!

While, $$F(x) = \frac{2 \arctan\left(\frac{a+b \tan \left(\frac{x}{2}\right)}{\sqrt{b^2-a^2}}\right)}{\sqrt{b^2-a^2}}$$ may not be defined at $$x = \pi, \lim_\limits{x\to\pi} F(x)$$ is defined and we can use that to evaluate the function at the upper bound.
Notice that for $$x\to k\pi/2$$ that: $$\arctan\left(d+e\tan(x/2)\right)\sim\arctan(\tan(x))=\pi/2$$