Setting up the integral gives us -

I thought I could easily solve the integral but I was wrong. You see, all the variables in the integral must be the same type. So either it's in terms of Y and dy or X and dx. I tried doing it in terms of Y and dy but it was just impractical (I had to find the integral of several "arctan y" squared, pfft). I was shocked, I knew no way of solving the integral. So I thought I'd just change the integral to the variable of dx even though I knew it to be wrong. All I did was exchanging dy with dx and changing from (0,1) to (0, pi/2). But it didn't work since the book gave me different answer. My book reformed the integral as the following -

I know the derivative of sin X is cos X but this didn't make sense to me because I've never seen it done before. If the above integral is correct, then why, when I tried to solve other integrals by changing the variable from dx to dy or from dy to dx using the above method, I always got the wrong answer?