# Help with a definite integral of the type $\sqrt{1-A \tan^2 x}$

I am at a loss to evaluate the following integral: $$I=\frac{1}{\pi}\displaystyle\int_{q_1}^{q_2} dq\,\sqrt{2m(E-V(q))}$$ where $V(q)=U\tan^2(\alpha q)$, $U>0$ and $V(q_1)=V(q_2)=E$. (Thus the integrand vanishes at the endpoints.)

This integral is the action for the potential $V(q)$ in the action-angle formalism of classical mechanics. The answer is given as $$I=\frac{1}{\alpha}\left(\sqrt{2m(E+U)}-\sqrt{2mU}\right)\, .$$

Mathematica will spit out an answer for the indefinite integral in terms of $\arcsin$ and $\hbox{arctanh}$ but it seems so far from what the answer is that I get no insight into the solution.

The usual tricks - including trig substitutions and various Euler substitutions - do not seem to work. Since the integrand contains a square, I looked at breaking the integrand to the form $\sqrt{(A-B\tan(\alpha q))(A+B\tan(\alpha q))}$ but this doesn't seem to improve the situation.

I tried using a complex substitution since Mma tells the antiderivative is expressible as an arctanh but that got me nowhere.

I thought about trying some version of Leibnitz's rule for definite integrals whose limits are functions of differential variables and take advantage of the property that the integral vanishes at the endpoint, but to no avail.

I suspect there might be a very specific trick which is not very well known. More probably it's a multistep process with several sequential substitutions which are not immediately obvious.

I'm stuck and I'll take any serious hint towards the solution.

• I suspect the arctanh is a bit of a red herring: it's really an arctan, but with the complex constant $\sqrt{-A}$. Commented Feb 6, 2017 at 0:58
• yes I suspected Mma "ran home to Mamma" and tried to go with $\sqrt{1+\tilde A \tan^2(x)}$ by "inserting an i" in the argument, since the form with the $+$ sign is much more common.
– user160660
Commented Feb 6, 2017 at 1:09
• Yes, Mathematica does need massaging occasionally to get the useful, as opposed to just right answer. Can't rely on just computers to distinguish between seismic anomalies and Russian submarines, after all. You could use a complex substitution $z=e^{2iu}$ after getting rid of the square root to compute the $\cos^2{u}/(A+\sin^2{u})$ integral using residues, but by that point it just introduces yet more nasty algebra. Commented Feb 6, 2017 at 1:23
• @Chappers : yes this was one of the fruitless avenues I initially tried.
– user160660
Commented Feb 6, 2017 at 1:27

I'm just going to focus on the form you give in the title, since you can clearly reduce to this form by linear substitution, factorisation and defining $A=U/E$.

The substitution you want is $$x = \arctan{\left( \frac{v}{\sqrt{A(1+v^2)}} \right)},$$ which changes the integral to $$I = \int_{-\arctan{(A^{-1/2})}}^{\arctan{(A^{-1/2})}} \sqrt{1-A\tan^2{x}} \, dx = \int_{-\infty}^{\infty} \frac{\sqrt{A}}{(1+v^2)(A+(1+A)v^2)} \, dv,$$ which easily expands into partial fractions and gives the answer you want, i.e. $$I = \pi(\sqrt{1+A}-\sqrt{A}).$$

The limits on the original form of $I$ given above should be clear: they are, modulo $2\pi$, the only places we can take so that the integrand vanishes while the area enclosed is positive and finite. The obvious thing to do is get rid of the tangent function, so put $x=\arctan{(y/\sqrt{A})}$, to deal with the factor of $A$. Then $dx=\sqrt{A}/(A+y^2) \, dy$, and the integral becomes $$I=\sqrt{A}\int_{-1}^1 \frac{\sqrt{1-y^2}}{A+y^2} \, dy.$$ We still can't really do this, but at least the square root now looks familiar: to get rid of it, take $y=\sin{u}$, $dy=\cos{u} \, du$, $$I=\sqrt{A}\int_{-\pi/2}^{\pi/2} \frac{\cos^2{u}}{A+\sin^2{u}} \, du,$$ with no ambiguity in taking the square root since cosine is positive on the interval of integration. We instinctively want to use the double-angle formula here, but it is actually better to just go straight for a $u=\arctan{v}$ substitution: we have by Pythagoras $$du = \frac{dv}{1+v^2}, \quad \sin^2{u} = \frac{v^2}{1+v^2}, \quad \cos^2{u} = \frac{1-v^2}{1+v^2},$$ and so the integral reduces to the form given above.
Unwinding the substitution gives $x=\sqrt{A}\tan{x}/\sqrt{1-A\tan^2{x}}$, which we can reinsert into the antiderivative $$\sqrt{A+1}\arctan{\frac{\sqrt{A+1}}{\sqrt{A}}v} - \sqrt{A}\arctan{v}$$ to find the extremely memorable (!) antiderivative $$\int \sqrt{1-A\tan^2{x}} \, dx = \sqrt{A+1}\arctan{\left( \frac{\sqrt{A+1}\tan{x}}{\sqrt{1-A\tan^2{x}}} \right)} - \sqrt{A}\arctan{\left( \frac{\sqrt{A}\tan{x}}{\sqrt{1-A\tan^2{x}}} \right)}.$$ Joy of joys, we notice that taking $\sqrt{1-A\tan^2{x}} \downarrow 0$ for $\tan{x} \lessgtr 0$ also gives the right answer (remembering to include both positive and negative endpoints).