# Why is $\int_{5}^{2}{\frac{2x-8}{4+(x-4)}}dx$ not equal to $\int_{5}^{2}{\frac{2x-8}{4+\sqrt{(x-4)^2}}}dx$?

I have been answering some integration questions which mainly uses integration by substitution method, anyways I answered the question, but when I was doing checking on my trusty calculator I noticed a weird thing, I had 2 exact integrals that equated to different results, those are the 2 definite integrals:

$$\int_{5}^{2}{\frac{2x-8}{4+(x-4)}}dx$$

$$\int_{5}^{2}{\frac{2x-8}{4+\sqrt{(x-4)^2}}}dx$$

The first one was $$1.33032...$$, while the latter was $$0.54143...$$. I don't get it, how both don't result in the same number? I thought maybe my calculator had a problem or was weak, using old algorithm or anything like that, so I just went to an online integral calculator, https://www.integral-calculator.com/ And I got the same weird results, I don't know why.

I think maybe the algorithms used to integrate don't equate roots first and powers first? What is the problem? is it something that has to do with the algorithms that calculate the integrals? or it has to do with something in maths?

I did another test on https://desmos.com here is a sample image.

My question is why is this happening. If you would answer, please treat me as if I was a High school student, (because I am).

• $\sqrt {(x-4)^2}=|x-4|$. Not $x-4$ – lulu Mar 31 at 10:50
• Of course here $x$ is real. We know that $\sqrt {(x-4)^2}=|x-4|$ is false in general for complex $x$. – GEdgar Mar 31 at 12:01
• This is a real valued integral. Note that things go sideways here because $4$ is in the interval of integration. Ypu'll have no problem if you integrate from, say, $6$ to $12$ – lulu Mar 31 at 12:30

When opening $$\sqrt{(x-4)^2}$$ yields $$|x-4|$$ so intergral will split at $$x = 4$$ $$\int_{4}^{2} \frac{(2x-8)}{4 - (x-4)} \,dx \ \ + \int_{5}^{4} \frac{(2x-8)}{4 + (x-4)} \,dx$$ after solving the above intergrals we get ( 0.756259 - 0.2148 = 0.5415)