2

I'm trying to solve the following integral:

$$\int \frac1{\cos x}\mathrm dx$$

I know that $\int \cos x\mathrm dx$ = sin x, but I don't know how to proceed with $\frac1{\cos x}$.

mrtaurho
  • 16,103
El Bryan
  • 71
  • 7
  • 3
    Hint: multiply by $\frac{\cos x}{\cos x}$ and use that $\cos^2x=1-\sin^2x$. Then perform a substitution to turn it into an integral of a rational function. – greelious Jan 05 '19 at 16:43

4 Answers4

5

$$\int \sec(x)dx$$Let $u=\tan(\frac{x}{2})$ $$\int \sec(x)dx=2\int\frac{du}{1-u^2}$$ Use partial fractions to get $$\int \sec(x)dx=\int\frac{du}{1-u}-\int\frac{du}{1+u}=\ln\left(\frac{1-u}{1+u}\right)+C=\ln\left(\frac{1-\tan(\frac{x}{2})}{1+\tan(\frac{x}{2})}\right)+C$$

aleden
  • 4,007
5

$$\int\frac{dx}{\cos x}=\int\frac{\cos x}{1-\sin^2x}dx=\frac12\int\cos x\left(\frac1{1-\sin x}+\frac1{1+\sin x}\right)\,dx=$$

$$\frac12\left[-\int\frac{d(1-\sin x)}{1-\sin x}+\int\frac{d(1+\sin x)}{1+\sin x}\right]=\frac12\log\frac{1+\sin x}{1-\sin x}+C$$

DonAntonio
  • 211,718
  • 17
  • 136
  • 287
5

A method I've seen is:

$$\int \sec(x)\frac{\sec x+\tan x}{\sec x+\tan x}dx=\int\frac{(\sec x+\tan x)'}{\sec x+\tan x}dx=\ln|\sec x+\tan x|+C$$

Rhys Hughes
  • 12,842
5

Utilizing the given hint from greelious we get the following

$$I=\int \frac{\mathrm dx}{\cos x}=\int \frac{\cos x}{\cos^2 x}\mathrm dx=\int \frac{\cos x}{1-\sin^2 x}\mathrm dx$$

Now by the substitution $y=\sin x$ we further get

$$I=\int \frac{\cos x}{1-\sin^2 x}\mathrm dx\stackrel{y=\sin x}{=}\int \frac{\mathrm dy}{1-y^2}$$

This on can be done via partial fraction decomposition which gives us

$$I=\int \frac{\mathrm dy}{1-y^2}=\frac12\int \left(\frac1{1+y}+\frac1{1-y}\right)\mathrm dy=\frac12\log\left(\frac{1+y}{1-y}\right)+c$$

And now resubstitute $y=\sin(x)$ gives us

$$I=\frac12\log\left(\frac{1+y}{1-y}\right)+c=\frac12\log\left(\frac{1+\sin x}{1-\sin x}\right)+c$$

$$\therefore~I=\int\frac{\mathrm dx}{\cos x}=\frac12\log\left(\frac{1+\sin x}{1-\sin x}\right)+c$$

Moreover we can show that this solution equals the elegant one given by Rhys Hughes

$$\begin{align*} &\color{red}{\frac12\log\left(\frac{1+\sin x}{1-\sin x}\right)}=\log\left(\sqrt{\frac{1+\cos \left(x-\frac\pi2\right)}{1-\cos\left(x-\frac\pi2\right)}}\right)=\log\left(\cot\left(\frac{x-\frac\pi2}{2}\right)\right)\\&=\log\left(\cot\left(\frac x2-\frac\pi4\right)\right) =\log\left(\frac{1+\cot\frac x2}{1-\cot \frac x2}\right)=\log\left(\frac{\left(\cos\frac x2+\sin\frac x2\right)^2}{\cos^2 \frac x2-\sin^2\frac x2}\right)\\&=\log\left(\frac{1+2\sin\frac x2\cos\frac x2}{\cos x}\right)=\log\left(\frac{1+\sin x}{\cos x}\right)=\color{red}{\log(\sec x+\tan x)} \end{align*}$$

mrtaurho
  • 16,103