Skip to main content
\(\newcommand{\identity}{\mathrm{id}} \newcommand{\notdivide}{{\not{\mid}}} \newcommand{\notsubset}{\not\subset} \newcommand{\lcm}{\operatorname{lcm}} \newcommand{\gf}{\operatorname{GF}} \newcommand{\inn}{\operatorname{Inn}} \newcommand{\aut}{\operatorname{Aut}} \newcommand{\Hom}{\operatorname{Hom}} \newcommand{\cis}{\operatorname{cis}} \newcommand{\chr}{\operatorname{char}} \newcommand{\Null}{\operatorname{Null}} \newcommand{\lt}{ < } \newcommand{\gt}{ > } \newcommand{\amp}{ & } \)

Section16.10Sage Exercises


Define the two rings \({\mathbb Z}_{11}\) and \({\mathbb Z}_{12}\) with the commands R = Integers(11) and S = Integers(12). For each ring, use the relevant command to determine: if the ring is finite, if it is commutative, if it is an integral domain and if it is a field. Then use single Sage commands to find the order of the ring, list the elements, and output the multiplicative identity (i.e. \(1\), if it exists).


Define R to be the ring of integers, \({\mathbb Z}\), by executing R = ZZ or R = Integers(). A command like R.ideal(4) will create the principal ideal \(\langle 4\rangle\). The same command can accept more than one generator, so for example, R.ideal(3, 5) will create the ideal \(\{a\cdot 3+ b\cdot 5\mid a,b\in{\mathbb Z}\}\). Create several ideals of \({\mathbb Z}\) with two generators and ask Sage to print each as you create it. Explain what you observe and then create code that will test your observation for thousands of different examples.


Create a finite field \(F\) of order 81 with F.<t>=FiniteField(3^4).

  1. List the elements of \(F\).

  2. Obtain the generators of \(F\) with F.gens().

  3. Obtain the first generator of \(F\) and save it as u with u = F.0 (alternatively, u = F.gen(0)).

  4. Compute the first 80 powers of u and comment.

  5. The generator you have worked with above is a root of a polynomial over \({\mathbb Z}_3\). Obtain this polynomial with F.modulus() and use this observation to explain the entry in your list of powers that is the fourth power of the generator.


Build and analyze a quotient ring as follows:

  1. Use P.<z>=Integers(7)[] to construct a ring \(P\) of polynomials in \(z\) with coefficients from \({\mathbb Z}_7\).

  2. Use K = P.ideal(z^2+z+3) to build a principal ideal \(K\) generated by the polynomial \(z^2+z+3\).

  3. Use H = P.quotient(K) to build \(H\), the quotient ring of \(P\) by \(K\).

  4. Use Sage to verify that \(H\) is a field.

  5. As in the previous exercise, obtain a generator and examine the proper collection of powers of that generator.