Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Okay, so I'm trying to find $ \int \frac1{\cos x}\mathrm{d}x$ using the substitution $t = \tan\left(\frac{x}{2}\right)$.

I sub in the trig identity for $\sec$ as $\frac{1+t^2}{1-t^2}$ and then rearrange and substitute $\frac{\mathrm{d}t}{\mathrm{d}x} = \frac12 \left(1+ \tan^2\left(\frac{x}{2}\right)\right)$ so I am left with


I then used partial fractions to find

$\frac2{1-t^2} = \frac1{1+t} + \frac1{1-t}$

and therefore integrating I get

$\int \frac1{\cos x}dx = \ln(t+1) - \ln(t-1)$

But subbing in $t = \tan\left(\frac{x}{2}\right)$ doesn't seem to get me anywhere close to the solution that I want to find, which is:

$ \int \frac1{\cos x}\mathrm{d}x = \ln(\sec x + \tan x) + C$

Any help on this would be greatly appreciated.


share|cite|improve this question
You might find this question relevant: – Mike Spivey Nov 1 '10 at 21:56
This is a duplicate of… – Ross Millikan Nov 1 '10 at 21:58
It's not quite a copy, I'm asking a different question which although is similar, doesn't get answered in that thread. I didn't think it would be appropriate to ask a question in someone else's post. – alexganose Nov 1 '10 at 22:06
up vote 4 down vote accepted

The problem equivocates to proving that $\left|\frac{t+1}{t-1}\right| = |\sec x + \tan x|$, where $t=\tan\frac x2$.

Using the fact that $\tan\frac x2 = \frac{1-\cos x}{\sin x}$, we get

$$\frac{t+1}{t-1} = \frac{1+\sin x-\cos x}{1-\sin x-\cos x} = \frac{\sec x+\tan x-1}{\sec x-\tan x-1}.$$

In addition, $$\begin{align}(\sec x+\tan x)(-1+\sec x-\tan x) &= -\sec x - \tan x +(\sec^2x-\tan^2x)\\ &= -(\sec x+\tan x-1),\end{align}$$ which is what we wanted.

share|cite|improve this answer
Ahh Brilliant! Thank you! I strangely tried submitting back t and then applying the log rules but that just confused me a little. This makes so much sense! Thank you! – alexganose Nov 1 '10 at 22:34

Try writing $\sec x + \tan x$ in terms of $t$ and see if you can reorganize the two answers to agree. You may need to tweak the value of $C$ to do this.

share|cite|improve this answer
Thank you! A bit of guidance without the full answer is also nice! Learning how to solve it not just the solution really useful. Thanks! – alexganose Nov 1 '10 at 22:36

We know that $$\cos x=\frac{1-\tan^{2}\frac{x}{2}}{1+\tan^{2}\frac{x}{2} }=\frac{1-\tan^{2}\frac{x}{2}}{\sec^2 \frac{x}{2} }$$ Given that $$\int \frac{1}{\cos x}dx$$$$=\int \frac{1}{\frac{1-\tan^{2}\frac{x}{2}}{\sec^2 \frac{x}{2} }}dx$$ $$=\int \frac{\sec^2 \frac{x}{2}}{1- \tan^{2}\frac{x}{2}}dx$$ Let $$\tan \frac{x}{2}=t \implies \frac{1}{2}\sec^2\frac{x}{2}dx=dt \implies \sec^2\frac{x}{2}dx=2dt $$ Now , we have $$\int \frac{\sec^2 \frac{x}{2}}{1- \tan^{2}\frac{x}{2}}dx=\int \frac{2dt}{1- t^2}$$$$=\frac{2}{2}\ln\left|\frac{1+t}{1-t}\right|$$ $$=\ln\left|\frac{1+\tan \frac{x}{2}}{1-\tan \frac{x}{2}}\right|$$ $$=\ln\left|\frac{\cos \frac{x}{2}+\sin \frac{x}{2}}{\cos \frac{x}{2}-\sin \frac{x}{2}}\right|$$ $$=\ln\left|\frac{\left(\cos \frac{x}{2}+\sin \frac{x}{2}\right)\left(\cos \frac{x}{2}+\sin \frac{x}{2}\right)}{\left(\cos \frac{x}{2}-\sin \frac{x}{2}\right)\left(\cos \frac{x}{2}+\sin \frac{x}{2}\right)}\right|$$ $$=\ln\left|\frac{\cos^2\frac{x}{2}+\sin^2\frac{x}{2}+2\sin\frac{x}{2}\cos\frac{x}{2}}{\cos^2 \frac{x}{2}-\sin^2 \frac{x}{2}}\right|$$ $$=\ln\left|\frac{1+\sin x}{\cos x}\right|$$ $$\color{blue}{=\ln\left|\sec x+\tan x\right|+C}$$

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.