Skip to main content

Exercises 20.8 Sage Exercises


Given two subspaces \(U\) and \(W\) of a vector space \(V\text{,}\) their sum \(U+W\) can be defined as the set \(U+W=\{u+w\mid u\in U,\ w\in W\}\text{,}\) in other words, the set of all possible sums of an element from \(U\) and an element from \(W\text{.}\)

Notice this is not the direct sum of your text, nor the direct_sum() method in Sage. However, you can build this subspace in Sage as follows. Grab the bases of \(U\) and \(W\) individually, as lists of vectors. Join the two lists together by just using a plus sign between them. Now build the sum subspace by creating a subspace of \(V\) spanned by this set, by using the .subspace() method.

In the vector space (QQ^10) construct two subspaces that you expect to (a) have dimension \(5\) or \(6\) or so, and (b) have an intersection that is a vector space of dimension \(2\) or so. Compare their individual dimensions with the dimensions of the intersection of \(U\) and \(W\) (\(U\cap W\text{,}\) .intersection() in Sage) and the sum \(U+W\text{.}\)

Repeat the experiment with the two original vector spaces having dimension \(8\) or so, and with the intersection as small as possible. Form a general conjecture relating these four dimensions based on the results of your two (or more)experiments.


We can construct a field in Sage that extends the rationals by adding in a fourth root of two, \({\mathbb Q}[\sqrt[4]{2}]\text{,}\) with the command F.<c> = QQ[2^(1/4)]. This is a vector space of dimension \(4\) over the rationals, with a basis that is the first four powers of \(c = \sqrt[4]{2}\) (starting with the zero power).

The command F.vector_space() will return three items in a triple (so be careful how you handle this output to extract what you need). The first part of the output is a vector space over the rationals that is isomorphic to F. The next is a vector space isomorphism (invertible linear transformation) from the provided vector space to the field, while the third is an isomorphism in the opposite direction. These two isomorphisms can then be used like functions. Notice that this is different behavior than for .vector_space() applied to finite fields. Create non-trivial examples that show that these vector space isomorphisms behave as an isomorphism should. (You will have at least four such examples in a complete solution.)


Build a finite field \(F\) of order \(p^n\) in the usual way. Then construct the (multiplicative) group of all invertible (nonsingular) \(m\times m\) matrices over this field with the command G = GL(m, F) (“the general linear group”). What is the order of this group? In other words, find a general expression for the order of this group.

Your answer should be a function of \(m\text{,}\) \(p\) and \(n\text{.}\) Provide a complete explanation of the logic behind your solution (i.e. something resembling a proof). Also provide tests in Sage that your answer is correct.

Hints: G.order() will help you test and verify your hypotheses. Small examples in Sage (listing all the elements of the group) might aid your intuition—which is why this is a Sage exercise. Small means \(2\times 2\) and \(3\times 3\) matrices and finite fields with \(2,3,4,5\) elements, at most. Results do not really depend on each of \(p\) and \(n\text{,}\) but rather just on \(p^n\text{.}\)

Realize this group is interesting because it contains representations of all the invertible (i.e. 1-1 and onto) linear transformations from the (finite) vector space \(F^m\) to itself.


What happens if we try to do linear algebra over a ring that is not also a field? The object that resembles a vector space, but with this one distinction, is known as a module. You can build one easily with a construction like ZZ^3. Evaluate the following to create a module and a submodule.

Examine the bases and dimensions (aka “rank”) of the module and submodule, and check the equality of the module and submodule. How is this different than the situation for vector spaces? Can you create a third module, P, that is a proper subset of M and properly contains N?


A finite field, \(F\text{,}\) of order \(5^3\) is a vector space of dimension 3 over \({\mathbb Z}_5\text{.}\) Suppose \(a\) is a generator of \(F\text{.}\) Let \(M\) be any \(3\times 3\) matrix with entries from \({\mathbb Z}_5\) (carefule here, the elements are from th field of scalars, not from the vector space). If we convert an element \(x\in F\) to a vector (relative to the basis \(\{1,a,a^2\}\)), then we can multiply it by \(M\) (with \(M\) on the left) to create another vector, which we can translate to a linear combination of the basis elements, and hence another element of \(F\text{.}\) This function is a vector space homomorphism, better known as a linear transformation (implemented with a matrix representation relative to the basis \(\{1,a,a^2\}\text{.}\) Notice that each part below becomes less general and more specific.

  1. Create a non-invertible matrix \(R\) and give examples to show that the mapping described by \(R\) is a vector space homomorphism of \(F\) into \(F\text{.}\)

  2. Create an invertible matrix \(M\text{.}\) The mapping will now be an invertible homomorphism. Determine the inverse function and give examples to verify its properties.

  3. Since \(a\) is a generator of the field, the mapping \(a\mapsto a^5\) can be extended to a vector space homomorphism (i.e. a linear transformation). Find a matrix \(M\) which effects this linear transformation, and from this, determine that the homomorphism is invertible.

  4. None of the previous three parts applies to properties of multiplication in the field. However, the mapping from the third part also preserves multiplication in the field, though a proof of this may not be obvious right now. So we are saying this mapping is a field automorphism, preserving both addition and multiplication. Give a nontrivial example of the multiplication-preserving properties of this mapping. (This is the Frobenius map which will be discussed further in Chapter 21.)