Evaluate the following integrals:
$\int \frac{\tan x}{\sec x+\tan x} d x$
Let $I=\int \frac{\tan x}{\sec x+\tan x} d x$
On multiplying and dividing $(\sec x-\tan x)$, we can write the integral as
$I=\int \frac{\tan x}{\sec x+\tan x}\left(\frac{\sec x-\tan x}{\sec x-\tan x}\right) d x$
$\Rightarrow I=\int \frac{\tan x(\sec x-\tan x)}{(\sec x+\tan x)(\sec x-\tan x)} d x$
$\Rightarrow I=\int \frac{\sec x \tan x-\tan ^{2} x}{\sec ^{2} x-\tan ^{2} x} d x$
$\Rightarrow I=\int\left(\sec x \tan x-\tan ^{2} x\right) d x\left[\because \sec ^{2} \theta-\tan ^{2} \theta=1\right]$
$\Rightarrow I=\int\left(\sec x \tan x-\left(\sec ^{2} x-1\right)\right) d x$
$\Rightarrow I=\int\left(\sec x \tan x-\sec ^{2} x+1\right) d x$
$\Rightarrow I=\int \sec x \tan x d x-\int \sec ^{2} x d x+\int d x$
Recall $\int \sec ^{2} x d x=\tan x+c$ and $\int d x=x+c$
We also have $\int \sec x \tan x d x=\sec x+c$
$\therefore I=\sec x-\tan x+x+c$
Thus, $\int \frac{\tan x}{\sec x+\tan x} d x=\sec x-\tan x+x+c$