Suppose you know the density of a random variable $X$. You have $Y=\text{some function of }X$, for example $Y=X^3 + \cos(\sqrt X)$.
You could find the density of the random variable $Y$ and then write
$$
\operatorname{E}(Y) = \int_\text{?}^\text{?} y f_Y(y)\,dy.
$$
But you can also do it the following way, which is often less onerous:
$$
\operatorname{E}(Y) = \int_\text{?}^\text{?} (x^3+\cos(\sqrt x)) f_X(x)\,dx.
$$
Sometimes this is called "the law of the unconscious statistician". Google that term.
The bounds of integration for the first integral would in general be different from those of the second. In your example, as $x$ goes from $1$ to $4$ then $\sqrt x$ goes from $1$ to $2$. But you don't need that if you use the second integral above.