Solve for: integral of (cos(x))/(sin(x)^2) x

Expression: $\int{ \frac{ \cos\left({x}\right) }{ {\sin\left({x}\right)}^{2} } } \mathrm{d} x$

To use the partial integration formula, expand the expression into $\cos\left({x}\right) \times \frac{ 1 }{ {\sin\left({x}\right)}^{2} }$

$\int{ \cos\left({x}\right) \times \frac{ 1 }{ {\sin\left({x}\right)}^{2} } } \mathrm{d} x$

Prepare for integration by parts by defining $u$ and $\mathrm{d}^v$

$\begin{array} { l }u=\cos\left({x}\right),\\\mathrm{d}^v=\frac{ 1 }{ {\sin\left({x}\right)}^{2} }\mathrm{d}^x\end{array}$

Find the differential using $\mathrm{d}^u=u '\mathrm{d}^x$

$\begin{array} { l }\mathrm{d}^u=-\sin\left({x}\right)\mathrm{d}^x,\\\mathrm{d}^v=\frac{ 1 }{ {\sin\left({x}\right)}^{2} }\mathrm{d}^x\end{array}$

Determine $v$ by evaluating the integral

$\begin{array} { l }\mathrm{d}^u=-\sin\left({x}\right)\mathrm{d}^x,\\v=-\cot\left({x}\right)\end{array}$

Substitute $u=\cos\left({x}\right)$, $v=-\cot\left({x}\right)$, $\mathrm{d}^u=-\sin\left({x}\right)\mathrm{d}^x$ and $\mathrm{d}^v=\frac{ 1 }{ {\sin\left({x}\right)}^{2} }\mathrm{d}^x$ into $\int{ u } \mathrm{d} v=uv-\int{ v } \mathrm{d} u$

$\cos\left({x}\right) \times \left( -\cot\left({x}\right) \right)-\int{ -\cot\left({x}\right) \times \left( -\sin\left({x}\right) \right) } \mathrm{d} x$

Simplify the expression

$-\frac{ {\cos\left({x}\right)}^{2} }{ \sin\left({x}\right) }-\int{ -\cot\left({x}\right) \times \left( -\sin\left({x}\right) \right) } \mathrm{d} x$

Multiplying two negatives equals a positive: $\left( - \right) \times \left( - \right)=\left( + \right)$

$-\frac{ {\cos\left({x}\right)}^{2} }{ \sin\left({x}\right) }-\int{ \cot\left({x}\right)\sin\left({x}\right) } \mathrm{d} x$

Use $\cot\left({t}\right)=\frac{ \cos\left({t}\right) }{ \sin\left({t}\right) }$ to transform the expression

$-\frac{ {\cos\left({x}\right)}^{2} }{ \sin\left({x}\right) }-\int{ \frac{ \cos\left({x}\right) }{ \sin\left({x}\right) } \times \sin\left({x}\right) } \mathrm{d} x$

Cancel out the common factor $\sin\left({x}\right)$

$-\frac{ {\cos\left({x}\right)}^{2} }{ \sin\left({x}\right) }-\int{ \cos\left({x}\right) } \mathrm{d} x$

Use $\int{ \cos\left({x}\right) } \mathrm{d} x=\sin\left({x}\right)$ to evaluate the integral

$-\frac{ {\cos\left({x}\right)}^{2} }{ \sin\left({x}\right) }-\sin\left({x}\right)$

Add the constant of integration $C \in ℝ$

$\begin{array} { l }-\frac{ {\cos\left({x}\right)}^{2} }{ \sin\left({x}\right) }-\sin\left({x}\right)+C,& C \in ℝ\end{array}$