Link to this document’s Jupyter Notebook

###StartPreClass###

# 04 Pre-Class Assignment: Python Linear Algebra Packages¶

## 1. The Syntax for Systems of Linear Equations¶

The following video explains the different syntax we use to describe linear systems.

from IPython.display import YouTubeVideo


The following is a summary of the syntax shown in the video:

### System of linear equations¶

$b_1 = a_{11}x_1+a_{12}x_2+a_{13}x_3 + \ldots a_{1n}$
$b_2 = a_{21}x_1+a_{22}x_2+a_{23}x_3 + \ldots a_{2n}$
$b_3 = a_{31}x_1+a_{32}x_2+a_{33}x_3 + \ldots a_{3n}$
$\vdots$
$b_m = a_{m1}x_1+a_{m2}x_2+a_{m3}x_3 + \ldots a_{mn}$

### System of linear equations (Matrix format)¶

$\begin{split} \left[ \begin{matrix} b_1 \\ b_2 \\ b_3 \\ \vdots \\ b_m \end{matrix} \right] = \left[ \begin{matrix} a_{11} & a_{12} & a_{13} & & a_{1n} \\ a_{21} & a_{22} & a_{23} & \ldots & a_{2n} \\ a_{31} & a_{32} & a_{33} & & a_{3n} \\ & \vdots & & \ddots & \vdots \\ a_{m1} & a_{m2} & a_{m3} & & a_{mn} \end{matrix} \right] \left[ \begin{matrix} x_1 \\ x_2 \\ x_3 \\ \vdots \\ x_m \end{matrix} \right] \end{split}$
$b=Ax$

### System of linear equations (Augmented Form)¶

$\begin{split} \left[ \begin{matrix} a_{11} & a_{12} & a_{13} & & a_{1n} \\ a_{21} & a_{22} & a_{23} & \ldots & a_{2n} \\ a_{31} & a_{32} & a_{33} & & a_{3n} \\ & \vdots & & \ddots & \vdots \\ a_{m1} & a_{m2} & a_{m3} & & a_{mn} \end{matrix} \, \middle\vert \, \begin{matrix} b_1 \\ b_2 \\ b_3 \\ \vdots \\ b_m \end{matrix} \right] \end{split}$

## 1. Introduction to Gauss Jordan Elimination¶

The following elementary row operations

1. Interchange two rows of a matrix

2. Multiply the elements of a row by a nonzero constant

3. Add a multiple of the elements of one row to the corresponding elements of another

from IPython.display import YouTubeVideo


Consider the element $$a_{2,1}$$ in the following $$A$$ Matrix.
$$$A = \left[ \begin{matrix} 1 & 1 \\ 20 & 25 \end{matrix} \, \middle\vert \, \begin{matrix} 30 \\ 690 \end{matrix} \right]$$$

QUESTION: : Describe an elementary row operation that could be used to make element $$a_{(2,1)}$$ zero?

QUESTION: : What is the new matrix given the above row operation.

Modify the contents of this cell and put your answer to the above question here.
$$$A = \left[ \begin{matrix} 1 & 1 \\ 0 & ?? \end{matrix} \, \middle\vert \, \begin{matrix} 30 \\ ?? \end{matrix} \right]$$$

Hint, we are using a formating language called Latex to display the above matrix. You should just be able to replace the ?? with your new numbers. If you can’t figure out what is going on, try searching the web with “latex math and matrix.” If it still doesn’t make sense, format your answer in another way that will be clear to understand by the you and the instructor.

The following function is a basic implementation of the Gauss-Jorden algorithm to an (m,m+1) augmented matrix:

## 2. Gauss Jordan Elimination and the Row Echelon Form¶

from IPython.display import YouTubeVideo


The above video left out a special case for Reduced Row Echelon form. There can be non-zero elements in columns that do not have a leading one. For example, All of the following are in Reduced Row Echelon form:

$\begin{split} \left[ \begin{matrix} 1 & 2 & 0 & 3 & 0 & 4 \\ 0 & 0 & 1 & 2 & 0 & 7 \\ 0 & 0 & 0 & 0 & 1 & 6 \\ 0 & 0 & 0 & 0 & 0 & 0 \end{matrix} \right] \end{split}$
$\begin{split} \left[ \begin{matrix} 1 & 2 & 0 & 0 & 4 \\ 0 & 0 & 1 & 0 & 6 \\ 0 & 0 & 0 & 1 & 5 \end{matrix} \right] \end{split}$

QUESTION: : What are the three steps in the Gauss-Jordan Elimination algorithm?

## 3. Gauss Jordan Practice¶

DO THIS:: Solve the following system of linear equations using the Gauss-Jordan algorithm. Try to do this before watching the video!

$x_1 + x_3 = 3$
$2x_2 - 2x_3 = -4$
$x_2 - 2x_3 = 5$

In the following video, we solve the same set of linear equations. Watch the video after trying to do this on your own. It is provided here in case you get stuck.

from IPython.display import YouTubeVideo


QUESTION:: Something was unclear in the above videos. Describe the difference between a matrix in “row echelon” form and “reduced row echelon” form.

## 4. Assignment wrap up¶

Assignment-Specific QUESTION: Describe the difference between a matrix in “row echelon” form and “reduced row echelon” form.

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?