I'm presuming the first is ?

This is done by "completing the square." Note that:

We have: , so by comparing the two we see that , so , so .

But remember we can't simply add a 1, we need to add and subtract 1 so that we don't change the equation:

The other problem is done exactly the same way.

-Dan