[SOLVED] Completing the Square

Hi all, this is my first post here.

Ok, I'm using a math program in college (I forgot everything I learned in highschool math and am retaking courses to get up tp speed) for some algebra level math. I'm currently working on a section called "completing the square". Everything was going fine until this problem:

http://img294.imageshack.us/img294/2425/whatm.png

I wasn't sure how to go about doing the problem, and this is how the program responded. Normally I will pick up on how to do something after it shows me, but I'm not sure how it went about doing this one. First off, the problem started as:

X^2+(x+2)^2=10^2. Where did the 4X come from? The other part I'm a bit confused about is, a few lines down, the program goes from:

x^2+2x+2=50

to:

X^2+2x+?=48+?

It then changes it to a 1. What's up with that? I don't recall ever doing that in highschool. The program isn't explaining how it did any of this either, other than what you see here. Can someone enlighten me?