<s>[INST] Evaluating $\int\frac {dx}{\cos x-1}$ I was wondering if my solution to the integral: $$\int\frac{dx}{1 - \cos x}$$ is legit?
$$
\int\frac1{\cos x-1}\,\mathrm{d}x=\int-\frac12\cdot\frac1{\sin^2\left(\frac x2\right)}=\frac12\int-\csc\left(\frac12x\right)\,\mathrm{d}x=\boxed{\cot\left(\frac12x\right)+C}\\
\left(\cot\left(\frac12x\right)\right)'=-\csc^2\left(\frac12x\right)\cdot\frac12=\boxed{-\frac12\csc^2\left(\frac12x\right)}\\
\cos x-1=\cos x-\cos(0)=-2\sin\left(\frac{x+0}2\right)\sin\left(\frac{x-0}2\right)=-2\sin^2\left(\frac x2\right)
$$
orginal image
My solution is based around the fact that the derivative of $\cot x$ is $-\csc^2x$.
I basically converted $\cos x-1$ to $\cos x - \cos 0$ and from there used the $\cos a - \cos b$ trig identity.
I then googled the solution and found that there is a way to do it by multiplying by a conjugate but was still wondering if there is a flaw in my logic which I don't realize?
Thanks in advance :)
 [/INST] Your logic is good, and your answer is correct. In the video, they find that $\int \frac{dx}{1-\cos x} = \csc x + \cot x + C$, and you found that $\int \frac{dx}{1-\cos x} = \cot \frac{x}{2} + C$, and you can show that these are equivalent:
$$\begin{eqnarray}\csc x + \cot x & = & \frac{1}{\sin x} + \frac{\cos x}{\sin x} \\
& = & \frac{1 + \cos x}{\sin x} \\
& = & \frac{1 + (2 \cos^2 \frac{x}{2} - 1)}{2 \sin \frac{x}{2} \cos \frac{x}{2}} \\
& = & \frac{2 \cos^2 \frac{x}{2}}{2 \sin \frac{x}{2} \cos \frac{x}{2}} \\
& = & \frac{\cos \frac{x}{2}}{\sin \frac{x}{2}} \\
& = & \cot \frac{x}{2}
\end{eqnarray}$$
(Note that there was no guarantee that the $+C$ in both integrals would be the same, but in this case it is.)
</s>