That's how the problem was presented. Also, y is a function of x, not a constant. As such, it cannot be removed from the integral.
I have implicitly plotted x^a-x^b=y^a-y^b for various values of a and b and I can see the two solutions for y. One is x, and the other fits the definition of...