Back to the class
The following integral was encountered in class (I guessed the correct first step in class!):
$$\displaystyle\int \csc(x) \mathrm{d}x.$$
We looked up in the book that the anti-derivative is
$$\displaystyle\int \csc(x) \mathrm{d}x = -\ln(\cot(x)+\csc(x)) + C.$$
Derivation of this integral formula
We will rewrite
$$\csc(x) = \dfrac{1}{\sin(x)} = \dfrac{\sin(x)}{\sin^2(x)},$$
and apply the Pythagorean identity $\sin^2(x)+\cos^2(x)=1$ rearranged to $\sin^2(x)=1-\cos^2(x)$ in the denominator to write
$$\csc(x) = \dfrac{\sin(x)}{1-\cos^2(x)}.$$
If we use the $u$-substitution $u=\cos(x)$ hence $\mathrm{d}u=-\sin(x)\mathrm{dx}$ we get
$$\displaystyle\int \csc(x) \mathrm{d}x = \displaystyle\int \dfrac{\sin(x)}{1-\cos^2(x)} \mathrm{d}x=-\displaystyle\int \dfrac{1}{1-u^2} \mathrm{d}u.$$
Notice the following algebraic fact (we will "find" this sort of thing when we do partial fraction decompositions in chapter 8):
$$\dfrac{1}{u-1} - \dfrac{1}{u+1} = \dfrac{2}{u^2-1},$$
or in other words
$$\dfrac{1}{2} \left[ \dfrac{1}{u-1} - \dfrac{1}{u+1} \right] = \dfrac{1}{u^2-1}.$$
Using that fact of algebra, we can finally complete the integral:
$$\begin{array}{ll}
\displaystyle\int \csc(x) \mathrm{d}x &= -\displaystyle\int \dfrac{1}{1-u^2} \mathrm{d}u \\
&= -\left[\dfrac{1}{2} \displaystyle\int \dfrac{1}{u-1} \mathrm{d}u - \dfrac{1}{2}\displaystyle\int \dfrac{1}{u+1} \mathrm{d}u \right] \\
&\stackrel{w=u-1,z=u+1}{=} -\left[ \dfrac{1}{2} \displaystyle\int \dfrac{1}{w} \mathrm{d}w - \dfrac{1}{2} \displaystyle\int \dfrac{1}{z} \mathrm{d}z \right] \\
&=-\left[\dfrac{1}{2}\ln(|w|) - \dfrac{1}{2} \ln(|z|) \right] +C \\
&= -\left[ \dfrac{1}{2}\ln(|u-1|) - \dfrac{1}{2} \ln(|u+1|) \right] + C \\
&= -\left[ \dfrac{1}{2} \ln(|\cos(x)-1|) - \dfrac{1}{2} \ln(|\cos(x)+1|)\right] + C \\
&=-\left[ \dfrac{1}{2} \ln \left( \left| \dfrac{\cos(x)-1}{\cos(x)+1} \right| \right) \right] + C \\
&= -\left[ \dfrac{1}{2} \ln \left( \left| \left( \dfrac{\cos(x)-1}{\cos(x)+1} \right)\left( \dfrac{\cos(x)-1}{\cos(x)-1} \right) \right| \right) \right] + C \\
&= -\left[ \dfrac{1}{2} \ln \left( \dfrac{(1-\cos(x))^2}{\cos^2(x)-1} \right) \right] + C \\
&= -\left[ \dfrac{1}{2} \ln \left( \left[ \dfrac{1-\cos(x)}{\sin(x)} \right]^2 \right) \right] + C\\
&= -\ln \left( \sqrt{ \left[ \dfrac{1-\cos(x)}{\sin(x)} \right]^2 } \right) + C \\
&= -\ln \left( \dfrac{1-\cos(x)}{\sin(x)} \right) + C \\
&= -\ln \left( \dfrac{1}{\sin(x)} - \dfrac{\cos(x)}{\sin(x)} \right) + C \\
&= -\ln(\csc(x) - \cot(x)) + C,
\end{array}$$
as was to be shown.
The technique that would be used here to find $\dfrac{1}{u^2-1}=\dfrac{1}{u-1} - \dfrac{1}{u+1}$ is called partial fraction decomposition, and it is what was needed in the question from 20 January 2017 class.