$$\int(\tan x – \sec x\tan x)dx$$
I rewrote the integral like this:
$$\int\left(\frac{\sin x}{\cos x}- \sec x\tan x\right)dx$$
and using $u$-substitution for the first term I got a final answer of:
$$-\ln|\cos x| – \sec x + c$$
Where was my mistake?
Best Answer
You made no mistake.
Going to explain a bit to be clearer.
The first part is correct for $$\int \tan(x)\ \text{d}x = -\ln|\cos(x)| + c_1$$ and this is easy (you just see the tangent as sine/cosine recognising it has the form $f'(x)/f(x)$ (with a minus sign) which is nothing but a logarithmic derivative.
About the second term:
$$\int \sec(x)\tan(x)\ \text{d}x = \sec(x) + c_2$$
Indeed by the definition: $\sec(x) = \dfrac{1}{\cos(x)}$
We have
$$\dfrac{\text{d}}{\text{d}x} \sec(x) = \dfrac{\sin(x)}{\cos^2(x)} \equiv \dfrac{1}{\cos(x)}\dfrac{\sin(x)}{\cos(x)} = \sec(x)\tan(x)$$
And of course the constant vanished in the derivative.
You made no mistake.