EU05S-OPG
Exercise 1: Solution of Systems of Linear Equations
These first exercises are an introduction to the solution of systems of linear equations and should all be solved by hand.
Find the complete solution to the system of linear equations:
\begin{equation}
\begin{aligned}
x_1 + 2x_2 - 4x_3 &= 2\
x_2-2x_3 &= -1\
x_3 &= 2
\end{aligned}
\end{equation}
%<pre> %####### begin:hint %$x_3$ is determined by the last equation. Substitute this into the middle equation. %####### end:hint %####### begin:hint %Find $x_2$ in the middle equation and substitute $x_2$ and $x_3$ in the first equation. Find $x_1$. %####### end:hint </pre>
Find the complete solution to the system of linear equations:
\begin{equation}
\begin{aligned}
x_1 - x_3 + x_4 &= 0\
x_1 + x_2 + x_3 + x_4 &= 1\
4x_1 + 4x_2 + 4x_3 + 3x_4 &= 5
\end{aligned}
\end{equation}
Find the complete solution to the complex system of linear equations:
\begin{equation}
\begin{aligned}
i\,x_1 - 2x_2=-i\
x_1 + (1+i)x_2= 1
\end{aligned}
\end{equation}
Find the complete set of solutions for the system of linear equations:
\begin{equation}
\begin{aligned}
x_1+2x_2+2x_3 &= 2 \
x_2+3x_3 &= 3 \
x_1+4x_2+8x_3 &= 9
\end{aligned}
\end{equation}
Exercise 2: Intro to Systems of Equations with Maple
%<pre>
%I dag har du lært lidt om lineær algebra, og det er derfor her, vi tager udgangspunkt for det, du i det følgende skal lære om Maple
.
</pre>
Of course, Maple
can compute with matrices, but first we have to include in Maple
a package that will open a number of commands about linear algebra. The package is named LinearAlgebra and it is included by the use of this command:
> with(LinearAlgebra):
Note that the command is written with a colon at the end. First try to write the command without the colon and look at the difference. The output from Maple
is all the commands that the package includes. However, this is redundant information and therefore it can be a good idea to end the command by a colon to suppress the output.
Also, note that LinearAlgebra contains capitals, L and A. Maple
distinguish between lower and upper case.
The small system of linear equations \begin{equation}
\begin{aligned}
3x - 7y &= 1 \
-2x -y &= 4
\end{aligned}
\end{equation}
has the coefficient matrix
\begin{equation}
\begin{aligned}
\begin{matr}{rr} 3 & -7 \\ -2 & -1 \end{matr}
\end{aligned}
\end{equation}
%I Maple
ønsker vi at kalde denne matrix for A. Man tildeler en variabel i Maple
en værdi ved hjælp af det dynamiske lighedstegn := (kolon lighedstegn). Det virker altså ikke, hvis man kun bruger et lighedstegn. Så tolker Maple
nemlig inputtet som en ligning (som man eventuelt senere har lyst til at løse).
In Maple
one can write matrices by using the five signs $ < > , ; | $ in this way
> A := <3 , -7 ; -2 , -1> ;
or
> A := <3,-2 | -7,-1> ;
%Den sidste og nemmeste mulighed er dog at bruge Matrix-paletten til venstre for kommandovinduet: Tryk på Matrix-paletten \includegraphics[scale=.8]{billeder/matrixpalet.png} angiv hvor mange rækker og søjler matricen skal have, og tryk derefter \textsf{Insert Matrix}. Udfyld det første felt som er highlighted og brug tabulatortasten til at komme videre til næste felt. Sådan kan du fortsætte. Prøv at se, hvad nogen af de andre paletter kan.
Now also define the right-hand side b by
> b := <1,4>;
%eller med paletten.
One can solve the linear with the command LinearSolve (again remember the difference between lower caase and upper case letters):
> LinearSolve( A , b );
We can also consider the two equations in two unknowns as a question about the intersection of two straight lines in a plane. If we want to illustrate this we need another package, write:
> with(plots):
%Læg igen mærke til brugen af kolon til sidst. plots-pakken indeholder mere avancerede former for plots end kommandoen plot kan klare. Nu prøver vi at plotte de to linjer sammen:
> linje1 := implicitplot( 3*x - 7*y = 1 , x = -3 .. 3 , y = -3 .. 3):
> linje2 := implicitplot( -2*x - y = 4 , x = -5 .. 3 , y = -3 .. 3):
Then the plots can be merged into a single figure and shown with this command (and scaling = constrained is also included as argument):
> display([linje1 , linje2] , scaling=constrained);
The multiplication sign is written as * (asterisk). it is important that you alway write the multiplication sign and don’t leave it out as you often do when you write mathematics.
%Hvis du i stedet for at skrive $ 3 \cdot x -7 \cdot y $ prøvede at skrive $ x3 - y7 $ uden gangetegnene havde du fået en fejlmelding i Maple
. Prøv! Så: Husk altid at skrive gangetegnene!
Compare the coordinates to the intersection point with the solutions found previously to the two equations describing the lines.
%<pre>
%Du kan aflæse koordinaterne ved at klikke på plottet og derefter på
%plotsymbolet
%\includegraphics[scale=.8]{billeder/plot.PNG}
%i menulinjen. Vælg en af de tre nederste muligheder, og hold cursoren over plottet. Afprøv alle tre muligheder for aflæsning. Stemmer det overens (nogenlunde) med resultatet fra udregningen?
%</pre>
Now we shall try to solve Exercise 1b) in Maple
. Write (and understand!) the following commands:
> restart: with(LinearAlgebra):
Given the equations:
> lign1 := x1 - x3 + x4 = 0:
> lign2 := x1 + x2 + x3 + x4 = 1:
> lign3 := 4*x1 + 4*x2 + 4*x3 + 3*x4 = 5:
We form (generate) the augmentet matrix corresponding to the system of linear equations:
> T :=<<1,1,4>|<0,1,4>|<-1,1,4>|<1,1,3>|<0,1,5>>;
%<pre>
%>
T
:= GenerateMatrix
(\,[lign1
, lign2
, lign3
] , [x1,x2,x3,x4
] , augmented
);}
%</pre>
Write the following commands and see if the results are the same as when you did the computations 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);
> trapT := RowOperation(T4 , [1,3] , -1);
Now try to write the corresponding completely reduced system of linear equations. %<pre> %fås herefter ved:
%>
GenerateEquations
(trapT
, [x1,x2,x3,x4
]\,);
%</pre>
You can arrive at the complete reduced augmented matrix by use of the command
> trapT2 := ReducedRowEchelonForm(T);
Write the solution set in the standard parametric form and compare with the following (that is the fastest solution method – LinearSolve becomes your friend!):
First you must define the coefficient matrix > A:=
and the right-hand side > b:=
. Then you try with:
%<pre>
%>
A,b
:= GenerateMatrix
(\,[lign1,lign2,lign3
] , [x1,x2,x3,x4
]\,);}
%</pre>
> LinearSolve(A,b,free=t);
Do all solution methods give the same result?
Exercise 3: System of Linear Equations with Maple
Given the system of equations \begin{equation}
\begin{aligned}
x_1+2x_2+2x_3 &= 6 \
x_2+3x_3 &= 3 \
x_1+4x_2+8x_3 &= 12
\end{aligned}
\end{equation}
Define in Maple the coefficient matrix A, the right-hand side b and the augmented matrix T of the system of equations.
Try the three Maple-methods: RowOperation, ReducedRowEchelonform and LinearSolve.
State the solution set for the system of equations in standard parametric form.
Discuss pros and cons with each of the three Maple-methods: RowOperation, ReducedRowEchelonForm and LinearSolve.
Exercise 4: The Structure of Solutions and the Concept Rank: Theory
It is essential to reach an understanding of the structure of the solution set. Both the relation between the solutions of the inhomogeneous system of equations and the corresponding system of homogeneous equations, and the relation between the form/dimension of the solution set and the rank of the corresponding augmented matrix.
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 then $ \my_0 = (1,7,5) $ 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?
Before you solve the next problem you should thoroughly work through Example 6.8 in eNote 6 about Gauss-Jordan elimination and the first MapleDemo Systems of Equations basic. %\tref{NUID1-TN2.8}{Example}
Describe in your own words what the rank of the augmented matrix means to the structure of the solution set.
Exercise 5: The Structure of Solutions and the Concept Rank: Practice
Intro: The system of equations in this exercise contains an unknown real number $a$ and the solution is different dependent on the value of $a$. During the Gauss-Jordan elimination you must be very careful not to divide by zero, because you then miss important special cases. Use the exercise to discuss how the rank of the coefficient and augmented matrix of the system and thus the structure of the solution set depends on $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\
x_1 + ax_2 + x_3 &= 1\
x_1 + x_2 + ax_3 &= 1
\end{aligned}
\end{equation}
Check the result above with Maple’s LinearSolve. Conclusion?
Exercise 6: Computations with Matrices
To multiply matrices is not that simple, and when you just apply the letter notions of our matrices it can easily go wrong! First read Example 7.2 and Example 7.11. Note the rules of computation for the computational operations introduced Theorem 7.3, Theorem 7.13 and Theorem 7.16. %\tref{NUID2-eks.simpleop}{Example} %\tref{NUID2-tn3.trans}{Theorem}). %\tref{NUID2-eks.matenvej}{Example}. %\tref{NUID2-eks.matenvej}{Example}. %(\tref{NUID2-tn3.regneregler}{Theorem}, %\tref{NUID2-tn3.regneregler2}{Theorem}
What is it important to consider before you start the multiplication?
Why is it general true that $\mA\mB \neq \mB\mA$?
If $\mA\mB$ and $\mB\mA$ has the same dimension, is it then certain that $\mA\mB = \mB\mA$?
A matrix and a vector are given by: \begin{equation} \mA= \begin{matr}{rrr} 2 & -1 & 3 \\ 1 & 2 & -1 \end{matr} \,\,\,\mathrm{and}\,\,\, \mb=\begin{matr}{r} 3\\1\\-2\end{matr}\,. \end{equation} Compute by hand the matrix vector product of $\mA$ and $\mb$.
Given the matrices \begin{equation} \mA= \begin{matr}{rrr} 1 & 1 & 2 \\ 1 & 2 & -1 \end{matr} \quad \mathrm{and} \quad \mB = \begin{matr}{rrr} 0 & -1 & -1 \\ 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$.
Exercise 7: A Disguised System of Equations?
A matrix $\,\mA\,$ and vectors $\,\mathbf b\,$ are given by
Solve the matrix equation $\,\mA\mathbf x=\mathbf b\,.$