14 In-Class Assignment: Fundamental Spaces¶
Image from: https://kevinbinz.com/2017/02/20/linear-algebra/
2. Four Fundamental Subspaces¶
The four fundamental subspaces¶
Columnspace, \(\mathcal{C}(A)\)
Nullspace, \(\mathcal{N}(A)\)
Rowspaces, \(R(A)\)
All linear combinations of rows
All the linear combinations of the colums of \(A^\top\), \(\mathcal{C}(A^\top)\)
Nullspace of \(A^\top\), \(\mathcal{N}(A^\top)\) (the left nullspace of \(A\))
Where are these spaces for a \(m\times n\) matrix \(A\)?¶
\(\mathcal{R}(A)\) is in \(R^n\)
\(\mathcal{N}(A)\) is in \(R^n\)
\(\mathcal{C}(A)\) is in \(R^m\)
\(\mathcal{N}(A^\top)\) is in \(R^m\)
Calculating basis and dimension¶
For \(\mathcal{R}(A)\)¶
If \(A\) undergoes row reduction to row echelon form \(B\), then \(\mathcal{C}(B)\neq \mathcal{C}(A)\), but \(\mathcal{R}(B) = \mathcal{R}(A)\) (or \(\mathcal{C}(B^\top) = \mathcal{C}(A^\top))\)
A basis for the rowspace of \(A\) (or \(B\)) is the first \(r\) rows of \(B\)
So we row reduce \(A\) and take the pivot rows and transpose them
The dimension is also equal to the rank \(r\)
For \(\mathcal{N}(A)\)¶
The bases are the special solutions (one for every free variable, \(n-r\))
The dimension is \(n- r\)
For \(\mathcal{C}(A) = \mathcal{R}(A^\top)\)¶
Apply the row reduction on the transpose \(A^\top\).
The dimension is the rank \(r\)
For \(\mathcal{N}(A^\top)\)¶
It is also called the left nullspace, because it ends up on the left (as seen below)
Here we have \(A^\top y = 0\)
\(y^\top(A^\top)^\top = 0^\top\)
\(y^\top A = 0^\top\)
This is (again) the special solutions for \(A^\top\) (after row reduction)
The dimension is \(m - r\)
3. Practice Example:¶
Consider the linear transformation defined by the following matrix \(A\).
%matplotlib inline
import matplotlib.pylab as plt
import numpy as np
import sympy as sym
sym.init_printing()
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-1-97c04e533e83> 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'
✅ Question: What is the reduced row echelon form of \(A\)? You can use sympy.
#Put your answer to the above question here.
✅ Question: Now let’s calculate the row space of \(A\). Note that the row space is defined by a linear combination of the non-zero row vectors in the reduced row echelon matrix:
Put your answer to the above question here
✅ Question: What is the rank of matrix \(A\)? You should know the rank by inspecting the reduced row echelon form. Find a numpy
or sympy
function that you can use to verify your answer?
## Put code here to verify your answer.
✅ Question: Using the reduced row echelon form define the leading variables in terms of the free variables for the homogeneous equation.
Put your answer to the above question here
✅ Question: The solution to the above question defines the nullspace of \(A\) (aka the Kernel). Use the sympy.nullspace function to verify your answer.
# Put your code here
✅ Question: Now let’s calculate the range of \(A\) (column space of \(A\)). Note that the range is spanned by the column vectors of \(A\). Transpose \(A\) and calculate the reduced row echelon form of the transposed matrix like we did above.
## Put your code here
✅ Question: The nonzero row vectors of the above solution will give a basis for the range (or \(\mathcal{C}(A)\)). Write the range of \(A\) as a linear combination of these nonzero vectors:
Put your answer to the above question here.
✅ Question: Finally, using the reduced row echelon form for \(A^\top\) define the leading variables in terms of the free variables and define the null space of \(A^\top\).
Put your answer to the above question here.
Written by Dr. Dirk Colbry, Michigan State University
This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.