Key idea: For a linear expression over the square root of a quadratic, write the numerator as (a multiple of the derivative of the quadratic) + (a constant). The first part integrates to a square root, and the second part is the special form ∫X2−a2dx=logX+X2−a2.
Step 1 — Split the numerator.
The derivative of x2−x is 2x−1. We write x−1 as 21(2x−1)−21.
I=21∫x2−x2x−1dx−21∫x2−xdx
Step 2 — Integrate the first part.
Put u=x2−x, so du=(2x−1)dx.
21∫udu=21⋅2u
21∫udu=x2−x
Step 3 — Complete the square in the second part.
We complete the square in x2−x.
x2−x=(x−21)2−41
x2−x=(x−21)2−(21)2
The integrand is defined only where x2−x>0, that is, for x<0 or x>1. The modulus in the logarithm below is needed, because x−21+x2−x is negative when x<0.
Step 4 — Integrate the second part.
Using the special form with X=x−21 and a=21, the square root X2−a2 is again x2−x.
∫x2−xdx=logx−21+x2−x
Step 5 — Combine the parts.
We subtract half of this from the result of Step 2 and add the constant of integration.