How to write polynomial rings. I am recently struggling with a question presented to me by a friend:

I need to write: $2 + xy − x^2y + 3x^2y^2 + 8x^2y^4 − x^3y ∈ Z[x, y]$
  as an element in $Z[x][y]$ and as an element in $Z[y][x]$ where they are polynomial rings.

However, I unsure of how to proceed, any help? I was thinking that $Z[x][y] = Z[y][x]$ but I am not certain. Any help would be appreciated. 
 A: $2+(x-x^2-x^3)y+(3x^2)y^2+(8x^2)y^4 \in \mathbb{Z}[x][y]$ and $2+(y)x+(-y+3y^2+8y^4)x^2+(-y)x^3 \in \mathbb{Z}[y][x]$.
A: This question is related to the problem of ordering polynomials in several indeterminates.
While polynomials with a single indeterminate can be ordered (with an order compatible with multiplication, called a monomial order) only in two ways: by increasing or by decreasing order , polynomial rings in several indeterminates can have many monomial orders.
First one has to choose an ordering on the indeterminates. For the case of two indeterminates, say we choose $x\succ y\succ 1$.
I'll explain with some examples. Among these orders, the most common are:


*

*the lexicographical order (‘lex’): for instance
$$1\prec x\prec xy\prec xy^2\prec\dots\prec x^2\prec x^2y\prec x^2y^2\prec\dots$$

*the graded lexicographical order (‘grlex’): monomials are ordered first by the total degree, and, for monomials with the same total degree, by the degree in $x$. Examples:
$$1\prec y\prec x\prec y^2\prec xy\prec x^2\prec\dots$$

*the reverse lexicographical degree (‘grevlex’): as above, monomials ore ordered first by their total degree. Then, for monomials with the same total degree, the monomial with the smallest exponent in the last variable is greatest. In case the monomials have the same degree in the last indeterminate, one looks at the degree in the last but one indeterminate, and so on. There's a difference with grlex only for polynomials with more than 3 indeterminates.

