How does $\int (\cos(x))^{-2}dx$ equal to $\tan(x)$? How does $$\int \frac{1}{\cos^2(x)} dx= \tan(x)+ C$$ ?
 A: $\bullet $ Integration is Reverse process of Differentiation.
So we know that $\displaystyle \frac{d}{dx}(\tan x+\mathcal{C}) = \sec^2 x\;,$ Now Integrate both side w r to $x$
So $$\displaystyle\int \frac{d}{dx}(\tan x+\mathcal{C})dx = \int \sec^2 x dx$$
So $$\displaystyle \tan x+\mathcal{C}=\int \sec^2 xdx = \int\frac{1}{\cos^2 x}dx$$
So $$\displaystyle \int \sec^2 xdx = \int\frac{1}{\cos^2 x}dx = \tan x+\mathcal{C}$$
A: Hint:
From the quotient rule of differentiation
$$\frac{d}{dx}\tan x = \frac{d}{dx}\frac{\sin x}{\cos x} = \frac{\cos x\cos x - \left(-\sin x \sin x\right)}{\cos^2 x} = \frac{1}{\cos^2 x}$$
A: The integral  of $\dfrac1{\cos^2 x}$ is $\tan x$, not the function itself.
After the O.P.'s edit:
 It is because the derivative of $\tan x$ is $\dfrac1{\cos^2x}$ (and it is also $1+\tan^2x$).
A: $$\int\dfrac{1}{\cos^2{x}}dx =\int \dfrac{\cos^2{x}+\sin^2{x}}{\cos^2{x}}dx  $$
Letting $u = \sin x \implies du = \cos x dx $ and $ v = \cos{x} \implies dv = -\sin{x} dx$
$$\int \dfrac{\cos^2{x}+\sin^2{x}}{\cos^2{x}}dx  = \int \dfrac{vdu-udv}{v^2} = \int d \left(\dfrac{u}{v}\right) = \dfrac{u}{v} + C = \dfrac{\sin x}{\cos x}+C = \tan{x}+C$$
