1 | initial version |

I suppose that the question wants to build the corresponding matrix in the peculiar order of all monomials of degree $\le 2$ given above, that works for all (not so many) possible polynomials of degree $\le 2$ in the given ring. The hint MacCaulay was actively ignored in my following answer / sample code, since i considered the task as a task of identifying coefficients of polynomials.

```
F = GF(2)
R.<x1,x2,x3> = PolynomialRing( F )
p, q = x1*x2 + x1*x3 + x1, x1 + x2 + 1
degrees = ( (2,0,0),
(1,1,0),
(0,2,0),
(1,0,1),
(0,1,1),
(0,0,2),
(1,0,0),
(0,1,0),
(0,0,1),
(0,0,0), )
d = len(degrees)
print matrix( F, 2, d, [ [ pol.coefficient( dict( zip( (x1,x2,x3) , degtuple ) ) )
for degtuple in degrees ]
for pol in ( p, q ) ] )
```

This gives:

```
[0 1 0 1 0 0 1 0 0 0]
[0 0 0 0 0 0 1 1 0 1]
```

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.