Find $\int [e^{\tan x} (1-\tan x)^2\cos^2 x]dx$ Let $\tan x=t$
$$\int [e^t (1-\tan x)^2 \cos^2 x \frac{1}{\sec^2x} ]dt$$
$$\int [e^t (\cos x-\sin x)^2 \cos^2 x ]dt$$
$$\int [e^t (1-\sin 2x)\cos^2 x] dt$$
How do I solve further?
 A: $(1-\tan x)^2 = 1+\tan^2x-2\tan x $
So, if you let $\tan x = t \Rightarrow dx = \dfrac{dt}{\sec^2x} = \dfrac{dt}{1+t^2}$ and $\cos^2x = \dfrac{1}{1+t^2}$
$\begin{align}\Rightarrow I = \int e^{t}(1+t^2-2t)\dfrac{dt}{(1+t^2)^2} & = \int e^t\left[\dfrac{1}{1+t^2 }-\dfrac{2t}{(1+t^2)^2}\right]dt\end{align}$
Now, $\dfrac{d}{dt}\left(\dfrac{1}{1+t^2}\right) = \dfrac{-2t}{(1+t^2)^2}$
We have

$\begin{align}\int e^x(f(x)+f'(x))dx = e^xf(x)\end{align}$

So, you have $I = \begin{align}e^t\dfrac{1}{1+t^2} +c = e^{\tan x}(\cos^2 x) +c\end{align}$
A: First we know
$cos(x)=1/sec(x)$
And   $sec^2(x)=1+tan^2(x)$
Then substitute $u=tan(x)$ , $du/dx=sec^2(x)$
A: Another way to solve:
$${\displaystyle\int}\mathrm{e}^{\tan\left(x\right)}\cos^2\left(x\right)\left(1-\tan\left(x\right)\right)^2\,\mathrm{d}x$$
Using $\cos\left(x\right)=\dfrac{1}{\sec\left(x\right)}$ and $\sec^2\left(x\right)=\tan^2\left(x\right)+1$, we get:
$${\displaystyle\int}\class{steps-node}{\cssId{steps-node-1}{\sec^2\left(x\right)}}\cdot\class{steps-node}{\cssId{steps-node-2}{\dfrac{\mathrm{e}^{\tan\left(x\right)}\left(\tan\left(x\right)-1\right)^2}{\left(\tan^2\left(x\right)+1\right)^2}}}\,\mathrm{d}x$$
Substitute $u = \tan x$, we get:
$${\displaystyle\int}\dfrac{\left(u-1\right)^2\mathrm{e}^u}{\left(u^2+1\right)^2}\,\mathrm{d}u$$
$$={\displaystyle\int}\left(\dfrac{\mathrm{e}^u}{u^2+1}-\dfrac{2u\mathrm{e}^u}{\left(u^2+1\right)^2}\right)\mathrm{d}u$$
$$={\displaystyle\int}\dfrac{\mathrm{e}^u}{u^2+1}\,\mathrm{d}u-\class{steps-node}{\cssId{steps-node-3}{2}}{\displaystyle\int}\dfrac{u\mathrm{e}^u}{\left(u^2+1\right)^2}\,\mathrm{d}u$$
$$=\dfrac{\class{steps-node}{\cssId{steps-node-6}{2}}\mathrm{e}^u}{2\left(u^2+1\right)}+\class{steps-node}{\cssId{steps-node-4}{2}}{\displaystyle\int}\class{steps-node}{\cssId{steps-node-5}{-\dfrac{\mathrm{e}^u}{2\left(u^2+1\right)}}}\,\mathrm{d}u+{\displaystyle\int}\dfrac{\mathrm{e}^u}{u^2+1}\,\mathrm{d}u \,\, \text{(Integration by part)}$$
$$=\dfrac{\class{steps-node}{\cssId{steps-node-6}{}}\mathrm{e}^u}{\left(u^2+1\right)}-\class{steps-node}{\cssId{steps-node-4}{}}{\displaystyle\int}\class{steps-node}{\cssId{steps-node-5}{\dfrac{\mathrm{e}^u}{u^2+1}}}\,\mathrm{d}u+{\displaystyle\int}\dfrac{\mathrm{e}^u}{u^2+1}\,\mathrm{d}u =\dfrac{\mathrm{e}^u}{u^2+1}$$
Undo substitution and we get:
$$\dfrac{\mathrm{e}^{\tan\left(x\right)}}{\tan^2\left(x\right)+1}+C = \mathrm{e}^{\tan\left(x\right)}\cdot\cos^2x+C$$
