# Evaluate $\int_{0}^{\frac{\pi}{4}}\frac{\sec^2 \theta }{(1-\tan \theta )}\ d \theta$

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?

• Note, when you change the variable you should change the bounds... – Thomas Andrews Jun 28 '15 at 14:30
• One clear way to deal with what Thomas Andrews said without having to update for $u$ bounds is to say "evaluated from $\theta=0$ to $\theta=\pi/4$". This is a pretty good habit for multivariable calculus as well. – Ian Jun 28 '15 at 14:32
• By the way, +1 for showing your work. It made it very easy to help you. Next time try to use MathJax. – Ian Jun 28 '15 at 15:17
• No problem... thanks you for being so responsive and quick! And I thought mathjax was what I was using...? – Keenan Jun 28 '15 at 15:52
• Is there an online equation editor or something similar to this (codecogs.com/latex/eqneditor.php) for MathJax? – Keenan Jun 28 '15 at 16:01

$$-\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.
• @Keenan Yes. Your original integral should be written as $\lim_{b \to \pi/4^-} \int_0^b \frac{\sec^2(\theta)}{1-\tan(\theta)} d \theta$. When you substitute you then get $\lim_{a \to 0^+} -\int_1^a \frac{1}{u} du$. – Ian Jun 28 '15 at 14:38