1. ## Integral of 1/cosx

I've been struggling with the integral of 1/cosx
I tried integration by parts but ended up with an even more complicated integral (xtanx/cosx)

2. Have a look at this.

3. That's just sec x
Just multiply and divide by sec x + tan x

4. Or use the Weierstrass sub. (Also see the cosec example above it, for step-by-step.)

_________________________________________

Don't integrate - balloontegrate!

Balloon Calculus; standard integrals, derivatives and methods

Balloon Calculus Drawing with LaTeX and Asymptote!

5. In terms of sines and cosines:

$\displaystyle \int{\frac{1}{\cos{x}}\,dx} = \int{\frac{\sin{x}}{\cos{x}\sin{x}}\,dx}$

$\displaystyle = -\int{\left(\frac{1}{\cos{x}\sqrt{1 - \cos^2{x}}}\right)(-\sin{x})\,dx}$.

Now make the substitution $\displaystyle u = \cos{x}$ so that $\displaystyle \frac{du}{dx} = -\sin{x}$ and the integral becomes

$\displaystyle -\int{\left(\frac{1}{u\sqrt{1 - u^2}}\right)\frac{du}{dx}\,dx} = -\int{\frac{1}{u\sqrt{1 - u^2}}\,du}$

$\displaystyle = \int{\frac{1}{u^2}\left(-\frac{u}{\sqrt{1 - u^2}}\right)\,du}$

Now if you make the substitution $\displaystyle s = \sqrt{1 - u^2} \implies u^2 = 1 - s^2$ so that $\displaystyle \frac{ds}{du} = -\frac{u}{\sqrt{1 - u^2}}$ then the integral becomes

$\displaystyle \int{\frac{1}{1 - s^2}\,\frac{ds}{du}\,du} = \int{\frac{1}{(1-s)(1+s)}\,ds}$.

Now applying partial fractions:

$\displaystyle \frac{A}{1 - s} + \frac{B}{1 + s} = \frac{1}{(1-s)(1+s)}$

$\displaystyle \frac{A(1+s)+B(1-s)}{(1-s)(1+s)} = \frac{1}{(1-s)(1+s)}$

$\displaystyle A(1+s)+B(1-s) = 1$

$\displaystyle A+As + B-Bs = 1$

$\displaystyle (A-B)s + A+B = 0s + 1$

$\displaystyle A-B = 0$ and $\displaystyle A + B = 1$

$\displaystyle A = B = \frac{1}{2}$.

So $\displaystyle \frac{1}{(1-s)(1+s)} = \frac{1}{2(1-s)} + \frac{1}{2(1+s)}$ and

$\displaystyle \int{\frac{1}{(1-s)(1+s)}\,ds } = \frac{1}{2}\int{\frac{1}{1-s}\,ds} + \frac{1}{2}\int{\frac{1}{1 + s}\,ds}$

$\displaystyle = -\frac{1}{2}\ln{|1-s|} + \frac{1}{2}\ln{|1+s|} + C$

$\displaystyle = \frac{1}{2}(\ln{|1+s|} - \ln{|1-s|}) + C$

$\displaystyle = \frac{1}{2}\left(\ln{\left|1 + \sqrt{1-u^2}\right|} - \ln{\left|1 - \sqrt{1 - u^2}\right|}\right) + C$

$\displaystyle = \frac{1}{2}\left(\ln{\left|1 + \sqrt{1 - \cos^2{x}}\right|} - \ln{\left|1 - \sqrt{1 - \cos^2{x}}\right|}\right)+C$

$\displaystyle = \frac{1}{2}\left(\ln{\left|1 + \sin{x}\right|} - \ln{\left|1 - \sin{x}\right|}\right)+C$

6. That's wrong
The derivative of the log of cosine isn't sec x
It's -tan x

7. The error lies here:

$\displaystyle \frac{1}{2}\ln{\left|\frac{1+s}{1-s}\right|} \neq \frac{1}{2}\ln{|1-s^2|}$

