Homework 3

Table of Contents

The following assignment is due Thursday 9/26 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.

1. Plane Intersection and RREFs

(10 points) Suppose you are given a system of linear equations with three variables and two equations, and that \((4, 1, 0)\) and \((2, 4, 1)\) are solutions to this system. You are also given that the two equations define distinct planes in \(\mathbb R^3\). Write down the reduced echelon form of the augmented matrix for this system.

2. Linear Combinations

Determine if the given vector \(\mathbf v\) in each part is in the span of the following vectors.

\begin{align*} \mathbf v_1 = \begin{bmatrix}10 \\ -33 \\ -5 \\ -30 \\ -3\end{bmatrix} \qquad \mathbf v_2 = \begin{bmatrix}-47 \\ -1 \\ -2 \\ -25 \\ 24\end{bmatrix} \qquad \mathbf v_3 = \begin{bmatrix}31 \\ -34\\ 11 \\ 39 \\ 25\end{bmatrix} \qquad \mathbf v_4 =\begin{bmatrix}-14 \\ 22 \\ 12 \\ 42 \\ 3\end{bmatrix} \end{align*}

If it isn't, write not in the span. If it is, write \(\mathbf v\) as a linear combination of the above vectors. In each case, you must also write the augmented matrix of the linear system you solved, but otherwise, you do not need to show your work.

2.1. (5 points)

\begin{align*} \mathbf v = \begin{bmatrix} 42 \\ -23 \\ 98 \\ 11 \\ -87 \end{bmatrix} \end{align*}

2.2. (5 points)

\begin{align*} \mathbf v = \begin{bmatrix} 87 \\ -19 \\ -24 \\ -61 \\ -79 \end{bmatrix} \end{align*}

3. Spans and Linear Equations

3.1. (5 points)

Find a linear equation in three variables whose point set is exactly1

\begin{align*} \mathsf{span} \left\{ \begin{bmatrix} 1 \\ 0 \\ -2 \end{bmatrix}, \begin{bmatrix} 1 \\ 1 \\ 1 \end{bmatrix} \right\} \end{align*}

You must show your work.

3.2. (5 points)

Find a linear equation in three variables whose point set is exactly

\begin{align*} \left\{ \mathbf v + \begin{bmatrix} 2 \\ -3 \\ 2 \end{bmatrix} \ \text{where} \ \mathbf v \in \mathsf{span} \left\{ \begin{bmatrix} 1 \\ 1 \\ -5 \end{bmatrix}, \begin{bmatrix} 0 \\ 1 \\ -1 \end{bmatrix} \right\} \right\} \end{align*}

In other words, every point in the point set of the equation can be expressed as the sum of \([2 \ \ (-3) \ \ 2]^T\) and a vector in the span of \([1 \ \ 1 \ \ (-5)]^T\) and \([0 \ \ 1 \ \ (-1)]^T\). You must show your work.

4. Solving Matrix-Vector Equations

(5 points) Write down the general form solution to the following matrix-vector equation. You do not need to show your work.

\begin{align*} \begin{bmatrix} 1 & 1 & 3 & 1 & -7 & 1 \\ -5 & -4 & -14 & -3 & 24 & -8\\ 0 & -2 & -2 & -3 & 21 & 3 \\ -6 & -3 & -15 & -2 & 11 & -8 \end{bmatrix} \mathbf x = \begin{bmatrix} 7 \\ -16 \\ -20 \\ -27 \end{bmatrix} \end{align*}

5. Quadratic Interpolation

It is well known2 that any three distinct points in the plane define a unique quadratic equation. Given three points \((x_1, y_1)\), \((x_2, y_2)\) and \((x_3, y_3)\), the equation \(y = ax^2 + bx + c\) which passes through these three points is given by the solution to the following matrix equation.

\begin{align*} \begin{bmatrix} x_1^2 & x_1 & 1 \\ x_2^2 & x_2 & 1 \\ x_3^2 & x_3 & 1 \end{bmatrix} \begin{bmatrix} a \\ b \\ c \end{bmatrix} = \begin{bmatrix} y_1 \\ y_2 \\ y_3 \end{bmatrix} \end{align*}

5.1. (5 points)

Convince yourself of the above fact. Then use it to determine the unique quadratic equation which passes through the points \((2, 13)\), \((3, 25)\) and \((-2, 5)\). You must also write down the augmented matrix of the linear system you solved.

5.2. (10 points)

Write down the RREF of the matrix

\begin{bmatrix} x^2 & x & 1 & y \\ 1 & 1 & 1 & 1 \\ \left(\frac{x + 1}{2}\right)^2 & \frac{x + 1}{2} & 1 & \frac{y + 1}{2} \end{bmatrix}

in terms of \(x\) and \(y\), assuming \(x \not = 1\). Explain your answer. Hint: Don't try to row reduce it. It's not worth it.

6. A Small Interface (Programming)

We've mentioned in passing several times at this point that we could implement everything in this course on our own. We won't generally do this, but for the practice we're going to do it once. You're given an interface for vectors and matrices in a file called matlib.py. Please read through this file carefully and make sure you understand how these objects work. You're not allowed to change anything in this file.

You're given starter code in the file hw03.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:

  • vec_scale(val, vec) returns the result of scaling the vector vec by the float val
  • vec_add(v1, v2) returns the sum of the vectors v1 and v2. This function must raise an exception with message "DIMENSION MISMATCH" if its inputs do not have the same number of entries
  • vec_inner(v1, v2) returns the inner product of the vectors v1 and v2. This function must raise an exception with then message "DIMENSION MISMATCH" if its inputs do not have the same number of entries
  • mat_vec_mul(a, v) returns the product of the matrix a times the vector v. This function must raise an exception with message "DIMENSION MISMATCH" if a does not have the same number of columns as v has entries

You'll upload the single python file hw03.py to Gradescope with your implementations of TODO items in the code. You won't have access to the tests on Gradescope, but we'll provide a subset of the unit tests which you can run yourself in a file called tests.py. You can run python -m unittest to run these tests.

Footnotes:

1

Note that we're conflating points and vectors here.

2

Or, in any case, you can take it as a given.