# Definite Integration of Trigonometric Functions using Substitution

## Part 1

Show that $\displaystyle \int_0^{\pi} \frac{\sin x}{1 + \cos^2 x} dx = \frac{\pi}{2}$.

\begin{align} \text{Let } A &= \displaystyle \int_0^{\pi} \frac{\sin x}{1 + \cos^2 x} dx \\ \text{Let } u &= \cos x \\ du &= -\sin x dx \\ x &= \pi \rightarrow u= \cos \pi = -1 \\ x &= 0 \rightarrow u = \cos 0 = 1 \\ A &= \int_1^{-1} \frac{-du}{1+u^2} \\ &= \int_{-1}^1 \frac{du}{1+u^2} \\ &= 2 \int_0^1 \frac{du}{1+u^2} &\color{green}{\frac{1}{1+u^2} \text{ is an even function}} \\ &= 2 \big[\tan x \big]_0^1 \\ &= 2 \tan^{-1} 1-2 \tan^{-1}0 \\ &= 2 \times \frac{\pi}{4}-2 \times 0 \\ &= \frac{\pi}{2} \end{align}

## Part 2

Find $\displaystyle \int_0^{\pi} \frac{x \sin x}{1 + \cos^2 x} dx$ using the substitution $x = \pi-u$.

\begin{align} \displaystyle x &= \pi-u \rightarrow dx = -du \\ x &= 0 \rightarrow 0 = \pi-u \rightarrow u = \pi \\ x &= \pi \rightarrow \pi = \pi-u \rightarrow u = 0 \\ \text{Let } B &= \int_0^{\pi} \frac{x \sin x}{1 + \cos^2 x} dx \\ &= \int_{\pi}^0 \frac{(\pi-u) \sin(\pi-u) }{1 + \cos^2 (\pi-u)}(-du) \\ &= \int_{0}^{\pi} \frac{(\pi-u) \sin(\pi-u) }{1 + \cos^2 (\pi-u)}du \\ &= \int_{0}^{\pi} \frac{(\pi-u) \sin u }{1 + (-\cos u)^2}du &\color{green}{\sin(\pi-u) = \sin u \text{ and } \cos(\pi-u) = -\cos u} \\ &= \int_{0}^{\pi} \frac{(\pi-u) \sin u }{1 + \cos^2 u}du \\ &= \int_{0}^{\pi} \frac{\pi \sin u }{1 + \cos^2 u}du-\int_{0}^{\pi} \frac{u \sin u }{1 + \cos^2 u}du \\ &= \int_{0}^{\pi} \frac{\pi \sin u }{1 + \cos^2 u}du-B &\color{green}{B = \int_0^{\pi} \frac{x \sin x}{1 + \cos^2 x} dx = \int_0^{\pi} \frac{u \sin u}{1 + \cos^2 u}du} \\ 2B &= \int_{0}^{\pi} \frac{\pi \sin u }{1 + \cos^2 u}du \\ &= \pi \int_{0}^{\pi} \frac{\sin u }{1 + \cos^2 u}du \\ &= \pi \int_{0}^{\pi} \frac{\sin x }{1 + \cos^2 x}dx \\ &= \pi \times \frac{\pi}{2} &\color{green}{\text{using the result of Part 1}} \\ &= \frac{\pi^2}{2} \\ B &= \frac{\pi^2}{4} \\ \require{AMSsymbols} \therefore \int_0^{\pi} \frac{x \sin x}{1 + \cos^2 x} dx &= \frac{\pi^2}{4} \end{align}