This question is very similar to my previous one, though this one has been reviewed for errors.
Background: I attempted to solve a relatively simple integrand using substitution method in as many methods as possible. The Approach 2 you will see below is one them which was quite different to what my reference (textbook) answer was. The whole point of the exercise was to convince myself that what I choose to substitute while evaluating the integrand doesn't matter.
Question: $ \int \tan^2(2x-3) * dx $
Approach 1 (Reference) :
Assume $ a = 2x-3 $,
To get $da$ from $dx$, differentiate the above equation w.r.t x,
$$ \frac{d}{dx} a = 2(1)-0 $$
$$ dx = \frac{1}{2} da$$
Substituting variables $a$ and $da$ to the integrand,
$$ \int \tan^2(a) * \frac{1}{2}da $$
$$ \frac{1}{2} \int \tan^2(a)*da$$
Write $\tan^2(a)$ as $(1-\sec^2(a))$,
$$ \frac{1}{2} \int (1-\sec^2(a)*da $$
Linearly expanding the integrand,
$$ \frac{1}{2} ( \int 1 * da - \int \sec^2(a) * da ) $$
Using standard integrals for $\int da$ and $\int \sec^2(a)*da$,
$$ \frac{1}{2} ( a - \tan^2(a) + C ) $$
Substituting for $a$,
$$ \frac{1}{2} ( 2x - 3 - \tan^2(2x-3) + C) $$
Approach 2:
Let $t=\sec(2x-3)$
(Why? I wrote the integrand as $\int \frac{\sin(2x-3)}{\cos^2(2x-3)}\sin(2x-3)$ = $\int \tan(2x-3)\sec(2x-3)\sin(2x-3)$, since $\sec(2x-3)\tan(2x-3)$ was inside the integral, my instinct kicked in and kept suggesting $\sec(2x-3)$).
Differentiating w.r.t to x,
$$ \frac{d}{dx}t = 2\sec(2x-3)\tan(2x-3) $$ $$ dx = \frac{1}{2\sec(2x-3)\tan(2x-3)} dt$$
Substituting $dt$ into the integrand,
$$ \int \frac{\tan^2(2x-3)}{2\sec(2x-3)\tan(2x-3)} dt$$
Simplifying,
$$ \frac{1}{2} \int \frac{\tan(2x-3)}{\sec(2x-3)} dt $$
Expressing in terms of $\sin(x)$ and $\cos(x)$,
$$ \frac{1}{2} \int \frac{\sin(2x-3)}{\cos(2x-3)}\cos(2x-3) dt $$ $$ \frac{1}{2} \int \sin(2x-3) dt $$
To express $\sin(2x-3)$ in terms of the variable of integration $dt$, $$ t = \sec(2x-3) $$ $$ \frac{1}{t} = \cos(2x-3) $$ $$ \frac{1}{t^2} = \cos^2(2x-3) $$ $$ 1 - \frac{1}{t^2} = 1 - \cos^2(2x-3) $$ $$ \sqrt{1-\frac{1}{t^2}} = \sin(2x-3) $$
Substituting for $\sin(2x-3)$,
$$ \frac{1}{2} \int \sqrt{1-\frac{1}{t^2}} dt $$
Simplifying,
$$ \frac{1}{2} \int \frac{\sqrt{t^2-1}}{t}dt$$
Let $u=\sqrt{t^2-1}$, differentiating w.r.t t,
$$ \frac{d}{dt}u = \frac{1}{2} \frac{1}{\sqrt{t^2-1}} 2t $$ $$ \frac{d}{dt}u = \frac{t}{\sqrt{t^2-1}} $$ $$ dt = \frac{\sqrt{t^2-1}}{t} du $$
Substituting for $t$ and $dt$ ,
$$ \frac{1}{2} \int \frac{u^2}{u^2+1} du $$
Writing $u^2$ as $ (u^2+1) - 1 $,
$$ \frac{1}{2} \int (\frac{u^2+1}{u^2+1} - \frac{1}{u^2+1}) du $$
Linearly expanding the integral,
$$ \frac{1}{2} ( \int du - \int \frac{1}{u^2+1} du ) $$
Using standard integral set,
$$ \frac{1}{2} ( u - \arctan(u) + C ) $$
Substituting for $u$,
$$ \frac{1}{2} ( \sqrt{t^2-1} - \arctan(\sqrt{t^2-1}) + C ) $$
Substituting for $t$,
$$ \frac{1}{2} ( \sqrt{(\sec^2(2x-3)-1)} - \arctan(\sqrt{\sec^2(2x-3)-1}) + C ) $$
Further simplifying,
$$ \frac{1}{2} ( \tan(2x-3) - \arctan(\tan(2x-3)) + C ) $$ $$ \frac{1}{2} ( \tan(2x-3) - (2x-3) + C ) $$
Which is short of my reference answer by one $\tan(2x-3)$ and the sign is inverted. There might be an hidden mistake somewhere. Again, I would be grateful if mistakes, if any, are pointed out. The main question is since these integrals are of the same integrand why are they different?
Ok, right, I found out the troublemakers in the answers after a long time.
Here is the quick summary of my findings combined with observations of others in the comments:
Reason: As @hardmath points out in the comments, one can verify the answer by differentiating the integral and checking if it matches with integrand.
Working:
$$ \frac{d}{dx} * \frac{1}{2}(\tan(2x-3)-(2x-3)+C) $$
$$ \frac{1}{2}( (2) * \sec^2(2x-3)-(2+0)+0) $$
$$ \frac{1}{2}( 2\sec^2(2x-3)-2) $$
$$ (\sec^(2x-3)-1) $$
$$ (\tan^2(2x-3)) $$
which is the original question
Quick Proof: $ \sec^2(x)-1 = \frac{1}{\cos^2(x)}-1 = \frac{1-\cos^2(x)}{\cos^2(x)} = \frac{\sin^2(x)}{\cos^2(x)} = \tan^2(x) $
Therefore, the two approaches are valid and result in the same answer.