We show you how to calculate integrals using elementary methods. In addition, we teach you to study the properties of functions defined by an integral.

It is very important to be able to calculate an integral easily because it interferes in the study of differential equations another important subject of mathematical analysis.

**Exercises on how to calculate integrals**

We propose several exercises with detailed solutions to teach you how to calculate integrals.

**Exercise:** Determine the value of the following integrals \begin{align*} I=\int^{\frac{\pi}{2}}_0 e^{2x}\cos(x)dx,\qquad J=\int^{\frac{\pi}{2}}_0 \frac{\sin(\theta)}{2+\cos(\theta)}d\theta. \end{align*}

**Solution:** To compute $I$ we shall use the integration by parts method. In fact, we can write \begin{align*} I&= \int^{\frac{\pi}{2}}_0 \left(\frac{e^{2x}}{2}\right)’\cos(x)dx\cr &= \left[ \frac{e^{2x}}{2} \cos(x)\right]^{\frac{\pi}{2}}_0- \int^{\frac{\pi}{2}}_0 \frac{e^{2x}}{2}\cos'(x)dx\cr & = \frac{1}{2}+ \frac{1}{2} \int^{\frac{\pi}{2}}_0 e^{2x} \sin(x)dx\cr & = \frac{1}{2}+ \frac{1}{2}\left( \left[ \frac{e^{2x}}{2} \sin(x)\right]^{\frac{\pi}{2}}_0-\int^{\frac{\pi}{2}}_0 \frac{e^{2x}}{2} \sin'(x)dx\right)\cr &= \frac{1}{2}+\frac{e^{\pi}}{4}- \frac{1}{4} \int^{\frac{\pi}{2}}_0 e^{2x}\cos(x)dx\cr &= \frac{1}{2}+\frac{e^{\pi}}{4}- \frac{1}{4} I. \end{align*} We deduce that \begin{align*} I+ \frac{1}{4} I= \frac{1}{2}+\frac{e^{\pi}}{4}. \end{align*} Finally, \begin{align*} I=\frac{2+e^\pi}{5}. \end{align*}

To calculate $J$ we will use the integration by parts technique. We put $t=\cos(\theta)$. We then have $dt=-\sin(\theta)d\theta$. Then \begin{align*} J&=\int^{\cos(\frac{pi}{2})}_{\cos(0)} \frac{-dt}{2+t}\cr &= -\int^0_1 \frac{dt}{2+t}\cr &= \int^1_0 \frac{dt}{2+t}\cr &= \left[\ln(2+t)\right]^1_0\cr & = \ln(3)-\ln(2)=\ln\left(\frac{3}{2}\right). \end{align*}

**Exercise:** Let consider the function \begin{align*} g(x)=\int^x_{\frac{1}{x}} \frac{\ln(t)}{t}dt. \end{align*}

- Determine the domain of definition $D_g$ of $g$.
- Prove that $g$ is differentiable on $D_g$ and compute $g'(x)$ for any $x\in D_g$.
- Deduce $g$ is the null function.

**Solution:** 1) We define the function \begin{align*} f(t)=\frac{\ln(t)}{t}. \end{align*} clearly, the function $f$ is only defined in $(0,+\infty)$. From the expression of $g$ we then conclude that $g(x)$ is well defined if and only if $x\in (0,+\infty)$. Hence the domain of definition of $g$ is $D_g=(0,+\infty)$.

2) Denote by $F$ the primitive of $f$, $F$ exists because the function $f$ is continuous on $(0,+\infty)$. We select \begin{align*} F(x)=\int^x_c f(t)dt \end{align*} for any constant $c>0$. The function $F$ is differentiable on $(0,+\infty)$ and $F'(x)=f(x)$ for all $x\in (0,+\infty)$. On the other hand, we can write \begin{align*} g(x)&=\int^x_c f(t)dt+\int^c_{\frac{1}{x}}f(t)dt\cr &= F(x)-F\left(\frac{1}{x}\right) \end{align*} for all $x\in (0,+\infty)$. Hence $g$ is differentiable on $(0,+\infty)$ as composition and sum of differentiable functions. Moreover, for all $x>0,$ \begin{align*} g'(x)&=F'(x)-\left(F\left(\frac{1}{x}\right)\right)’\cr &= f(x)- \left(\frac{1}{x}\right)’ F’\left(\frac{1}{x}\right)\cr &= \frac{\ln(x)}{x}+\frac{1}{x^2} f\left(\frac{1}{x}\right)\cr &= \frac{\ln(x)}{x}-\frac{\ln(x)}{x}=0. \end{align*}

3) An the derivative of $g$ on $(0,+\infty)$ is zero, then $g$ is the constant function on $(0,+\infty)$. But $g(1)=0$. Then $g(x)=0$ for any $x\in (0,+\infty)$.