(* Sheet 2, Problem 4 *)

f = x^3 y^3 + 1;
p = 1 + 3 x + 2 x^2 + x^2 y + x^3 y;
q = x y^2 + x^2 y^2;

ShowP [f_] := MonomialList [f, {x,y}, IdentityMatrix [2]]

ShowP [f]

ShowP [p]

ShowP [q]

PolynomialReduce [f, {p,q}, {x,y}, MonomialOrder -> IdentityMatrix [2]]

(* Sheet 2, Problem 5 *)

f = x^3 y^2;
p = 1 + x^3 y + 3 x^2 y^5;
q = 2 x^2 y + x^2 y^2;

ShowP [f_] := MonomialList [f, {x,y}, IdentityMatrix [2]]

ShowP [f]

ShowP [p]

ShowP [q]

PolynomialReduce [f, {p,q}, {x,y}, MonomialOrder -> IdentityMatrix [2]]

(* Sheet 2, Problem 6 *)

f = x^2 y + x y^2 + y^2;
p =x y - 1;
q = y^2 -  1;

ShowP [f_] := MonomialList [f, {x,y}, IdentityMatrix [2]]

ShowP [f]

ShowP [p]

ShowP [q]

PolynomialReduce [f, {p,q}, {x,y}, MonomialOrder -> IdentityMatrix [2]]

Expand [f- x q -  q - x p]

Expand [(x+1) q + x p + 1 + 2 x]

GroebnerBasis [{p,q},{x,y}, MonomialOrder -> IdentityMatrix [2]]

(* Example for Lecture on Oct 28, 2020 *)

f

ShowP [f]

ShowP [p]

ShowP [q]

ShowP [f - x p]

ShowP [f- x p - y p -1 q]