# Calculating an integral without using substitution

This is the problem I want done. However my teacher challenged the class to solve it without using substitution. I understand up to the 3rd equal sign. How would I proceed from there, without using substitution? \begin{align*} \int \frac{1}{1+\sin x} \, dx &= \int \frac{1 - \sin x}{1 - \sin^2 x} \, dx \\ &= \int \frac{1 - \sin x}{\cos^2 x} \, dx \\ &= \int \sec^2 x - \frac{\sin x}{\cos^2 x} \, dx \\ &= \tan x - \int \frac{-du}{u^2}, \quad u = \cos x, du = -\sin x \, dx \\ &= \tan x - \frac{1}{u} + C \\ &= \tan x - \sec x + C. \end{align*}

Note that: $\frac{\sin x}{\cos^2 x} = \tan x\sec x$ and the derivative of $\sec x$ is $\tan x\sec x$.