# Rewriting linear combination of Groebner basis in terms of original terms

Let assume I have an ideal given by

```
x,y,z = QQ['x,y,z'].gens()
I = ideal(f1,f2,f3)
B = I.groebner_basis()
```

where f1,f2,f3 are just polynomials in variables x,y,z. Let's say B=(g1,g2).

Let's assume I happen to take a polynomial,h, that is in my ideal I. Then doing polynomial division, I can write

```
h=h1*g1+h2*g2
```

Basically I can write h as a linear combination of the elements in my Groebner basis. Is there a function that converts a linear combination in terms of Groebner to linear combination of terms in my ideal I? i.e.I can write

```
h=q1*f1+q2*f2+q3*f3
```