# Testing if a polynomial or list of polynomials belongs to an ideal given by a Gröbner basis: in_ideal

### 5.31.3 Testing if a polynomial or list of polynomials belongs to an ideal given by a Gröbner basis: in_ideal

The in_ideal command determines whether or not a polynomial is in an ideal.

- in_ideal takes three mandatory arguments and one optional argument:
  - P, a polynomial or a list of polynomials.
  - gbasis, a list giving a Gröbner basis.
  - vars, the list of polynomial variables.
    If gbasis is computed with a different order from the default, then vars must use the same order.
  - Optionally, an optional argument from gbasic (see Section 5.31.1), such as plex or tdeg. By default it will be plex.
- in_ideal(P,gbasis,vars ⟨, option ⟩) returns the value true (1) or false (0), or a list of trues and falses, indicating whether or not the polynomial(s) in P are in the ideal generated by gbasis using the variables in vars.

#### Examples.

- Input:
  in_ideal((x+y)^2,[y^2,x^2 + 2*x*y],[x,y])
  Output:

  1

- Input:
  in_ideal([(x+y)^2,x+y],[y^2,x^2+2*x*y],[x,y])
  Output:

  ⎡ ⎣ | 1,0 | ⎤ ⎦

- Input:
  in_ideal(x+y,[y^2,x^2+2*x*y],[x,y])
  Output:

  0