1. ## Troubling Trig Integral

I am currently working on an integral that I finally found the answer to after approaching differently, but I would like to know why my first approach failed -- it led to undefined trig functions and/or ln 0. As far as I can tell, by math logic is okay, unless I'm missing something.

$\displaystyle \int_{0}^{\pi/2}\frac{cost}{1 + sint} dt$

My initial approach was to multiply by $\displaystyle \frac{1 - sin t}{1 - sin t}$ leading to $\displaystyle \int\frac{cost(1 - sin t)}{1 - sin^2 t}$ and then to $\displaystyle \int\frac{cost(1 - sin t)}{cos^2 t}$ and then to $\displaystyle \int\frac{1 - sin t}{cos t}$. Rewriting, $\displaystyle \int_{0}^{\pi/2}\frac{1}{cos t} dt - \int_{0}^{\pi/2}tan t dt$. This leads to $\displaystyle \int_{0}^{\pi/2}sec t dt - \int_{0}^{\pi/2}tan t dt$. But when I attempted to integrate, it failed. Simple u-subst. works u = 1 + sint,
du = cost dt, but why does the other approach fail?

2. In both the approachs you get the same answer.
Intg(secθ) - Intg(tanθ)
= ln(secθ + tanθ) -ln(secθ)
= ln[(secθ + tanθ/secθ]
= ln[ 1 + sinθ]

3. My second step was: Intg tant dt = -ln|cost|. I failed to recognize the log property and rewrite -ln|cost| as ln|cost^-1| = ln|sect|.

That was it. Thank you, it was driving me crazy!