The solution is based on this fact:

Using an algebraic trick we prepare the integral for a substitution:

This result agrees with the other calculation, because