# 11 Pre-Class Assignment: Vector Spaces¶

## 1. Basis Vectors¶

Below is a really good review of concepts such as: Linear combinatins, span, and basis vectors.

from IPython.display import YouTubeVideo


QUESTION: What is the technical definition of a basis?

QUESTION: Write three basis vectors that span $$R^3$$.

From the above video two terms we want you to really understand Span and Linear Independent. Understanding these two will be really important when you think about basis. Make sure you watch the video and try to answer the following questions as best you can using your own words.

QUESTION: Describe what it means for vectors to Span a space?

QUESTION: What is the span of two vectors that point in the same direction?

QUESTION: Can the following vectors span $$R^3$$? Why?

$$(1,-2,3),\quad (-2,4,-6),\quad (0,6,4)$$

QUESTION: Describe what it means for vectors to be Linearly Independent?

If you have vectors that span a space AND are Linearly Independent then these vectors form a Basis for that space.

Turns out you can create a matrix by using basis vectors as columns. This matrix can be used to change points from one basis representation to another.

## 2. Vector Spaces¶

Vector spaces are an abstract concept used in math. So far we have talked about vectors of real numbers ($$R^n$$). However, there are other types of vectors as well. A vector space is a formal definition. If you can define a concept as a vector space then you can use the tools of linear algebra to work with those concepts.

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¶

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

2. $$cu$$ is an element of $$V$$. ($$V$$ is closed under multiplication.)

1. $$u + v = v + u$$ (commutative property)

2. $$u + (v + w) = (u + v) + w$$ (associative property)

3. There exists an element of $$V$$, called a zero vector, denoted $$0$$, such that $$u+0 = u$$

4. 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¶

1. $$c(u+v) = cu + cv$$

2. $$(c + d)u = cu + du$$

3. $$c(du) = (cd)u$$

4. $$1u = u$$

## 3. Lots of Things Can Be Vector Spaces¶

from IPython.display import YouTubeVideo


Consider the following two matrices $$A\in R^{3x3}$$ and $$B\in R^{3x3}$$, which consist of real numbers:

%matplotlib inline
import matplotlib.pylab as plt
import numpy as np
import sympy as sym
sym.init_printing()

a11,a12,a13,a21,a22,a23,a31,a32,a33 = sym.symbols('a_{11},a_{12}, a_{13},a_{21},a_{22},a_{23},a_{31},a_{32},a_{33}', negative=False)
A = sym.Matrix([[a11,a12,a13],[a21,a22,a23],[a31,a32,a33]])
A

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-3-268c7924edf1> 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()

~/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'

b11,b12,b13,b21,b22,b23,b31,b32,b33 = sym.symbols('b_{11},b_{12}, b_{13},b_{21},b_{22},b_{23},b_{31},b_{32},b_{33}', negative=False)
B = sym.Matrix([[b11,b12,b13],[b21,b22,b23],[b31,b32,b33]])
B


QUESTION: What properties do we need to show all $$3\times 3$$ matrices of real numbers form a vector space.

DO THIS: Demonstrate these properties using sympy as was done in the video.

#Put your answer here.


QUESTION (assignment specific): Determine whether $$A$$ is a linear combination of $$B$$, $$C$$, and $$D$$?

$\begin{split} A= \left[ \begin{matrix} 7 & 6 \\ -5 & -3 \end{matrix} \right], B= \left[ \begin{matrix} 3 & 0 \\ 1 & 1 \end{matrix} \right], C= \left[ \begin{matrix} 0 & 1 \\ 3 & 4 \end{matrix} \right], D= \left[ \begin{matrix} 1 & 2 \\ 0 & 1 \end{matrix} \right] \end{split}$
#Put your answer to the above question here


QUESTION: Write a basis for all $$2\times 3$$ matrices and give the dimension of the space.

## 5. Assignment wrap-up¶

Assignment-Specific QUESTION: Is matrix $$A$$ is a linear combination of $$B$$, $$C$$, and $$D$$ from above?

QUESTION: Summarize what you did in this assignment.

QUESTION: What questions do you have, if any, about any of the topics discussed in this assignment after working through the jupyter notebook?

QUESTION: How well do you feel this assignment helped you to achieve a better understanding of the above mentioned topic(s)?

QUESTION: What was the most challenging part of this assignment for you?

QUESTION: What was the least challenging part of this assignment for you?

QUESTION: What kind of additional questions or support, if any, do you feel you need to have a better understanding of the content in this assignment?