Well, the -axis is, by definition, the set

.

If you want to prove that is an ideal using the statement you have written, we need a ring and a ring homomorphism such that .

How about taking , and defining

(projection onto the first coordinate)? It should be fairly simple to prove that is indeed a ring homomorphism, and that the kernel of is exactly the set of points located on the -axis.

You can do a completely analogous thing to show that the axis is also an ideal.