Is $\int_{0}^{\pi} \sec^2(x)\,dx \neq 0$? I have had a discussion with my classmates recently, and an answer on the 2016 Calculus BC AP test said that:
$$\int_0^\pi \sec^2x = \infty$$
The problem I am having is that we can split this and write it as a limit.
$$\int_0^\pi \sec^2x\,dx = \lim_{b\to{\pi\over2}} \biggl(\int_0^b \sec^2 x \,dx + \int_b^\pi \sec^2 x \,dx\biggl)$$
Therefore:
$$\int_0^\pi \sec^2x = \lim_{b\to{\pi\over2}} \biggl(\tan(b) - \tan(0) + \tan(\pi) - \tan(b)\biggl)$$
$$= \lim_{b\to{\pi\over2}} \biggl(\tan(b) - \tan(b)\biggl)$$
$$= \lim_{b\to{\pi\over2}} \biggl({\sin(b) - \sin(b) \over \cos(b)}\biggl) = {0\over0}$$
Using L'Hopital's Theorem:
$$\lim_{b\to{\pi\over2}} \biggl({\sin(b) - \sin(b) \over \cos(b)}\biggl) = \lim_{b\to{\pi\over2}} \biggl({\cos(b)-\cos(b)\over{-\sin(b)}}\biggl)$$
Evaluating:
$$\int_0^\pi \sec^2x\,dx = {0-0\over{-1}} = 0$$
I must have made a mistake, but I just don't know where my logical fault is.  Any answers would be much appreciated.
Edit: I knew the work was wrong, just not how.  Thanks for the answers!
 A: If $b<\pi/2$, then $\int_b^\pi \sec^2x\,dx$ is undefined. If  $b>\pi/2$, then $\int_0^b \sec^2x\,dx$ is undefined. There is no value of $b$ such that 
$\int_0^b \sec^2 x\, dx + \int_b^\pi \sec^2 x\, dx = \tan(b) - \tan(0) + \tan(\pi) - \tan(b)$
is valid. 
Your work is just a fancy way of claiming that $\int_0^\pi \sec^2x\,dx = \tan(\pi) - \tan(0).$ 
Note if you were to take $\int_0^{\pi/2-\epsilon} \sec^2 x\, dx + \int_{\pi/2+\epsilon}^\pi \sec^2 x\, dx$
and then look at what happens when $\epsilon$ approaches 0 from the right, you should get infinity. There are other cases where you get positive infinity for one integral and negative infinity for the other, and the temptation is to cancel them out, but that is not valid. Infinity minus infinity is undefined.
A: Your mistake is in the very first line where you claim that
$$\int_0^\pi \sec^2x\,dx = \color{red}{\lim_{b\to{\pi\over2}} \left(\int_0^b \sec^2x\,dx + \int_b^\pi \sec^2x\,dx\right)}.$$
This is not true because the two improper integrals must be set up as separate limits:
$$\int_0^\pi \sec^2x\,dx = \lim_{b_1\to\frac{\pi}{2}^{-}}\left(\int_0^{b_1} \sec^2x\,dx\right) + \lim_{b_2\to\frac{\pi}{2}^{+}}\left(\int_{b_2}^\pi \sec^2x\,dx\right).$$
Those $b_1$ and $b_2$ are, technically speaking, different things (even if we denote them with the same letter $b$, as people often do). Neither limit, i.e. neither improper integral, converges. For example, for the first one:
$$\lim_{b_1\to\frac{\pi}{2}^{-}}\left(\int_0^{b_1} \sec^2x\,dx\right) = \lim_{b_1\to\frac{\pi}{2}^{-}}\left(\left.\tan x\right|_0^{b_1}\right) = \lim_{b_1\to\frac{\pi}{2}^{-}}\left(\tan b_1 -\tan0\right) = \lim_{b_1\to\frac{\pi}{2}^{-}}\left(\tan b_1\right) = +\infty.$$
Similarly, the other one diverges to $+\infty$ too.
Now, we're entering a little bit of a grey area. On the one hand, we can not add limits, because the limit property that you implicitly applied in your very first incorrect step:
$$\lim(A+B)=\lim A+\lim B,$$
is conditional — it's only true when both limits on the right-hand side exist. In other words, we can only add limits when we know that those limits are numbers, but we can't add non-numbers.
… Or can't we? Since both integrals diverge to $+\infty$, and we are adding them, we can say that the total also goes to $+\infty$. (Note that subtracting infinities, on the other hand, is a no-no!) Still, since infinity is not a number, saying that this improper integral diverges, i.e. that this limit doesn't exist, is the right answer.
A: If $b>\pi/2$ then $\int_0^b\sec^2(\theta)\,d\theta=\infty$, not $\tan(b)-\tan(0)$. (The Fundamental Theorem of Calculus does not apply since $\tan$ is not differentiable on $(0,b)$.) Similarly with the other part if $b<\pi/2$.
A: The integral of a positive integrand cannot be zero. That settles the question in the title.

The reason why you find a zero value is because you are integrating across a singularity, and this may not be done without care.
A: You only need to sketch or visualise the integral to see what you're doing wrong. It's like claiming $\int_{-1}^1\frac{dx}{x^2}=-2$.
A: You can see from this that $\infty$ is indeed the correct evaluation.
Also, as seen in the graph, $\sec^2(\frac{\pi}{2})$ is undefined, and this will throw off your integral. 
