Integration by substitution
Example 2: Antiderivatives of tangent and cotangent

The tangent function can be integrated using substitution by expressing it in terms of the sine and cosine: tan x = sin x cos x {\displaystyle \tan x={\tfrac {\sin x}{\cos x}}}.

Using the substitution u = cos x {\displaystyle u=\cos x} gives d u = − sin x d x {\displaystyle du=-\sin x\,dx} and ∫ tan x d x = ∫ sin x cos x d x = ∫ − d u u = − ln | u | + C = − ln | cos x | + C = ln | sec x | + C. {\displaystyle {\begin{aligned}\int \tan x\,dx&=\int {\frac {\sin x}{\cos x}}\,dx\\&=\int -{\frac {du}{u}}\\&=-\ln \left|u\right|+C\\&=-\ln \left|\cos x\right|+C\\&=\ln \left|\sec x\right|+C.\end{aligned}}}

The cotangent function can be integrated similarly by expressing it as cot x = cos x sin x {\displaystyle \cot x={\tfrac {\cos x}{\sin x}}} and using the substitution u = sin x, d u = cos x d x {\displaystyle u=\sin {x},du=\cos {x}\,dx}: ∫ cot x d x = ∫ cos x sin x d x = ∫ d u u = ln | u | + C = ln | sin x | + C. {\displaystyle {\begin{aligned}\int \cot x\,dx&=\int {\frac {\cos x}{\sin x}}\,dx\\&=\int {\frac {du}{u}}\\&=\ln \left|u\right|+C\\&=\ln \left|\sin x\right|+C.\end{aligned}}}
detectable_content:number_placeholders[5], detectable_format:title