the first issue is probably because you didn't define the variable y, this can be done typing y = var('y'). The fact that this is not necessary for the x variable is because it is predefined at the startup of Sage. If you find yourself using very often the variable y (or other variables or functions), then it's possible to load them at startup by using the init.sage file, as explained in sage startup scripts.