# Evaluate $\int_0^4 |\sqrt{x} - 1|~dx$

I am working on a problem set involving indefinite integrals. Currently stuck in this question:

$\int_0^4 |\sqrt{x} - 1|~dx$

I tried the following substitution:

Let $u=\sqrt{x}$ so, $du=\dfrac{dx}{2\sqrt{x}}$when $x= 4 \Rightarrow u=2$ and $x=0 \Rightarrow u=0$

This is where I am stuck. It seems that my substitution fails me.

Also, since it is an absolute value, I tried to express it in piecewise function. However, I can't possibly make sense out of it.

Can anyone help me?

PS. I worked out the previous item before this, however, I do not know if I did it correctly:

$\int_0^3 |x^2-4|~dx = \int_0^2 4-x^2~dx +\int_2^3 x^2-4~dx= 3$

Is this correct? Thanks

-

Observe that between [0,1), $\sqrt x -1 \lt 0$. Hence |$\sqrt x -1$|=-$(\sqrt x -1)$.
Therefore $$\int_0^4 |\sqrt{x} - 1|~dx=-\int_0^1 (\sqrt{x} - 1)~dx+\int_1^4(\sqrt{x} - 1)~dx$$