Problem with $\int \frac{\sin^{3}x+\cos^{3}x}{\sin{x}\cos{x}} \text{dx}$

Note that

$$\begin{align} \int \frac{u^2}{1-u^2}\,du&=-u+\frac12\log\left|\frac{1-u}{1+u}\right|+C\\\\ &=-\sin(x)+\frac12\log\left|\frac{1-\sin(x)}{1+\sin(x)}\right|+C \end{align}$$

and similarly for $\int \frac{m^2}{1-m^2}\,dm$ with $m=\cos(x)$, and not $\sin(x)$.


NOTE $1$:

We need to be preserve the separate identities of the transformations $u \to \sin(x)$ and $m\to \cos(x)$ throughout the analysis. That is to say, that $u$ is not simply a "dummy" integration variable inasmuch as it represents $\sin(x)$, and not $\cos(x)$.

Naturally, both are $u$ and $m$ are "dummy" variables in the sense that we could use other symbols to represent the transformation. But, it is of critical importance to distinguish the two different transformations by the corresponding pair of symbols used as new variables.


NOTE $2$:

One way to clarify things is to turn the indefinite integral into a definite one. The separate substitutions lead to distinct integration limits.

So, let's look at the integrals $\int_a^b \frac{\sin^2(x)}{1-\sin^2(x)}\cos(x)\,dx$ and $\int_a^b \frac{\cos^2(x)}{1-\cos^2(x)}\sin(x)\,dx$. Upon enforcing the proposed substitutions we arrive at

$$\begin{align} \int_a^b \frac{\sin^2(x)}{1-\sin^2(x)}\cos(x)\,dx=\int_{\sin(a)}^{\sin(b)} \frac{u^2}{1-u^2}\,du\tag 1 \end{align}$$

and

$$\begin{align} \int_a^b \frac{\cos^2(x)}{1-\cos^2(x)}\sin(x)\,dx=-\int_{\cos(a)}^{\cos(b)} \frac{u^2}{1-u^2}\,du \tag 2 \end{align}$$

Clearly, $(1)$ and $(2)$ do not add to zero.


NOTE $3$:

The indefinite integral (antiderivative), $F(x)$, of a function $f$, can be more clearly written $F(x)=\int_a^x f(t)\,dt+C$ (for a suitable number $a$). This can help to avoid the potential pitfall that comes from the notation $F(x)=\int f(x)\,dx$.