A mystery of $\int \frac{1}{a^2\cos^2{x}+b^2\sin^2{x}} dx$ I am reading a calculus book.
This book contains the following problem:

Let $a,b>0$.
Find $$\int \frac{1}{a^2\cos^2{x}+b^2\sin^2{x}} dx.$$

The author's answer is

$$\frac{1}{ab}\arctan{(\frac{b}{a}\tan{x})}.$$

This function is not continuous and is not even defined at $\frac{\pi}{2}+n\pi(n\in\mathbb{Z}).$
$\frac{1}{a^2\cos^2{x}+b^2\sin^2{x}}$ is defined on $\mathbb{R}$.
I think primitive functions are continuous but this function is not continuous.
Why?

When you divide the numerator and denominator of $\frac{1}{a^2\cos^2{x}+b^2\sin^2{x}}$ by $cos^2{x}$ to integrate it with respect to $x$, you made a tacit assumption that $cos{x}\neq 0$ i.e $x$ does not belong to odd multiple of $\pi/2$.
Therefore, the primitive function $\frac{1}{ab}\arctan{(\frac{b}{a}\tan{x})}$ need not be derivable or continuous or defined at $x= \frac{\pi}{2}+n\pi (n\in\mathbb{Z})$
