Example 2.8. Calculate the integral $\int_{2}^{7}(x-3)^{2} d x$.

a) Using the substitution $z=x-3$.

b) Using the substitution $z=(x-3)^{2}$.
Solution.

a) If $z=x-3$, then $d z=d x, x_{1}=2$ corresponds to $z_{1}=$ $=-1, x_{2}=7$ corresponds to $z_{2}=4$. We obtain

$$
\int_{-1}^{4} z^{2} d z=\left.\frac{z^{3}}{3}\right|_{-1} ^{4}=\frac{4^{3}}{3}-\frac{(-1)^{3}}{3}=\frac{65}{3} \approx 21.67
$$

b) Formal use of the substitution $z=(x-3)^{2}, z_{1}=$ $=1, z_{2}=16, d x=\frac{d z}{2 \sqrt{z}}$ leads to the following incorrect result

$$
\int_{1}^{16} \frac{z d z}{2 \sqrt{z}}=0.5 \int_{1}^{16} \sqrt{z} d z=0.5\left.z^{3 / 2}\right|_{1} ^{16}=\frac{64}{3}-\frac{1}{3}=21
$$

The error arose because the transformation $z=$ $=(x-3)^{2}$ is not one-to-one. The correct application of this transformation is possible only by dividing the original integral into two parts, corresponding to the intervals $[2,3]$ and $[3,7]$. In the interval $x \in[2,3]$, the transformation $z=(x-3)^{2}$ corresponds to the inverse transformation $x=3-\sqrt{z}$. Here, $d x=-\frac{d z}{2 \sqrt{z}}$, and $z_{1}=1, x_{1}=2, z_{2}=0, x_{2}=3$. In the interval $[3,7]$, the inverse transformation is: $x=3+\sqrt{z}, z_{1}=0, x_{1}=3$, $z_{2}=16, x_{2}=7$.

Thus, we obtain

$$
\begin{gathered}
\int_{2}^{7}(x-3)^{2} d x=\int_{2}^{3}(x-3)^{2} d x+\int_{3}^{7}(x-3)^{2} d x= \\
=\int_{1}^{0} \frac{-z d z}{2 \sqrt{z}}+\int_{0}^{16} \frac{z d z}{2 \sqrt{z}}=-0.5 \int_{1}^{0} \sqrt{z} d z+0.5 \int_{0}^{16} \sqrt{z} d z= \\
=-0.5\left.\frac{z^{3 / 2}}{3 / 2}\right|_{1} ^{0}+0.5\left.\frac{z^{3 / 2}}{3 / 2}\right|_{0} ^{16}=\frac{65}{3} .
\end{gathered}
$$