Problem with $\int \frac{\sin^{3}x+\cos^{3}x}{\sin{x}\cos{x}} \text{dx}$ I wrote 
\begin{eqnarray}
I 
&=& \int \frac{\sin^{3}x+\cos^{3}x}{\sin{x}\cos{x}} \text{dx}\\
&=& 
\int \frac{\sin^{3}x}{\sin{x}\cos{x}}\text{dx}+\int \frac{\cos^{3}x}{\sin{x}\cos{x}}\text{dx}\\
 &=& 
 \int \frac{\sin^{2}x}{\cos^2{x}}\cos{x}\text{dx}+\int \frac{\cos^{2}x}{\sin^2{x}}\sin{x}\text{dx}\\
 &=& 
 \int \frac{\sin^{2}x}{1-\sin^2{x}}\cos{x}\text{dx}+\int \frac{\cos^{2}x}{1-\cos^2{x}}\sin{x}\text{dx}\\
&=&
\int\frac{u^2}{1-u^2}du-\int\frac{m^2}{1-m^2}dm\\
&=&
\color{blue}{\int\frac{u^2}{1-u^2}du-\int\frac{u^2}{1-u^2}du}\\
&=&
0
\end{eqnarray}
and Other
Let $x=\dfrac{\pi}{2}-t$ so
$$I=\int \frac{\sin^{3}x+\cos^{3}x}{\sin{x}\cos{x}} \text{dx}=-\int \frac{\sin^{3}t+\cos^{3}t}{\sin{t}\cos{t}} \text{dt}=-I$$
but correct answer is 
$$
I=\ln\left|\dfrac{1+\tan\dfrac{x}{2}}{1-\tan\dfrac{x}{2}}\right|+\ln\left|\tan\dfrac{x}{2}\right|-\sin x+\cos x+C
$$

Question.1 Where is wrong.?
Question.2 what conditions guarantee that our changing variable in indefinite integrals doesn't change our final solutions!.


$$\sin^3x+\cos^3x=(\sin x+\cos x)(1-\sin x\cos x)$$
$$\implies\dfrac{\sin^3x+\cos^3x}{\sin x\cos x}=\dfrac{\sin x+\cos x}{\sin x\cos x}-\sin x-\cos x$$
As $\int(\sin x+\cos x)dx=\sin x-\cos x$ and $(\sin x-\cos x)^2=1-2\sin x\cos x,$
set $\sin x-\cos x=u$ in $$\int\dfrac{\sin x+\cos x}{\sin x\cos x}dx$$
