# 11 In-Class Assignment: Vector Spaces¶

Image from: https://en.wikipedia.org/wiki/Change_of_basis

## Agenda for today’s class (80 minutes)¶

(20 minutes) Review Pre-Class Assignment

(20 minutes) Introduction to subspaces

(20 minutes) Basis Vectors

(20 minutes) Vector Spaces

## 1. Review Pre-class Assignment¶

Like most days, your instructor will review and answer questions from your pre-class assignment. This is your opportunity to ask any lingering questions before the quiz.

## 3. Basis Vectors¶

Consider the following example. We claim that the following set of vectors form a baiss for \(R^3\):

If these vectors form a basis they must be * linearly independent* and

*the entire space of \(R^3\)*

**Span**```
%matplotlib inline
import matplotlib.pylab as plt
import numpy as np
import sympy as sym
sym.init_printing(use_unicode=True)
```

```
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-1-e3122a161773> in <module>
----> 1 get_ipython().run_line_magic('matplotlib', 'inline')
2 import matplotlib.pylab as plt
3 import numpy as np
4 import sympy as sym
5 sym.init_printing(use_unicode=True)
~/REPOS/MTH314_Textbook/MakeTextbook/envs/lib/python3.9/site-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth)
2342 kwargs['local_ns'] = self.get_local_scope(stack_depth)
2343 with self.builtin_trap:
-> 2344 result = fn(*args, **kwargs)
2345 return result
2346
~/REPOS/MTH314_Textbook/MakeTextbook/envs/lib/python3.9/site-packages/decorator.py in fun(*args, **kw)
230 if not kwsyntax:
231 args, kw = fix(args, kw, sig)
--> 232 return caller(func, *(extras + args), **kw)
233 fun.__name__ = func.__name__
234 fun.__doc__ = func.__doc__
~/REPOS/MTH314_Textbook/MakeTextbook/envs/lib/python3.9/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
185 # but it's overkill for just that one bit of state.
186 def magic_deco(arg):
--> 187 call = lambda f, *a, **k: f(*a, **k)
188
189 if callable(arg):
~/REPOS/MTH314_Textbook/MakeTextbook/envs/lib/python3.9/site-packages/IPython/core/magics/pylab.py in matplotlib(self, line)
97 print("Available matplotlib backends: %s" % backends_list)
98 else:
---> 99 gui, backend = self.shell.enable_matplotlib(args.gui.lower() if isinstance(args.gui, str) else args.gui)
100 self._show_matplotlib_backend(args.gui, backend)
101
~/REPOS/MTH314_Textbook/MakeTextbook/envs/lib/python3.9/site-packages/IPython/core/interactiveshell.py in enable_matplotlib(self, gui)
3511 """
3512 from IPython.core import pylabtools as pt
-> 3513 gui, backend = pt.find_gui_and_backend(gui, self.pylab_gui_select)
3514
3515 if gui != 'inline':
~/REPOS/MTH314_Textbook/MakeTextbook/envs/lib/python3.9/site-packages/IPython/core/pylabtools.py in find_gui_and_backend(gui, gui_select)
278 """
279
--> 280 import matplotlib
281
282 if gui and gui != 'auto':
ModuleNotFoundError: No module named 'matplotlib'
```

✅ **DO THIS:** Create a \(3 \times 3\) numpy matrix \(A\) where the columns of \(A\) form are the basis vectors.

```
#Put your answer to the above question here
```

```
from answercheck import checkanswer
checkanswer.matrix(A,'68b81f1c1041158b519936cb1a2e4d6b');
```

✅ **DO THIS:** Using python, calculate the determinant of matrix \(A\).

```
# Put your answer to the above question here.
```

✅ **DO THIS:** Using python, calculate the inverse of \(A\).

```
# Put your answer to the above question here.
```

✅ **DO THIS:** Using python, calculate the rank of \(A\).

```
# Put your answer to the above question here.
```

✅ **DO THIS:** Using python, calculate the reduced row echelon form of \(A\).

```
# Put your answer to the above question here.
```

✅ **DO THIS:** Using the above \(A\) and the vector \(b=(1,3,2)\). What is the solution to \(Ax=b\)?

