Exercise 22.4.15 suggests that every element of a finite field may be written (expressed) as a sum of squares. This exercise suggests computational experiments which might help you formulate a proof for the exercise.
(a) Construct two small, but not too small, finite fields, one with p=2 and the other with an odd prime. Repeat the following for each field, F.
(b) Choose a ``random'' element of the field, say a∈F. Construct the sets
{x2∣x∈F}{a−x2∣x∈F}
using Sage sets with the Set() constructor. (Be careful: set() is a Python command which behaves differently in fundamental ways.)
(c) Examine the size of the two sets and the size of their intersection (.intersection()). Try different elements for a, perhaps writing a loop to try all possible values. Note that p=2 will behave quite differently.
(d) Suppose you have an element of the intersection. (You can get one with .an\_element().) How does this lead to the sum of squares proposed in the exercise?
(e) Can you write a Python function that accepts a finite field whose order is a power of an odd prime and then lists each element as a sum of squares?