Getting wrong answer trying to evaluate $\int \frac {\sin(2x)dx}{(1+\cos(2x))^2}$ I'm trying to evaluate $$\int \frac {\sin(2x)dx}{(1+\cos(2x))^2} = I$$

Here's what I've got:

$$t=1+\cos(2x)$$
$$dt=-2\sin(2x)dx \implies dx = \frac {dt}{-2}$$
$$I = \int \frac 1{t^2} \cdot \frac {-1}2 dt = -\frac 12 \int t^{-2}dt = -\frac 12 \frac {t^{-2+1}}{-2+1}+C$$
$$=-\frac 12 \frac {t^{-1}}{-1}+C = \frac 1{2t} +C = \frac 1{2(1+\cos(2x)}+C$$

I need to find what went wrong with my solution. I know the answer is correct but the line $dt=-2\sin(2x)dx$ concludes that $dx=\frac {dt}{-2}$ is false.  But why?  What should it be instead?
Probably, you saw the solution as
$$\frac{\sec^2(x)}{4}+C$$

But note that
$$\begin{array}{rclcc}
\frac{1}{2}\frac{1}{1+\cos(2x)}&amp;=&amp;\frac{1}{2}\frac{1}{1+\cos^2(x)-\sin^2(x)}&amp;/\,\,\cos(2x)=\cos^2(x)-\sin^2(x)\\
&amp;=&amp;\frac{1}{2}\frac{1}{1+\cos^2(x)-\sin^2(x)}&amp;/\,\,1=\cos^2(x)+\sin^2(x)\\
&amp;=&amp;\frac{1}{2}\frac{1}{2\cos^2(x)}\\
&amp;=&amp;\frac{\sec^2(x)}{4}\end{array}$$
$$\int \frac {\sin(2x)dx}{(1+\cos(2x))^2} = [1+cos2x = u, -2sin2x dx = du] = -0.5 \int \frac {du}{u^2}= \frac{0.5}{u}+c=\frac{1}{2+2cos2x}+c  $$