Hey, think anyone could kind of help me understand a^2 + 2ab + b^2 better?

I simply just can not figure out alot of the larger problems such as:

I know the answer is but dont understand how to get that using the formula above. Well except its - instead of the + from above. If anyone could possibly work a few random examples or even the one above it might help me understand the concept of the a^2 + 2ab + b^2 which I cant seem to figure out at all. ^_^

Thanks