Evaluate the integral
\[ \int \csc x \; dx \]
Note that there are several methods to calculate the above integral. The steps described below allow one to review many ideas in trigonometry and in calculating integrals; also the final result is quite simple.
Use \( \csc x = \dfrac{1}{\sin x} \) to rewrite the integral as
\[ \int \csc x \; dx = \int \dfrac{1}{\sin x} \; dx \]
\( \sin x \) may be written as
\[ \sin x = \sin (2 (\frac{x}{2}) ) \]
Use trigonometric identity \( \sin (2x) = 2 \sin x \cos x \) to write
\[ \sin x = 2 \sin \left(\dfrac{x}{2} \right) \cos \left(\dfrac{x}{2} \right) \]
and substitute in the integral
\[ \int \csc x \; dx = \int \dfrac{1}{2 \sin \left(\dfrac{x}{2} \right) \cos \left(\dfrac{x}{2} \right)} dx \]
Use Integration by Substitution: Let \( u = \sin \left(\dfrac{x}{2} \right) \) and hence
\( \dfrac{du}{dx} = \dfrac{1}{2} \cos \left(\dfrac{x}{2} \right) \) or \( dx = \dfrac{2}{\cos \left(\dfrac{x}{2} \right)} du \) and substitute in the above integral to obtain
\[ \int \csc x \; dx = \int \dfrac{1}{2 u \cos \left(\dfrac{x}{2} \right)} \dfrac{2}{\cos \left(\dfrac{x}{2} \right)} du \]
Simplify
\[ \int \csc x \; dx = \int \dfrac{1}{ u \cos^2 \left(\dfrac{x}{2} \right)} du \]
Use trigonometric identity \( \cos^2 x = 1 - \sin^2 x \) to write
\[ \cos^2 \left(\dfrac{x}{2} \right) = 1 - \sin^2 \left(\dfrac{x}{2} \right) = 1 - u^2 \]
and substitute in the above integral to obtain
\[ \int \csc x \; dx = \int \dfrac{1}{ u (1-u^2)} du \]
Use partial fractions decomposition to write the integrand as
\[ \dfrac{1}{ u (1-u^2)} = \dfrac{1}{u}-\dfrac{1}{2\left(u+1\right)}-\dfrac{1}{2\left(u-1\right)} \]
Substitute in the integral
\[ \int \csc x \; dx = \int \left(\dfrac{1}{u}-\dfrac{1}{2\left(u+1\right)}-\dfrac{1}{2\left(u-1\right)}\right) du \\ =
\int \dfrac{1}{u} du - \int \dfrac{1}{2\left(u+1\right)} du - \int \dfrac{1}{2\left(u-1\right)} du
\]
Use the formula of integration \( \displaystyle\int \dfrac{f'(x)}{f(x)} \; dx = \ln | f(x)| +c \) to obtain
\[ \int \csc x \; dx = \ln |u| - \dfrac{1}{2} \ln |u+1| - \dfrac{1}{2} \ln |u-1| + c\]
Group the logarithmic expressions using the properties \( \quad \ln \dfrac{a}{b \cdot c} = \ln a - \ln b - \ln c \) and \( \quad \ln \dfrac{1}{2} a = \ln \sqrt {a} \) to write
\[ \int \csc x \; dx = \ln |u| - \left(\dfrac{1}{2} \ln |u+1| + \dfrac{1}{2} \ln |u-1| \right) + c \\
= \ln \dfrac{|u|}{\sqrt {|u+1| |u - 1|} } + c \\
= \ln \dfrac{|u|}{\sqrt {|u^2 - 1|} } + c \]
Note that \( |u^2 - 1| = |1 - u^2| \) and hence
\[ \int \csc x \; dx = = \ln \dfrac{|u|}{\sqrt {|1 - u^2|} } + c\]
Substitute back \( u = \sin \left(\dfrac{x}{2} \right) \)
\[ \int \csc x \; dx = \ln \dfrac{\left|\sin \left(\dfrac{x}{2} \right)\right|}{\sqrt { \left|1 - \left(\sin \left(\dfrac{x}{2} \right)\right)^2 \right|} } +c \]
Use trigonometric identity \( \cos^2 \left(\dfrac{x}{2} \right) = 1 - \sin^2 \left(\dfrac{x}{2} \right) \) to calculate the above integral
\[ \int \csc x \; dx = \ln \dfrac{\left|\sin \left(\dfrac{x}{2} \right)\right|}{\sqrt {\left| \left(\cos \left(\dfrac{x}{2} \right)\right)^2\right|} } +c \\
\]
Simplify using \( \sqrt {\left|(\cos \left(\dfrac{x}{2} \right))^2\right|} = \left|\cos \left(\dfrac{x}{2} \right)\right| \)
\[ \int \csc x \; dx = \ln \dfrac{\left|\sin \left(\dfrac{x}{2} \right)\right|}{\left|\cos \left(\dfrac{x}{2} \right)\right|} +c \]
Use trigonometric identity \( \tan x = \dfrac{\sin x }{\cos x } \) and the property of the absolute value \( \dfrac{|a|}{|b|} = \left|\dfrac{a}{b}\right|\) to write the final answer as
\[ \boxed { \int \csc x \; dx = \ln \left|\tan \left(\dfrac{x}{2} \right)\right| +c } \]