8. Thanks, I got it. You answered mid-edit lol.

My mistake was putting $\displaystyle \int{\frac{1}{1-s}\,ds} = \ln{|1-s|}$ instead of $\displaystyle -\ln{|1-s|}$, which stuffed everything else up.

9. Hello, e2718281!

Pay no attention to the man behind the curtain . . .

matheagle has the best solution.

$\displaystyle \int\frac{dx}{\cos x}$

$\displaystyle \int\frac{dx}{\cos x} \;=\;\int \sec x\,dx \;=\;\ln|\sec x + \tan x| + C$

10. But I am still curious about the solution that can be obtained, assuming that one doens't know that

$\displaystyle \int \sec x\,dx \;=\;\ln|\sec x + \tan x| + C$

I know that Prove It has gave one solution, except I can't seem to be able to bring $\dfrac{1+\sin x}{1- \sin x}$ to become $\sec x + \tan x$.

Or is it a matter of different constant of integration?

11. $\sqrt {\dfrac{{1 + \sin (x)}}
{{1 - \sin (x)}}} = \sqrt {\dfrac{{\left( {1 + \sin (x)} \right)^2 }}
{{\cos ^2 (x)}}} = \dfrac{1}
{{\cos (x)}} + \dfrac{{\sin (x)}}
{{\cos (x)}}$

$\displaystyle I = \int \frac{1}{\cos{x}}\;{dx} = \int\frac{\cos{x}}{\cos^2{x}}\;{dx} = \int\frac{\cos{x}}{1-\sin^2{x}}\;{dx} = \int\frac{\cos{x}}{(1+\sin{x})(1-\sin{x})}\;{dx}.$

Put $\displaystyle t = \frac{1+\sin{x}}{1-\sin{x}} \Rightarrow \frac{dt}{dx} = \frac{2\cos{x}}{\left(1-\sin{x}\right)^2} \Rightarrow ~ dx = \frac{\left(1-\sin{x}\right)^2}{2\cos{x}}\;{dt}.$

Thus we have:

$\displaystyle I = \int\frac{\cos{x}}{(1+\sin{x})(1-\sin{x})}\cdot\frac{\left(1-\sin{x}\right)^2}{2\cos{x}}\;{dt} = \frac{1}{2}\int \frac{1-\sin{x}}{1+\sin{x}}}\;{dt} = \frac{1}{2}\int\frac{1}{t}\;{dt} = \frac{1}{2}\ln{t}+k.$

Therefore:

$\displaystyle \boxed{\int\frac{1}{\cos{x}}\;{dx} = \frac{1}{2}\ln\bigg|\frac{1+\sin{x}}{1-\sin{x}}\bigg|+k}.$

13. Notice that we could have done it without the substitution:

$\displaystyle I = \int\frac{\cos{x}}{(1+\sin{x})(1-\sin{x})}\;{dx} =
\frac{1}{2} \int\frac{\cos{x}}{1+\sin x}\;{dx}-\frac{1}{2} \int\frac{-\cos{x}}{1-\sin x}\;{dx}.$

Since the numerator of each integral is the derivative of its denominator, it's clear that:

$\displaystyle I = \frac{1}{2}\ln\left|1+\sin{x}\right|-\frac{1}{2}\ln\left|1-\sin{x}\right|+k = \frac{1}{2}\ln\bigg|\frac{1+\sin{x}}{1-\sin{x}}\bigg|+k.$

14. I still prefer

$\int \sec x dx =\int \sec x \left({ \sec x +\tan x \over \sec x +\tan x}\right)dx$

$=\int \left({ \sec^2 x +\sec x\tan x \over \sec x +\tan x}\right)dx$

Now let $u= \sec x +\tan x$

,

,

,

,

,

,

,

,

,

,

,

,

,

,

# integral 1/cos x dx

Click on a term to search for related topics.