Tutorial 1 Solution
Tutorial 1 Solution
Department of Mathematics
(b)
a + b − c − 2d = 0
2a + b − c + d = −2
−a + b − 3c + d = 4
(c)
x − 4y + 2z = −2
x + 2y − 2z = −3
x − y = 4
Solution:
(a)
3 2 −4 3 R3 − 53 R1
3 2 −4 3 R3 + 19 R
3 2 −4 3
1
2 3 3 15 −−−−2−→ 0 53
17
3
13 −−−−5−→ 0 35 17 3
13
5 −3 1 14 R2 − 3 R1 0 − 19 23
9 0 0 5 146 292
3 3
5
5
R
3 2 −4 3 3 2 −4 3 1 R
146 3 R2 +17R3 2 R1 −2R2 R1 +4R2
−−−→ 0 5 17 39 −−−−−→ 0
5 0 5 −5−→−− −−→−−−−→
3R2
0 0 1 2 0 0 1 2
3 0 0 9 1R 1 0 0 3
1
0 1 0 1 −3−→ 0 1 0 1
0 0 1 2 0 0 1 2
System has a unique solution x1 = 3, x2 = 1, x3 = 2.
The associate homogeneous system is
3x1 + 2x2 − 4x3 = 0
2x1 + 3x2 + 3x3 = 0
5x1 − 3x2 + x3 = 0
Using the same row operations, we obtain
3 2 −4 0 1 0 0 0
2 3 3 0 −→ 0 1 0 0 .
5 −3 1 0 0 0 1 0
19s 9s
A general solution for the homogeneous system is a = − − 3s, b = 2
,c = 2
,d =
s, s ∈ R.
2. Reduce the following matrix to its reduced row echelon form using Gaussian and Gauss-
Jordan elimination.
2 6 5 0
1 0 4 0
1 4 5 0
Could the number of operations be reduced if we do not insist on using Gaussian or
Gauss-Jordan elimination?
Solution:
2 6 5 0 R − R11 2 6 5 0 R3 + 13 R2
2 6 10 0 R − 5 R3
1 0 4 0 −−3−−2−→ 0 −3 3 0 −−−−−→ 0 −3 3
0 −−1−−3−→
2 2
R2 − 12 R1 R2 − 12 R3
1 4 5 0 0 1 25 0 0 0 3 0
1
2 6 0 0 2 0 0 0 R
2 1 1 0 0 0
0 −3 0 0 − R1 +2R2 −− −→
−−−→ 0 −3 0 0 − 13 R2 0 1 0 0
0 0 3 0 0 0 − 31 0 1
3 3
R 0 0 1 0
Especially since we solving a linear system, we could stop after the 6th operation.
Solution:
a 0 b 2 a 0 b 2
a a 4 4 → 0 a 4 − b 2 .
0 a 2 b 0 0 b−2 b−2
The cases to consider are when b = 2 or not, and a = 0 or not. Case 1: b ̸= 2.
a 0 b 2 a 0 0 2−b
→ 0 a 4 − b 2 → 0 a 0 b − 2
0 0 1 1 0 0 1 1
If a = 0, system is inconsistent. If a ̸= 0, system has a unique solution.
Case 2: b = 2.
a 0 2 2
→ 0 a 2 2 .
0 0 0 0
If a = 0, then system has infinitely many solutions with two parameter. If a ̸= 0, then
system has infinitely many solution with one parameter.
(a) a = 0 and b ̸= 2;
(b) a ̸= 0 and b ̸= 2;
(c) a ̸= 0 and b = 2;
(d) a = 0 and b = 2.
4. (Application) When chemical compounds are combined under the right conditions,
the atoms in their molecules rearrange to form new compounds. This is represented by
a chemical equation. For example, the when methane burns, the methane (CH4 ) and
stable oxygen (O2 ) react to form carbon dioxide (CO2 ) and water (H2 O). The chemical
equation is
CH4 + O2 −→ CO2 + H2 O
A chemical equation is said to be balanced if for each type of atom in the reaction,
the same number of atoms appears on each side of the arrow. We can balance the
equation by letting x1 , x2 , x3 , and x4 to be the number of methane, stable oxygen,
carbon dioxide, and water molecule, that is,
x1 CH4 + x2 O2 −→ x3 CO2 + x4 H2 O
Note that the system will always have infinitely many solutions. Why?
x1 CO2 + x2 H2 O −→ x3 C6 H12 O6 + x4 O2
x1 − 6x3 =0
2x1 + x2 − 6x3 − 2x4 = 0
2x2 − 12x3 =0
Solution: From
x1 Fe2 O3 + x2 Al −→ x3 Al2 O3 + x4 Fe
we obtain the following homogeneous linear system
2x1 − x4 = 0
3x1 − 3x3 =0
x2 − 2x3 =0
x3 x4 x5
400 D x6 E x7 F 450
x1 + x3 = 800
x1 − x2 + x4 = 200
x2 − x5 = 500
x3 + x6 = 750
− x4 − x6 + x7 = −600
x5 − x7 = −50
1 0 0 0 0 −1 0 50
0
1 0 0 0 0 −1 450
0 0 1 0 0 1 0 750
In fact, the RREF is , which shows that we need
0
0 0 1 0 1 −1 600
0 0 0 0 1 0 −1 −50
0 0 0 0 0 0 0 0
2 parameters.
(c) Can the road between junction A and B be closed for construction while still
keeping the traffic flowing on the other streets? Explain.
T1 T2
600 C 400 C
T3 T4
00 C
We now construct the linear system to estimate the temperatures. The points at which
we need the temperatures of the plate for this model are indicated by the dots in the
figure above. To obtain linear equations involving the unknowns Ti , i = 1, 2, 3, 4, we
use our averaging rule, for example,
60 + 100 + T2 + T3
T1 = ⇒ 4T1 − T2 − T3 = 160.
4
(a) Write down three other linear equations, by considering T2 , T3 and T4 .
(b) Solve the linear system. Is it possible to have more than one solution?
Food for thought: Is it possible for the system to be inconsistent?
Solution:
(a)
T1 + 100 + 40 + T4
T2 = ⇒ −T1 + 4T2 − T4 = 140
4
60 + T1 + T4 + 0
T3 = ⇒ −T1 + 4T3 − T4 = 60
4
T3 + T2 + 40 + 0
T4 = ⇒ −T2 − T3 + 4T4 = 40.
4
(b) The augmented matrix for this linear system is
4 −1 −1 0 160
−1 4 0 −1 140
−1 0 4 −1 60
0 −1 −1 4 40
Solving the system above, we have T1 = 65o , T2 = 60o , T3 = 40o and T4 = 35o .
The system has a unique solution.
Supplementary Problems
7. (MATLAB)
(a) Consider, once again, the perfectly insulated square plate from Problem 6, with
its interior mesh altered, as shown below.
100◦
60◦ 40◦
T
0◦
Directly applying the averaging rule from Problem 5, estimate the temperature
T of the central node.
(b) We might notice that our temperature values vary according to how finely or
coarsely we dissect the metal plate into its interior nodes. To more accurately
estimate the temperature at precise points on the plate, we produce a finer interior
mesh, as shown below.
100◦
T1 T2 T3
60◦ 40◦
T4 T5 T6
T7 T8 T9
0◦
i. Set up a linear system in nine equations that will allow us to find the temper-
atures T1 through T9 of the interior nodes. Express your answer as a matrix
equation Ax = b, where x is the column matrix whose entries are given by
T1 , . . . , T9 .
ii. Use MATLAB to solve the linear system. Note that T5 corresponds to the
temperature at the central node of the plate. How does this compare to the
temperature at the central node you obtained from part (a)?
Solution: Directly applying the averaging rule, the temperature T is given by
100 + 60 + 40 + 0 200
T = = = 50◦ .
4 4
We can use MATLAB to solve this massive linear system. To begin, we create the
matrix A—typing in each of the 81 digits is fairly taxing, so we will try to use some of
MATLAB’s commands to help us create the matrix. We observe that we can decompose
the matrix into three, more manageable matrices according to the diagonal / off-
diagonal entries of A:
• To create a square matrix of order 9 whose main diagonal only contains 4’s,
>> X = diag(4*ones(1,9))
• To create a square matrix of order 9 whose off-diagonal entries immediately above
and below the main diagonal consist of the string −1, −1, 0, −1, −1, 0, −1, −1,
>> Y1 = diag([-1,-1,0,-1,-1,0,-1,-1],1)
>> Y2 = diag([-1,-1,0,-1,-1,0,-1,-1],-1)
>> Y = Y1 + Y2
• To create a square matrix of order 9 whose entries on the third diagonals above
and below the main diagonal only contain −1’s,
>> Z = diag(-1*ones(1,6),3)+ diag(-1*ones(1,6),-3)
Thus, the desired matrix A is given by the sum of the matrices we’ve just created,
after which we can create the column matrix b as well:
>> A = X + Y + Z
>> b = [160; 100; 140; 60; 0; 40; 60; 0; 40]
We can thus solve the linear system Ax = b by row-reducing the augmented matrix
(A | b), which we can do by concatenating the two matrices we’ve just created.
We find that the left-hand side of the augmented matrix reduces to the identity matrix
of order 9; in particular,
T1 = 71.4286◦
71.4286
71.4286
T2 = 71.4286◦
64.2857
T3 = 64.2857◦
54.2857
T4 = 54.2857◦
rref (A | b) =
I9 50.0000
=⇒ T5 = 50.0000◦ .
45.7143
T6 = 45.7143◦
35.7143
T7 = 35.7143◦
28.5714 T8 = 28.5714◦
28.5714 T9 = 28.5714◦
Note that in the discrete formulation of the temperature distribution problem, the
temperature at the central node remains identical to the answer we arrived at in the
previous part.