```
#Put your answer to the above question here.
```

```
from answercheck import checkanswer
checkanswer.matrix(x,'8b0938260dfeaafc9f8e9fec0bc72f17');
```

Turns out a matrix where column vectors are formed from basis vectors a lot of interesting properties and the following statements are equivalent.

The column vectors of \(A\) form a basis for \(R^n\)

\(|A| \ne 0\)

\(A\) is invertible.

\(A\) is row equivalent to \(I_n\) (i.e. it’s reduced row echelon form is \(I_n\))

The system of equations \(Ax = b\) has a unique solution.

\(rank(A) = n\)

Not all matrices follow the above statements but the ones that do are used throughout linear algebra so it is important that we know these properties.

## 4. Vector Spaces¶

A **Vector Space** is a set \(V\) of elements called **vectors**, having operations of addition and scalar multiplication defined on it that satisfy the following conditions (\(u\), \(v\), and \(w\) are arbitrary elements of \(V\), and c and d are scalars.)

### Closure Axioms¶

The sum \(u + v\) exists and is an element of \(V\). (\(V\) is closed under addition.)

\(cu\) is an element of \(V\). (\(V\) is closed under scalar multiplication.)

### Addition Axioms¶

\(u + v = v + u\) (commutative property)

\(u + (v + w) = (u + v) + w\) (associative property)

There exists an element of \(V\), called a

**zero vector**, denoted \(0\), such that \(u+0 = u\)For every element \(u\) of \(V\), there exists an element called a

**negative**of \(u\), denoted \(-u\), such that \(u + (-u) = 0\).

### Scalar Multiplication Axioms¶

\(c(u+v) = cu + cv\)

\((c + d)u = cu + du\)

\(c(du) = (cd)u\)

\(1u = u\)

### Definition of a basis of a vector space¶

A finite set of vectors \({v_1,\dots, v_n}\) is called a

basisof avector space\(V\) if the setspans\(V\) and islinearly independent. i.e. each vector in \(V\) can be expressed uniquely as alinear combinationof the vectors in a basis.

## Vector spaces¶

✅ **DO THIS:** Let \(U\) be the set of all circles in \(R^2\) having center at the origin.
Interpret the origin as being in this set, i.e., it is a circle center at the origin with radius zero.
Assume \(C_1\) and \(C_2\) are elements of \(U\).
Let \(C_1 + C_2\) be the circle centered at the origin, whose radius is the sum of the radii of \(C_1\) and \(C_2\).
Let \(kC_1\) be the circle center at the origin, whose radius is \(|k|\) times that of \(C_1\).
Determine which vector space axioms hold and which do not.

Put your answer here

### Spans:¶

✅ **DO THIS:** Let \(v\), \(v_1\), and \(v_2\) be vectors in a vector space \(V\).
Let \(v\) be a linear combination of \(v_1\) and \(v_2\).
If \(c_1\) and \(c_2\) are nonzero real numbers, show that \(v\) is also a linear combination of \(c_1v_1\) and \(c_2v_2\).

Put your answer here

✅ **DO THIS:** Let \(v_1\) and \(v_2\) span a vector space \(V\).
Let \(v_3\) be any other vector in \(V\).
Show that \(v_1\), \(v_2\), and \(v_3\) also span \(V\).

Put your answer here

### Linear Independent:¶

Consider the following matrix, which is in the reduced row echelon form.

✅ **DO THIS:** Show that the row vectors form a linearly independent set:

Put your answer here

✅ **DO THIS:** Is the set of nonzero row vectors of any matrix in reduced row echelon form linearly independent? Discuss in your groups and include your thoughts below.

Put your answer here

✅ **DO THIS:** A computer program accepts a number of vectors in \(R^3\) as input and checks to see if the vectors are linearly independent and outputs a True/False statment.
Discuss in your groups, which is more likely to happen due to round-off error–that the computer states that a given set of linearly independent vectors is linearly dependent, or vice versa?
Put your groups thoughts below.

Put your answer here

Written by Dr. Dirk Colbry, Michigan State University

This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.