Evaluating $\int \frac{1 + \sin x}{1 - \sin x} dx$ 
Question:
Evaluate  $\displaystyle\int \dfrac{1 + \sin x}{1 - \sin x} dx$

Here's my work
$$\displaystyle\int \dfrac{1 + \sin x}{1 - \sin x} dx$$
$$\displaystyle\int \dfrac{(1 + \sin x)^2}{\cos^2x} dx$$
$$\displaystyle\int \dfrac{1 + \sin^2x + 2\sin x}{\cos^2x} dx$$
$$\displaystyle\int \sec^2(x) + \tan^2(x) + 2\tan(x) \sec(x) \ dx$$
$$\displaystyle\int \sec^2(x) + \sec^2(x) - 1+ 2\tan(x) \sec(x) \ dx$$
$$\boxed{2 [\tan (x) + \sec(x)] - x + C}$$
But wait a min, what's this:

The curve $2 [\tan (x) + \sec(x)] - x + 2$ has more than $1$ curve, while the original integer has only $1$. Can anyone explain this to me?
 A: Indefinite integration techniques are fine, but they lose sight of where the antiderivative (or even the integrand) is actually defined.
Your solution exists everywhere bar some singularities, and it is also a valid antiderivative to the integrand, bar some singularities.
However, your Desmos plot is plotting the integral from $0\to x$: if $x$ is too large, that forces the integral to “cross” these singularities: for instance, $$\int_0^{\pi}\frac{1+\sin x}{1-\sin x}\,\mathrm{d}x$$Does not exist, since when $x$ is at $\pi/2$, we have a division by zero in the integrand and the integral is unbounded, or as Desmos phrases it, undefined. This way you are only getting a valid red curve near the origin, since for all $x$ larger than $\pi/2$ or smaller than $-3\pi/2$, the integral crosses a singularity and Desmos won’t plot it.
That said, I bet if you asked Desmos to plot the integral from, say, $0.001+\pi/2\to x$, you’d get a red curve matching one of your blues - up to a constant - because then the integral will be defined (in that area: you still face the same problem for crossing the other singularities).
A: Your computations are fine. But what you have asked Desmos to do was to compute $\displaystyle\int_0^x\frac{1+\sin(t)}{1-\sin(t)}\,\mathrm dt$, which is defined only in the interval $\left(-\frac{3\pi}2,\frac\pi2\right)$.
