Skip to main content

Linear Algebra with SageMath Learn math with open-source software

Section 10.1 Definition of Vector Spaces

A vector space provides an abstract generalization of the vectors in \(\R^n\) defined before. In \(\R^n\text{,}\) vectors can be added and multiplied by real numbers. Abstract vectors will have similar operations, and scalars can be drawn from any field \(\F\text{,}\) not exclusively \(\R\text{.}\)
A vector space over a field of scalars \(\F\) is a nonempty set \(V\) of vectors, together with two operations: vector addition \(+\) and scalar multiplication \(\cdot\text{,}\) such that the following axioms are satisfied:
Closure
\(v + u \in V\) and \(a \cdot v \in V\text{.}\)
Commutativity
\(v + u = u + v\text{.}\)
Associativity
\((v + u) + w = v + (u + w)\) and \((ab) \cdot v = a \cdot (b \cdot v)\text{.}\)
Additive Identity
There is a vector \(\mathbf 0 \in V\) such that \(\mathbf 0 + v = v\text{.}\)
Additive Inverse
There exists a vector, \(-v \in V\) such that \(v + (-v) = \mathbf 0\text{.}\)
Multiplicative Identity
\(1 \cdot v = v\text{.}\)
Distributivity
\(a \cdot (u + v) = a \cdot v + a \cdot u\) and \((a + b) \cdot v = a \cdot v + b \cdot v\text{.}\)
As an example, \(\R^n\) is a vector space over \(\R\) and the set \(\F^n\) of \(n\)-tuples \((a_1, \ldots, a_n)\) where \(a_i \in \F\) forms a vector space over \(\F\text{.}\) We will say that the dimension of these vector spaces is \(n\text{.}\)
Sage allows for us to create a vector space using the VectorSpace command. We need to pass the field as well as the dimension of the space as arguments. For instance, the following method creates the vector space \(\R^3\text{:}\)
Let’s create now the vector space \(\Q^2\) of pairs of rational numbers:
Equivalently, we can define the same vector space as:
We can check if a vector belongs to a vector space.