Trigonometric and Hyperbolic substitutions

So confused at this. I was sick when the class went through it and now I'm just looking at the questions with a blank face. :(

Right, so here's what they give us:

If for some constant a the integrand contains:

, let with

, let with

, let with

, let with

, let with

They have a sample solution that I can't even follow. :(

I get that 4 is 2^2, so 2 is a.

=

Starting to lose track here. AFAIK, x should be 2 sin theta, though that doesn't explain why the 4 has been taken out.

=

Confused by this stage. =|

=

Confused.

=

I'm pretty sure that's 2 times 2cos^2(theta), so I 'kinda' get this step. Still not sure how it got to this stage.

=

Because ,

=

=

Therefore

So yes, I essentially have no clue about how they got there. :( Anybody feel up to trying to explain this to me?