Below is the answer to a problem. I cannot figure out how they did it I tried to start with the math but hit a dead end.

Any help would be great:

I am unable to figure out how they did the following problem, I see where they substitute in for ay, and I am fine there.

I dont understand the steps they took to get the answer below:

I tried the following:

After this point I kept running into some walls I tried factoring out a negative, and I tried a few other things but I am not doing something right as its not coming up like it should so I must be missing a rule or not using it correctly.

thanks,

Brian