I'm in highschool and just started integration. I found the following problem in an old question paper and I find it very challenging.
$$\int_0^1\sqrt{x^2-2x+1} dx$$ so I simplified it algebraically to
$$\int_0^1\sqrt{(x-1)^2} dx$$ which of course is $$\int_0^1|x-1| dx$$ as the absolute value is a linear function over $x \in [0,\infty)$ so I proceed to evaluate it as $x^2/2-x$ for upper limit $1$ and lower limit $0$ which is $((1)^2/2 -1)-(0-0)$ and equals $-\frac12$, but according to wolfram alpha it is $\frac12$. link to wolframalpha's computation
Please explain at beginner level.
for $x \in (0, 1), |x-1|=1-x$.
Hence we get $\frac12$.
Note that integrating a nonnegative function gives you nonnegative solution.