text: ## Calculus (3rd Edition)
  
  $2$
  We have $$\int_{0}^{\pi}|\cos x| d x= \int_{0}^{\pi/2}|\cos x| d x+\int_{\pi/2}^{\pi}|\cos x| d x\\ =\int_{0}^{\pi/2}\cos xd x-\int_{\pi/2}^{\pi}\cos x d x\\ =\sin x|_{0}^{\pi/2}-\sin x|_{\pi/2}^{\pi}\\ =1-(-1)=2 .$$