# equality and containment

Equality and containment between two ideals in a polynomial ring (or quotient of a polynomial ring) is checked by comparing their respective Groebner bases.

## equal and not equal

Use Ideal == Ideal to test if two ideals in the same ring are equal.
 i1 : R = QQ[a..d]; i2 : I = ideal (a^2*b-c^2, a*b^2-d^3, c^5-d); o2 : Ideal of R i3 : J = ideal (a^2,b^2,c^2,d^2); o3 : Ideal of R i4 : I == J o4 = false i5 : I != J o5 = true

## normal form with respect to a Groebner basis and membership

The function RingElement % Ideal reduces an element with respect to a Groebner basis of the ideal.
 i6 : (1+a+a^3+a^4) % J o6 = a + 1 o6 : R
We can then test membership in the ideal by comparing the answer to 0 using ==.
 i7 : (1+a+a^3+a^4) % J == 0 o7 = false i8 : a^4 % J == 0 o8 = true

## containment for two ideals

Containment for two ideals is tested using isSubset.
 i9 : isSubset(I,J) o9 = false i10 : isSubset(I,I+J) o10 = true i11 : isSubset(I+J,I) o11 = false

## ideal equal to 1 or 0

Use the expression I == 1 to see if the ideal is equal to the ring. Use I == 0 to see if the ideal is identically zero in the given ring.
 i12 : I = ideal (a^2-1,a^3+3); o12 : Ideal of R i13 : I == 1 o13 = true i14 : S = R/I o14 = S o14 : QuotientRing i15 : S == 0 o15 = true