In the following expression

I do not understand how to decide which number ends up under the radical sign.

For instance in the first term why does the y get distributed under the radical?

Where as in the second term the x goes outside the radical instead of under like the above part of the expression. The author does not explain this process and its leaving me very confused.