Homework 4
Table of Contents
The following assignment is due Thursday 10/3 by 11:59 PM. You should submit all your written solutions to Gradescope as a single pdf. Follow the instructions in the programming problem for code solutions.
- Your solutions must be exceptionally neat and the final answer in your solution to each problem must be abundantly clear, e.g., surrounded in a very visible box. The graders have license to dock points for illegible or unclear solutions.
- For the written part, choose the correct pages corresponding to each problem in Gradescope. Note that Gradescope registers your submission as soon as you submit it, so you don't need to rush to choose the pages. You will receive no credit if you do not choose the correct pages, no exceptions.
1. Linear Independence
Consider four vectors \(\mathbf v_1\), \(\mathbf v_2\), \(\mathbf v_3\) and \(\mathbf v_4\) in \(\mathbb R^4\) with the property that
\begin{align*} \begin{bmatrix} \mathbf v_1 & \mathbf v_2 & \mathbf v_3 & \mathbf v_4 \end{bmatrix} \sim \begin{bmatrix} 1 & 1 & 3 & -2 \\ 0 & 4 & -4 & 12 \\ 0 & 0 & 3 & 3 \\ 0 & 0 & 0 & 0 \end{bmatrix} \end{align*}1.1. (5 points)
Is \(\mathbf v_4 \in \mathsf{span}\{\mathbf v_1, \mathbf v_2, \mathbf v_3\}\)? If so, write \(\mathbf v_4\) as a linear combination of the vectors \(\mathbf v_1\), \(\mathbf v_2\) and \(\mathbf v_3\). If not, write not in span. Show your work.
1.2. (5 points)
Are the vectors \(\mathbf v_2\), \(\mathbf v_3\), and \(\mathbf v_4\) linearly independent? If so, justify your answer. If not, write down a dependence relation for these vectors.
2. Solve for \(h\)
For each of the following sets of vectors, determine the values of \(h\), if any, for which the set of vectors is linearly dependent. Show your work.
2.1. (5 points)
2.2. (5 points)
3. Dependence Relations
Consider the following set of vectors
\begin{align*} \mathbf v_1 = \begin{bmatrix} -10 \\ -6 \\ 2 \\ 0 \\ 8 \\ -3 \\ -4 \end{bmatrix} \qquad \mathbf v_2 = \begin{bmatrix} -3 \\ 3 \\ -8 \\ 5 \\ -2 \\ 7 \\ -3 \end{bmatrix} \qquad \mathbf v_3 = \begin{bmatrix} -20 \\ -12 \\ 4 \\ 0 \\ 16 \\ -6 \\ -8 \end{bmatrix} \qquad \mathbf v_4 = \begin{bmatrix} 6 \\ 1 \\ 3 \\ -1 \\ 10 \\ 7 \\ 4 \end{bmatrix} \qquad \mathbf v_5 = \begin{bmatrix} -2 \\ -10 \\ 10 \\ -5 \\ -3 \\ -10 \\ -5 \end{bmatrix} \qquad \mathbf v_6 = \begin{bmatrix} -2 \\ 3 \\ -9 \\ -2 \\ -9 \\ -2 \\ -7 \end{bmatrix} \qquad \mathbf v_7 = \begin{bmatrix} 13 \\ 25 \\ -22 \\ 13 \\ 24 \\ 41 \\ 15 \end{bmatrix} \end{align*}3.1. (5 points)
Determine the first vector which can be written as a linear combination as of the vectors which precede it. Write this vectors as a linear combination of the vectors which precede it.1
3.2. (5 points)
Determine a dependence relation for the entire set of vectors with the following properties.
- The coefficients of the dependence relation are relatively prime integers.
- The number of nonzero coefficients is maximum, i.e., there is no other dependence relation with a greater number of nonzero coefficients.
4. Linear Transformations
(10 points) Let \(T\) be a linear transformation with the following input-output behavior. (Errata: 9/27 12:15PM, There was an error in the given numbers the updated value is in \(\textcolor{red}{\text{red}}\) below).
\begin{align*} T \left( \begin{bmatrix} -3 \\ 9 \\ 5 \\ \textcolor{red}{-4} \end{bmatrix} \right) = \begin{bmatrix} -4 \\ 3 \\ 4 \end{bmatrix} \qquad T \left( \begin{bmatrix} -9 \\ -5 \\ 0 \\ -7 \end{bmatrix} \right) = \begin{bmatrix} 0 \\ 1 \\ 2 \end{bmatrix} \qquad T \left( \begin{bmatrix} 9 \\ -1 \\ -2 \\ 4 \end{bmatrix} \right) = \begin{bmatrix} 3 \\ -3 \\ 7 \end{bmatrix} \end{align*}Determine the value of
\begin{align*} T \left( \begin{bmatrix} 30 \\ 0 \\ -7 \\ 22 \end{bmatrix} \right) \end{align*}5. Non-Linearity
Consider the following transformation.
\begin{align*} \begin{bmatrix} x \\ y \\ z \end{bmatrix} \mapsto \begin{bmatrix} (x^3 + y^3 + z^3)^{1 / 3} \\ y + z \end{bmatrix} \end{align*}5.1. (5 points)
Demonstrate that the above transforamtion is not linear.
5.2. (2 points EC)
Extra Credit. Demonstrate that the above transformation is homogeneous.
6. NumPy Predicates
(10 points) As we start to use NumPy more, it'll be useful to have a collection of predicates (i.e., functions which return Boolean values) for the problems we consider in this course. Please make sure you've read through the supplementary NumPy tutorial before getting started.
You're given starter code in the file hw04.py
. Please do not change
the name of this file when you submit it, nor the names of functions
included in the starter code. You may add your own functions, but you
are not expected to. You're only required to fill in the TODO items in
the starter code.
You're required to implement the following functions. It may look like a large number of functions, but they will require very few lines of code.
is_con_aug(a)
, assuminga
represents the augmented matrix of a linear system, returnsTrue
if that system is consistent andFalse
otherwise.is_con_mat_eq(A, b)
returnsTrue
if the matrix equation \(A\mathbf v = \mathbf b\) has a solution, andFalse
otherwise.in_span(v, A)
returnsTrue
if \(v\) is in the span of the columns of \(A\), andFalse
otherwise.num_pivots(A)
returns the number of pivot positions inA
.full_span(A)
returnsTrue
if the columns ofA
have full span andFalse
otherwise.lin_ind(A)
returnsTrue
if the columns ofA
are linearly independent, andFalse
otherwise.
See the started code for more information about each function. You
may also want to look at the function numpy.nonzero(a)
in the numpy
documentation. Lastly, you don't need to deal with dimension
mismatches. You may assume that inputs are well-formed.
You'll upload the single python file hw04.py
to Gradescope with your
implementations of TODO items in the code. As usual we provide a
subset of the unit tests which you can run yourself in a file called
tests.py
. You can use the command python -m unittest
in the
terminal to run these tests.
Footnotes:
It will be clearer to write your final solution using the vector names of the form \(\mathbf v_i\). So, for example, if you find that \(\mathbf v_4 = 3 \mathbf v_1 + 2 \mathbf v_2 + 4 \mathbf v_3\), and that neither \(\mathbf v_2\) nor \(\mathbf v_3\) can be written as a linear combination of the vectors which precede it, then \(\mathbf v_4 = 3 \mathbf v_1 + 2 \mathbf v_2 + 4 \mathbf v_3\) should be your final solution.