Evaluate the integral $\int \frac{\sec x}{\sqrt{3+\tan x}}dx$

Evaluate the following integral.$$\int \frac{\sec x}{\sqrt{3+\tan x}}dx$$

On putting $t=\tan x$ I am getting $$\int\frac{1}{\sqrt{(t^2+1)(t+3)}}dt$$.

How should i proceed from here.

• Maple returns an antiderivative involving an elliptic function. – Travis Jul 5 '18 at 2:13
• That's an elliptic integral. – Lord Shark the Unknown Jul 5 '18 at 2:14
• One of the common pitfalls in this site is that people post homework/coursework questions involving definite integrals as indefinite integrals. In many of these cases, the antiderivative is very hard or impossible to find, at least in terms of elementary functions. If your original question has bounds (a definite integral), you should definitely edit the question to reflect this. – Deepak Jul 5 '18 at 2:18
• I don't know of a definite integral here that could be done in closed form without elliptic integrals. Alternatively, the question might be whether the improper integral from, say, $0$ to $\pi/2$ converges. You can answer that without explicitly evaluating the integral. – Robert Israel Jul 5 '18 at 2:30

$$\left(\frac{1}{5}+\frac{3 i}{5}\right) \sqrt{-\frac{3}{10}-\frac{i}{10}} \cos (x) *\\ \sqrt{(1+3 i)-(3-i) \tan (x)} \sqrt{(-3-i) (\tan (x)+i)} F\left(i \sinh ^{-1}\left(\sqrt{-\frac{3}{10}-\frac{i}{10}} \sqrt{\tan (x)+3}\right)|\frac{4}{5}-\frac{3 i}{5}\right)$$

• This is not very helpful. – Rumplestillskin Jul 5 '18 at 2:23
• Helpful in that it constrains all possible responses... to be correct. And shows how complicated the solution is... and shows that it will involve Hypergeometric function $F$... and... – David G. Stork Jul 5 '18 at 2:23
• Actually that's an incomplete elliptic integral, not a hypergeometric function. – Robert Israel Jul 5 '18 at 2:32

We are given:

$$y = \int\frac{\sec x\,dx}{\sqrt{3+\tan x}}.$$

First, change the variable of integration from $x$ to $u=\sqrt{3+\tan x}$; we have that

\begin{align*} du &= \frac{\sec^{2}x\,dx}{2\sqrt{3+\tan x}} \\ \therefore dy &= \frac{2\,du}{\sec x} \\ &= \frac{2\,du}{\sqrt{1+(u^{2}-3)^{2}}}. \end{align*}

Now, if there exists $a$ with $u=a t$ such that

$$1 + (u^{2}-3)^{2} = r^{2}(1-t^{2})(1-k^{2}t^{2})$$

for some $r,k$, then changing the variable of integration from $u$ to $t$ turns our integral into an incomplete elliptic one of the first kind.
To find such $a,r,k$, expand the powers and rewrite $u$ as $at$ in the previous equation to yield

$$a^{4}t^{4}-6a^{2}t^{2}+10=r^{2}k^{2}t^{4}-r^{2}(1+k^{2})t^{2}+r^{2}.$$

Equating coefficients of like powers immediately yields

\begin{align*} r^{2}=10 && 6a^{2}=r^{2}(1+k^{2}) && a^{4}=r^{2}k^{2} \end{align*}

which gives us (but not before some sacrifice)

\begin{align*} k=\frac{3\pm i}{\sqrt{10}}&& k^{2}=\frac{4\pm 3i}{5}&& a=\sqrt{3\pm i}. \end{align*}

$$y = 2\int\frac{du}{\sqrt{1+(u^{2}-3)^{2}}}$$

and substitute $u$ for $t$, whereby it becomes

\begin{align*} y &= 2a\int\frac{dt}{\sqrt{r^{2}(1-t^{2})(1-k^{2}t^{2})}}\\ &=\frac{2a}{r}\int\frac{dt}{\sqrt{(1-t^{2})(1-k^{2}t^{2})}}\\ &=\frac{2a}{r}\mathrm{F}(t;k)+C. \end{align*}

Finally, we undo our subsitutions,

\begin{align*} t &= \frac{\sqrt{3+\tan x}}{a} \\ &= \sqrt{\frac{3\mp i}{10}}\sqrt{3+\tan x} \end{align*}

expand

$$\frac{2a}{r} = \sqrt{\frac{6\pm2i}{5}},$$

and pass to Legendre's notation, to yield

$$y=\int\frac{\sec x\,dx}{\sqrt{3+\tan x}}=\sqrt{\frac{6\pm2i}{5}}\mathrm{F}\left(\arcsin\left(\sqrt{\frac{3\mp i}{10}}\sqrt{3+\tan x}\right)\Bigg|\frac{4\pm3i}{5}\right)+C. \tag{\star}\label{star}$$

I have gone over the above a handful of times now, and can't find any mistakes.
One thing concerned me though: this is similar enough to David G. Stork's provided answer for me to believe it is not entirely incorrect, but at the same time, it is different enough for me to suspect it is not entirely correct either.
If one examines the differences however, one finds that

$$\cos x \sqrt{(1+3i)+(3-i)\tan x}\sqrt{(-3-i)(\tan x +i)} = \pm(1+3i)$$

is locally constant everywhere it is defined. Thus \eqref{star} is at least everywhere a constant multiple of the other answer.
This behaviour is probably due to the participation of square-root and tangent in the integrand and whatnot, though I don't know enough complex analysis. Just mind any possible singularities in your path of integration...