Evaluate $$\int_{0}^{\frac{\pi}{4}}\frac{\sec^2 \theta }{(1-\tan \theta )}\ d \theta$$
Here's my attempt:
$$u=1-tan \theta \implies -du=\sec^2 \theta d \theta$$
Substituting back in, I get this: $$-\int_{0}^{\frac{\pi}{4}} \frac{du}{u}$$
Integrating I get this (I prefer to not change my bounds and to back-substitute at the end):
$$-ln\lvert u \rvert$$ evaluated from $0$ to $\frac{\pi}{4}$
back-substituting gives me this:
$$-ln \lvert 1-tan \theta \rvert$$ evaluated from $0$ to $\frac{\pi}{4}$
Plugging in the bounds, I get this:
$$-\left[\left(ln\lvert1-tan \left(\frac{\pi}{4}\right)\rvert \right)-\left(ln\lvert1-tan\left(0\right)\rvert \right)\right]$$
Which gives me this:
$$=-[0-0]=0$$
Now I know that I must have messed up somewhere because, looking at the graph of $\sec^2$, I see that it approaches $\infty$ as $x$ approaches $\frac{\pi}{4}$, so the area must be infinite and so I should be getting a divergent result. Can someone show me where and how I messed up?
Thanks in advance
Your problem is right at the end. You have
$$-\ln(|1-\tan(\pi/4)|)+\ln(|1-0|)"="-\ln(0)+\ln(1)$$
where I put the equals sign in scare quotes because that's what you get when you try to substitute, but $\ln(0)$ is not defined. When you rephrase in terms of an improper integral (as you should, since your original integrand blows up at $\pi/4$), you get divergence as you anticipated.