# Can you use the substitution $t=\tan(x/2)$ to solve $\int \frac{1}{\cos x}dx$?

While trying to solve the following indefinite integral $$\int \frac{1}{\cos x}dx$$ I was told that a good method would be to use the substitution $$t=\tan \frac{x}{2}$$ so that I could write $$\cos x=\frac{1-t^2}{1+t^2}$$

But I think there's a problem with this approach, to wit, that the domain of $t$ does not include the points $$\{ x\in \mathbb{R} : x=\pi +2k\pi,k\in \mathbb{Z}\}$$ which are, instead, in the domain of the integrand. This means that the result would be correct if I were considering the restriction of the integrand to some interval in which $t$ is defined as well, such as $(-\pi/2,\pi/2)$ or $(\pi/2,\pi)$.

My professor has assured me that the method works, but I wasn't really able to follow through his explanation.

What do you think? Can one still find the correct antiderivatives using this substitution?

• the points $a$ at which $\cos t$ is zero are not integrable because $1/\cos t$ goes to infinity as $1/(t-a).$ – abel Feb 19 '17 at 18:12
• Of course, but it is integrable in e.g. $x=\pi$, but $t$ is not defined there. – Nicol Feb 19 '17 at 18:14
• I'm talking about the points where $1/\cos x$ is defined but $t$ isn't. – Nicol Feb 19 '17 at 18:14
• just do a translation in $x.$ – abel Feb 19 '17 at 18:15

You always can use the substitution $t=\tan \dfrac x2$ to compute the integral of a rational function of trigonometric functions.

Now Bioche's rules tell you can use the simpler substitution $u=\sin x$.

• Okay, but why can you always use that substitution? That was the question. – Nicol Feb 19 '17 at 18:33
• Because there are formulae which express $\sin x$ and $\cos x$ as rational functions of $t=\tan \dfrac x2$ and $\mathrm d x=\dfrac{2\,\mathrm dt}{1+t^2}$. You've written one of these formulae in your question. – Bernard Feb 19 '17 at 18:38
• Did you read the rest of the question? How can that substitution yield the right result at a point where $t$ is not defined but the integrand is? – Nicol Feb 19 '17 at 18:42
• This is a purely formal computation. Furthermore, you obtain a solution which is valid, from your point of view, excepts perhaps at the points of discontinuity, which a discrete set. So the result is valid on open subset which is dense in $\mathbf R$, hence in the domain of the integrand. If the result is valid in a dense open subset, it is valid on the whole set, since the functions are continuous. – Bernard Feb 19 '17 at 18:54

What you're really worried about is convergence at $t=\pm \infty$. That's where the problem occurs, because as $x\rightarrow \pi, \tan\frac{x}{2}\rightarrow \pm\infty$.

So we need to know the behavior of the new integral at $\pm\infty$. There of course is a problem because it's not a proper integral, but because what you end up with is $\int \frac{dt}{1-t^2}$ which is integrable near $\infty$ (compare it to $\frac{1}{t^2}$), the antiderivative will be defined and finite.

Now the function is NOT integrable near $\pm 1$, which shows that the antiderivative blows up at $\pm\frac{\pi}{2}$. But near $\infty$ it is perfectly reasonable.