Exercise 1: Solutions of Systems of Linear Equations
These first exercises are an introduction to how to solve systems of linear equations and should all be solved by hand.
A
Find the general solution to the system of linear equations:
\begin{equation}
\begin{aligned}
x_1 + 2x_2 - 4x_3 &= 2\newline
x_2-2x_3 &= -1\newline
x_3 &= 2
\end{aligned}
\end{equation}
hint
For this system of equations you only need a few row operations to bring the augmented matrix on reduced echelon form. With which row operation do you want to start?
hint
See the method used in Example 6.8 in eNote 6. When reduced row echelon form has been reached, you must extract the solution to the equation system and write it on standard parametric form.
Find the general solution to the system of linear equations:
\begin{equation}
\begin{aligned}
x_1 - x_3 + x_4 &= 0\newline
x_1 + x_2 + x_3 + x_4 &= 1\newline
4x_1 + 4x_2 + 4x_3 + 3x_4 &= 5
\end{aligned}
\end{equation}
hint
Set up the augmented matrix for the system of equations. Reduce it using Gauss-Jordan elimination.
hint
The system of equations can be reduced to \begin{equation}
\begin{aligned}
x_1 - x_3 &= 1\newline
x_2 + 2x_3 &= 1\newline
x_4 &= -1
\end{aligned}
\end{equation}
hint
When you have brought the augmented matrix to reduced row echelon form, you can use Method 6.31 in eNote 6.
answer
\begin{equation}
\begin{bmatrix}x_1\\x_2\\x_3\\x_4\end{bmatrix}=\begin{bmatrix}1\\1\\0\\-1\end{bmatrix}+t\begin{bmatrix}1\\-2\\1\\0\end{bmatrix}\quad , t \in \Bbb R
\end{equation}
C
Find the general solution to the complex system of linear equations:
\begin{equation}
\begin{aligned}
i\,x_1 - 2x_2=-i\newline
x_1 + (1+i)x_2= 1
\end{aligned}
\end{equation}
hint
The algorithm for Gauss-Jordan elimination is still valid for complex systems of linear equations. Remember that $i$ is just a number. Start by setting up the augmented matrix.
hint
The augmented matrix:
\begin{equation}\begin{matr}{cc|c} i & -2 & -i\\1 & 1+i & 1\end{matr}\end{equation}
Now perform row operations as usual to reach reduced row echelon form and then extract the solution.
answer
$$(x_1,x_2)=(1-2i,1+i)$$
D
Find the general set of solutions for the system of linear equations:
\begin{equation}
\begin{aligned}
x_1+2x_2+2x_3 &= 2 \newline
x_2+3x_3 &= 3 \newline
x_1+4x_2+8x_3 &= 9
\end{aligned}
\end{equation}
hint
In the reduced row echelon form you might notice a row looking like this: $\begin{matr}{ccc|c} 0 & 0 & 0 & 1 \end{matr}$. What does this mean for the system as a whole?
answer
The system of equations is inconsistent and has no solutions.
The inconsistency is clear when an impossible equation appears (the bottom row states that $0=1$). This implies that the the equations that make up the system do not have any solution in common.
Exercise 2: Intro to Systems of Equations with Maple
Naturally, Maple can perform computations with matrices. But not all commands are loaded by default. For those we need for our topic today, a package must first be loaded within our Maple sheet. This package is called LinearAlgebra and is loaded with this command:
with(LinearAlgebra):
Note that you must use uppercase L and A. Maple is case-sensitive. (If you’d like to see all the commands loaded with this package, then try to remove the colon.)
and store it in Maple’s memory by defining it to a name with :=:
b:=<1,4>
When you later type b anywhere on a math line, then this is the output you get. Such defined names are reset by clicking Enter on the restart command (or alternatively by writing on a new line: b:='b').
Matrices are created using these symbols: <, >, ,; and |. Write either
A:=<3 , -7 ; -2 , -1>
or
A:=<3,-2 | -7,-1>
which will both result in the same matrix; the former writes it row-wise and the latter column-wise. You can use which ever syntax you like the most. (It might be recommandable to use the latter syntax where the commas separate rows, which corresponds to how vectors are made.)
The linear equation system can be solved in one go with the command LinearSolve (again remember to correctly type uppercase and lowercase letters):
LinearSolve( A , b )
The solutions to the two given equations of two unknowns can be visualized as the intersections between two straight lines in a plane. To illustrate this you’ll need plotting commands from another package:
with(plots):
The plot command itself is loaded by default, but more advanced types of plotting and presentation commands, like the ones below, require this package to be loaded first. Try using implicitplot, which can plot full equations, in contrast to plot that only plots expressions or functions:
line1 := implicitplot( 3*x - 7*y = 1 , x = -3 .. 3 , y = -3 .. 3):
line2 := implicitplot( -2*x - y = 4 , x = -5 .. 3 , y = -3 .. 3):
We are suppressing the output with : because we are not interested in two different plot windows but rather in a single window with both graphs shown. You can merge many plots into the same window with display - note the scaling=constrained argument that enforces equal units on all axes giving same proportions:
display(line1 , line2 , scaling=constrained)
Note that when performing multiplications you must always remember the multiplication sign *. If you instead of x*3-y*7 wrote x3-y7, then Maple would mistakenly have thought that you were refering to variable names $x_3$ and $y_x$. So always remember the multiplication symbol.
Now that you have the graph, try to read from it the intersection point and compare it to the solution you found when solving the two equations analytically.
We will now try to solve Exercise 1.b) with Maple. Write (and understand!) the following commands:
restart: with(LinearAlgebra):
We are given the equations:
eqn1 := x1 - x3 + x4 = 0
eqn2 := x1 + x2 + x3 + x4 = 1
eqn3 := 4*x1 + 4*x2 + 4*x3 + 3*x4 = 5
We now generate the augmented matrix corresponding to the above system of linear equations:
T :=<1,1,4|0,1,4|-1,1,4|1,1,3|0,1,5>
Write the following commands and check wether the results match those you arrived at by hand:
T1 := RowOperation(T , [2,1] , -1)
T2 := RowOperation(T1 , [3,1] , -4)
T3 := RowOperation(T2 , [3,2] , -4)
T4 := RowOperation(T3 , 3 , -1)
redRowEchForm := RowOperation(T4 , [1,3] , -1)
You have now reached the reduced row echelon form of your augmented matrix.
Note the Maple syntax for using each of the three row operations. If you are still not clear on how the syntax works and how they should be used, then try out some more examples before continuing and make yourself more familiar with them.
Actually, you don’t have to use RowOperation for a semi-manual step-by-step method. If you are not interested in the intermediate steps, then you can reach the reduced row echelon form of the augmented matrix immediately with a single command:
ReducedRowEchelonForm(T)
From here Maple cannot rewrite any further, and you must manually extract the solutions and write them on standard parametric form.
Now try to solve the system using LinearSolve (the argument free=t sets the symbol to use for any free parameters):
LinearSolve(A,b,free=t)
Do both solution methods - using RowOperation or ReducedRowEchelonForm vs. LinearSolve - give the same result? In both cases you must manually finalise the output on the form that you want.
Exercise 3: System of Linear Equations with Maple
Given the system of equations \begin{equation}
\begin{aligned}
x_1+2x_2+2x_3 &= 6 \newline
x_2+3x_3 &= 3 \newline
x_1+4x_2+8x_3 &= 12
\end{aligned}
\end{equation}
A
Define in Maple the coefficient matrix $\mA$, the right-hand side $\mathbf b$ and the augmented matrix $\mT$ of the system of equations.
hint
When you have defined $\mA$ and $\mathbf b$, you can in Maple easily set up T:=<A|b>.
B
Solve the system using the three Maple commands: RowOperation, ReducedRowEchelonform and LinearSolve.
C
State the solution set for the system of equations on standard parametric form.
Discuss pros and cons of each of the three Maple commands: RowOperation, ReducedRowEchelonForm and LinearSolve.
Exercise 4: The Structure of Solutions and the Concept of Rank (Theory)
It is essential to understand the structure of a solution set. Both the relation between the solutions of the inhomogeneous system of equations and that of the corresponding system of homogeneous equations, as well as the relation between the form/dimension of the solution set and the rank of the corresponding augmented matrix are essential to understand.
A
If $ \mx_0 = (1,2,3) $ is a solution to the inhomogeneous system of linear equations, and if $ \mx_1 = (0,5,2) $ is a solution to the corresponding homogeneous problem, is $ \my_0 = (1,7,5) $ then a solution to the inhomogeneous set of equations?
Is $ \mz_0 = (2,9,8) $ a solution to the inhomogeneous system of linear equations?
Is the difference between two solutions of the inhomogeneous system of linear equations a solution to the inhomogeneous system of equations?
hint
The sum of a solution to an inhomogeneous linear system of equations and a solution to the corresponding homogeneous system of equations is again a solution the corresponding inhomogeneous system of equations; see Theorem 6.37 in eNote 6 and all of Section 6.9.
hint
Is $ \mx_0 + \mx_1 = \my_0 $?
answer
$ \mx_0 + \mx_1 = \my_0 $ is a solution to the inhomogeneous system of equations, while $ \mz_0 = \mx_0 + \my_0 $ is the sum of two solutions to the inhomogeneous system of equations. Thus $ \mz_0 $ is not a solution to the system. In the same way the difference between two solutions (e.g. $ \mx_0 - \my_0 $) to the inhomogeneous system of equations is not a solution to the inhomogeneous system of equations, but on the contrary it is a solution to the corresponding homogeneous system of equations (this answer is not easy - read it again).
Before you solve the next problem you should thoroughly work through Example 6.8 in eNote 6 about Gauss-Jordan elimination and today’s Maple demo.
B
Describe in your own words what the rank of the augmented matrix means to the structure of the solution set.
hint
See Method 6.31 in eNote 6.
Exercise 5: The Structure of Solutions and the Concept of Rank (Practice)
The system of equations in this exercise contains an unknown real number $a$ and the solution is different depending on the value of $a$. During the Gauss-Jordan elimination you must be particularly careful not to divide by zero, because you then will miss important special cases. Since $a$ is an unknown and thus could take a value that causes a denominator to become zero, then dividing with an expression involving $a$ automatically constitutes a special case.
Use the exercise to discuss how the rank of the coefficient matrix and augmented matrix of the system and thus the structure of the solution set depends on $a\,.$
A
By hand: Find for every real value of $a$ all solutions to the system of linear equations
\begin{equation}
\begin{aligned}
ax_1 + x_2 + x_3 &= 1\newline
x_1 + ax_2 + x_3 &= 1\newline
x_1 + x_2 + ax_3 &= 1
\end{aligned}
\end{equation}
hint
Set up the augmented matrix of the system of equations and perform Gauss-Jordan elimination. Pay special attention to the divisions!
hint
It may be a good idea to start by switching the two rows $ R_1 \leftrightarrow R_3 $.
hint
After a couple of operation you may want to divide by $a-1$ and maybe also by $2-a^2-a$ (and maybe even by other expression involving $a$ as well). By doing so, anything that follows applies to all values of $a$except for those that would have caused division by zero! Meaning, the final solutions you arrive at do not apply to those exceptional $a$ values.
hint
When you are done and have found the main solutions to the system of equations, then start over and solve the system once again, but this time by first substituting in the special-case value of $a$. Solving this system now gives you a solution that only applies to this $a$ value.
answer
During the Gauss-Jordan elimination you will encounter the two special cases $ a=-2 $ and $ a=1 $, whose solutions differ from those of all other $a$ values.
When $ a=1 $ the reduced row echelon form of the augmented matrix is
\begin{equation}
\begin{matr}{rrrr} 1 & 1 & 1 & 1 \newline 0 & 0 & 0 & 0 \newline 0 & 0 & 0 & 0\end{matr}
\end{equation}
which yields the solution
\begin{equation}
(x_1, x_2, x_3)=(1,0,0)+t_1(-1,1,0)+t_2(-1,0,1),\quad (t_1, t_2) \in \reel^2 \,.
\end{equation}
When $ a=-2 $ the reduced row echelon form of the augmented matrix is
\begin{equation}
\begin{matr}{rrrr} 1 & 0 & -1 & 0 \newline 0 & 1 & -1 & 0 \newline 0 & 0 & 0 & 1 \end{matr}
\end{equation}
Here the rank of the augmented matrix is one larger than the rank of the coefficient matrix, and therefore there is no solution (this implies an inconsistent system). For all other values of a $ a $ the solution is
\begin{equation}
(x_1, x_2, x_3)=\left( \frac{1}{a+2}\;,\;\frac{1}{a+2}\;,\;\frac{1}{a+2} \right), \quad a \in \reel \setminus \lbrace -2, 1 \rbrace \, .
\end{equation}
B
Check the result above with Maple’s LinearSolve. How does Maple handle special cases?
answer
Maple generally does not take into account special cases and exceptions of divisions by zero in these cases. When unknowns are included in a task and there is a risk that you might divide with them, then you must be careful with Maple and might have to solve it manually (or at least simulated manually with RowOperations where you can keep track of every step).
Exercise 6: Computations with Matrices
Multiplication with matrices is not obvious. As a start, read Example 7.2 and Example 7.11 in eNote 7. Note the rules for the computational operations introduced in Theorem 7.3, Theorem 7.13 and Theorem 7.16.
A
What is important to consider before you start the multiplication?
hint
Do the dimensiosn of the matrices match?
hint
The number of columns in the first matrix must equal the number of rows in the second matrix.
B
Which conditions of the matrices $\mA$ and $\mB$ are needed for it to even make sense to ask whether $\mA\mB$ and $\mB\mA$ might be equal?
hint
What are the dimensions of $\mA$ and $\mB$? Consider some examples.
answer
$\mA$ and $\mB$ might not match dimension-wise, and then their product can’t be computed.
Also, they must both be square matrices for their products in both directions (both $\mA\mB$ and $\mB\mA$) to even be compared as possibly equal.
C
If $\mA\mB$ and $\mB\mA$ have the same dimensions, is it then certain that $\mA\mB = \mB\mA$?
answer
Even if $\mA\mB$ and $\mB\mA$ have the same dimensions, it is not certain that the individual elements are equal. Think of some $2 \times 2$ examples or see Example 7.12 in eNote 7.
D
A matrix and a vector are given by:
\begin{equation}
\mA= \begin{matr}{rrr} 2 & -1 & 3 \newline 1 & 2 & -1 \end{matr}
\,\,\,\mathrm{and}\,\,\,
\mb=\begin{matr}{r} 3\newline 1\newline -2\end{matr}\,.
\end{equation}
Compute by hand the matrix-vector product of $\mA$ and $\mb$.
answer
$$
\begin{matr}{r} -1\newline 7\end{matr}\,.
$$
E
Given the matrices \begin{equation}
\mA= \begin{matr}{rrr} 1 & 1 & 2 \newline 1 & 2 & -1 \end{matr} \quad \mathrm{and} \quad \mB = \begin{matr}{rrr} 0 & -1 & -1 \newline 1 & 2 & 1 \end{matr}
\end{equation}
By hand: Compute, if possible, the following: $2\mA-3\mB$, $2\mA\transp-3\mB\transp$, $2\mA-3\mB\transp$, $\mA\mB$, $\mA\mB\transp$, $\mB\mA\transp$, $\mB\transp\mA$ and $\mA\transp\mB$.
hint
Do the dimensions of the matrices fit? If yes, use Definition 7.10 where the matrix-matrix product is computed as a series of matrix-vector products.
Solve the matrix equation $\,\mA\mathbf x=\mathbf b\,.$
hint
$\mathbf x\,$ is an unknown vector that has to be found. Which form does it have?
hint
Put $\,\displaystyle{\mathbf x = \begin{matr}{r} x_1\newline x_2\newline x_3\newline x_4 \end{matr}}\,$ and compute the matrix-vector product $\,\mA\,\mathbf x\,.$
hint
Ok, so the matrix equation is equivalent to an inhomogeneous system of equations with two equations of four unknowns!
answer
$\mathbf x = (4,3,0,0)+t_1(1,2,1,0)+t_2(-1,0,0,1)\,$ where $t_1$ and $t_2$ are free parameters.