Is the product of ideals commutative?

For another example, consider the ring $\mathbb{Z}\langle x,y\rangle$ be the ring of polynomials with integer coefficients in two noncommuting variables $x$ and $y$ (this is the same as the integral semigroup ring of the free monoid of rank $2$). It's almost like the usual polynomial ring, except that the monomials are given by words in $x$ and $y$; so that, for example, the weight two monomials are $x^2$, $xy$, $yx$, and $y^2$, all distinct; the weight three monomials are $x^3$, $x^2y$, $xyx$, $yx^2$, $xy^2$, $yxy$, $y^2x$, and $y^3$, all distinct; etc.

Let $I = (x)$, the principal ideal generated by $x$. It consists of all elements of the form $$\sum_{i=1}^n p_i(x,y)xq_i(x,y)$$ with $p_i,q_i\in\mathbb{Z}\langle x,y\rangle$, $n\geq 0$; i.e., all polynomials in which every monomial has an $x$ in it, somewhere. Likewise, $J=(y)$ consists of all polynomials in which every monomial has a $y$ in it somewhere.

Now, clearly, $xy\in IJ$. But it cannot be in $JI$, because every monomial in every nonzero element of $JI$ must have an $x$ that follows its first $y$, which is not the case for $xy$.


It is not true that ideal product is commutative in non-commutative (associative, unital) rings. An easy example is given by triangular rings (see for instance pp 17-22, especially p. 18 of Lam's First Course in Non-commutative Rings).

You can easily construct a finite counterexample with 8 elements: Let a be the ring of upper-triangular matrices; let i be the (two-sided) ideal of a consisting of strictly upper triangular matrices, and let j be the (two-sided) ideal consisting of matrices whose second row is zero. Then ij = 0, but ji = i. This works over any field, in particular the field with 2 elements.

You can verify this in GAP:

gap> a:=AlgebraWithOne(GF(2),[[[0,1],[0,0]],[[1,0],[0,0]]]*One(GF(2)));
<algebra-with-one over GF(2), with 2 generators>
gap> i:=Ideal(a,[[[0,1],[0,0]]]*One(GF(2)));
<two-sided ideal in <algebra-with-one of dimension 3 over GF(2)>, (1 generators)>
gap> j:=Ideal(a,[[[1,0],[0,0]],[[0,1],[0,0]]]*One(GF(2)));;
gap> ij:=Ideal(a,Concatenation(List(i,x ->List(j,y->x*y))));;
gap> ji:=Ideal(a,Concatenation(List(i,x ->List(j,y->y*x))));;
gap> Dimension(ij);Dimension(ji);
0
1
gap> ji = i;
true