Link to this document's Jupyter Notebook

In order to successfully complete this assignment you must do the required reading, watch the provided videos and complete all instructions. The embedded survey form must be entirely filled out and submitted on or before 11:59pm on on the day before class. Students must come to class the next day prepared to discuss the material covered in this assignment.


Pre-Class Assignment: Gauss-Jordan Elimination

Goals for today's pre-class assignment

  1. Sympy RREF function
  2. Calculating Vector Length, Normalization, Distance and Dot
  3. Vector spaces in $R_n$
  4. Assignment wrap up

1. Sympy RREF function

In class we talked about the Python sympy library which has a "reduced row echelon form" (rref) function that runs a much more efficient version of the Gauss-Jordan function. To use the rref function you must first convert your matrix into a sympy.Matrix and then run the function. For example, lets do this for the following matrix $B$:

This function outputs two values (a matrix and a tuple). For the purposes of this class we only care about the matrix. I generally use the following syntax when using rref()

QUESTION: Although we do not use it often in this course, what does the second output of the rref mean (i.e. what does (0,1) mean? hint: read the documentation for rref.

Put your answer to the above question here

How lets consider the multi-week example from a previous assignment, where:

Week 1: $$ c + b = 30 $$ $$ 20c + 25b = 690 $$

Week 2: $$ c + b = 35 $$ $$ 20c + 25b = 750 $$

Week 3: $$ c + b = 30 $$ $$ 20c + 25b = 650 $$

DO THIS: Write a $2 \times 5$ augmented matrix representing the 6 equations above. (you can just copy and paste this from the pre-class if you got it right there), Name your Matrix $G$ to verify your answer using the checkanswer function below.

The following function will apply the rref function to the matrix $G$ and store it in a variable called, wait for it, rref:

QUESTION: Given the above, How many hours did Giselle work as a capenter for the three weeks and how many hours did she work as a blacksmith. Fill in your answers below to check if you are correct:


2. Calculating Vector Length, Normalization, Distance and Dot

In this section we will cover some of the basic vector math we will use this semester.

DO THIS: Watch the following summary video about calculation of vector length, Normalizing vectors and the distance between points then answer the questions.

Vector:

$$(a_1, a_2, \dots a_n)$$
$$(b_1, b_2, \dots b_n)$$

Length:

$$length = \sqrt{a_1^2 + a_2^2 + \dots + a_n^2}$$

Normalization:

$$\frac{1}{length}(a_1, a_2, \dots a_n)$$

Distance:

$$distance = \sqrt{(a_1 - b_1)^2 + (a_2 - b_2)^2 + \dots + (a_n - b_n)^2}$$

QUESTION: Calculate length of vector (4.5, 2.6, 3.3, 4.1)?

QUESTION: What is a normalized form of the vector (4.5, 2.6, 3.3, 4.1)?

QUESTION: What is the distance between (4.5, 2.6, 3.3, 4.1) and (4, 3, 2, 1)?

Dot Product:

$$dot(a,b) = a_1b_1 + a_2b_2 +\dots + a_nb_n$$

DO THIS: Review Sections 1.4 and 1.5 of the Boyd and Vandenberghe text and answer the questions below.

QUESTION: What is the dot product between $u = [ 1, 7, 9, 11]$ and $v = [ 7, 1, 2, 2]$ (Store the information in a variable called uv)?

QUESTION: What is the norm of vector $u$ defined above (store this value in a variabled called n)?

QUESTION: What is the distance between points $u$ and $v$ defined above. (put your answer in a variable named d)


3. Vector spaces in $R^n$

There are two properties that define a vector space these are:

For now we will consider vector spaces in $R^n$ which are just vectors of real numbers (ex: [10,20,3.2], [5,8,32], [8,-0.7], etc) where $n$ is just the length of the vector (ex: 3, 3, and 2 in the earlier example). In the general case a vector does not have to be composed of real numbers but can be almost any type of object as long as it maintains the two above properties, we will get into this concept later in the semester. In the case of real number the above concepts can be described as follows:

$$\text{if } u,v \in R^n$$$$\text{then } u+v \in R^n$$ $$\text{if } s \in R \text{ and } v \in R^n$$$$\text{then } sv \in R^n$$

The following are some properties of vector addition and multiplication for vectors $u$ and $v$:

  1. $u + v = v + u$ Commutative property
  2. $u + (v + w) = (u + v) + w$ Associative property
  3. $u+0 = 0 + u = u$ Property of zero vector
  4. $u + (-u) = 0$ Property of the negative vector
  5. $c(u+v) = cu + cv$ Distributive properties
  6. $(c+d)u = cu+du$ Distributive Properties
  7. $c(du) = (cd)u$ Distributed Properties
  8. $1u = u$ Scalar multiplication by 1

QUESTION: Compute the following linear combinations for $u = (1,2), v = (4,-1)$, and $w = (-3,5)$.

(a) $a = u+w$

Put your answer here

(b) $a = 2u+v$

Put your answer here

(c) $a = u+3w$

Put your answer here


4. Assignment wrap up

Please fill out the form that appears when you run the code below. You must completely fill this out in order to receive credit for the assignment!

Direct Link to Google Form

If you have trouble with the embedded form, please make sure you log on with your MSU google account at googleapps.msu.edu and then click on the direct link above.

**Assignment-Specific QUESTION:** What is the distance between (4.5, 2.6, 3.3, 4.1) and (4, 3, 2, 1)?

Put your answer to the above question here

**QUESTION:** Summarize what you did in this assignment.

Put your answer to the above question here

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

Put your answer to the above question here

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

Put your answer to the above question here

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

Put your answer to the above question here

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

Put your answer to the above question here

**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?

Put your answer to the above question here

**QUESTION:** Do you have any further questions or comments about this material, or anything else that's going on in class?

Put your answer to the above question here

**QUESTION:** Approximately how long did this pre-class assignment take?

Put your answer to the above question here


Congratulations, we're done!

To get credits for this assignment, you must fill out and submit the above survey form on or before the assignment due date.

Course Resources:

Written by Dr. Dirk Colbry, Michigan State University Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.