0% found this document useful (0 votes)
9 views

Tutorial 1 Solution

The document is a tutorial for a Linear Algebra course at the National University of Singapore, focusing on solving linear systems using Gaussian and Gauss-Jordan elimination. It includes multiple problems with solutions, discussing unique, infinite, and inconsistent solutions based on parameter values. Additionally, it applies linear algebra concepts to chemical equations and traffic flow problems.

Uploaded by

Lim Jia Le
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Tutorial 1 Solution

The document is a tutorial for a Linear Algebra course at the National University of Singapore, focusing on solving linear systems using Gaussian and Gauss-Jordan elimination. It includes multiple problems with solutions, discussing unique, infinite, and inconsistent solutions based on parameter values. Additionally, it applies linear algebra concepts to chemical equations and traffic flow problems.

Uploaded by

Lim Jia Le
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

NATIONAL UNIVERSITY OF SINGAPORE

Department of Mathematics

MA1508E Linear Algebra for Engineering Tutorial 1

1. For each of the following linear systems,


(i) solve it using Gaussian Elimination or Gauss-Jordan Elimination;
(ii) write down the associated homogeneous system and solve it.
(Make sure you are able to perform the necessary elementary row operations without
the help of MATLAB.)
(a) 
 3x1 + 2x2 − 4x3 = 3
2x1 + 3x2 + 3x3 = 15
5x1 − 3x2 + x3 = 14

(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

It has only the trivial solution.

(b) The reduced row-echelon form of the augmented matrix is


 
1 0 0 3 −2
 0 1 0 − 19 2  .
2
0 0 1 − 92 0
19s 9s
So a general solution to the system is a = −2 − 3s, b = 2 + 2
,c = 2
,d = s,
s ∈ R.
The associated homogeneous system is

 a + b − c − 2d = 0
2a + b − c + d = 0
−a + b − 3c + d = 0

19s 9s
A general solution for the homogeneous system is a = − − 3s, b = 2
,c = 2
,d =
s, s ∈ R.

(c) The linear system is inconsistent. Its reduced row-echelon form is


 
1 0 −2/3 0
 0 1 −2/3 0  .
0 0 0 1

The associated homogeneous system is



 x − 4y + 2z = 0
x + 2y − 2z = 0
x − y = 0

It has a general solution x = 23 s, y = 23 s, z = 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

We can reduce the number of operations. For example,


     
2 6 5 0 0 6 −3 0 0 18 0 0
R1 −2R2 R1 +3R3
 1 0 4 0  −−−−→  1 0 4 0  −−−−→  1 0 4 0 
R3 −R2
1 4 5 0 0 4 1 0 0 4 1 0
     
1
R
0 1 0 0 0 1 0 0 0 1 0 0
18 1 R3 −4R1 R2 −4R3
−−−→  1 0 4 0  −−−−→  1 0 4 0  −−−−→  1 0 0 0 
0 4 1 0 0 0 1 0 0 0 1 0
 
1 0 0 0
R ↔R2
−−1−−→  0 1 0 0 .
0 0 1 0

Especially since we solving a linear system, we could stop after the 6th operation.

3. Determine the values of a and b so that the linear system



 ax + bz = 2
ax + ay + 4z = 4
ay + 2z = b

(a) has no solution;


(b) has only one solution;
(c) has infinitely many solutions and a general solution has one arbitrary parameter;
(d) has infinitely many solutions and a general solution has two arbitrary parameters.

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

From it we obtain the following homogeneous linear system


x1 − x3 =0
4x1 − 2x4 =0
2x2 − 2x3 − x4 =0
The smallest positive integer values solution of the system will give us the balanced
equation for combustion of methane

CH4 + 2O2 −→ CO2 + 2H2 O

Note that the system will always have infinitely many solutions. Why?

Write the balanced equation for the given chemical reactions


(a) CO2 + H2 O −→ C6 H12 O6 + O2
Solution: From

x1 CO2 + x2 H2 O −→ x3 C6 H12 O6 + x4 O2

we obtain the following homogeneous linear system

x1 − 6x3 =0
2x1 + x2 − 6x3 − 2x4 = 0
2x2 − 12x3 =0

The reduced row-echelon form is


 
1 0 0 −1 0
 0 1 0 −1 0  .
0 0 1 −1/6 0

The general solutions is x1 = t, x2 = t, x3 = 16 t, x4 = t. The smallest possible


integer values occur when t = 6. Hence, x1 = 6, x2 = 6, x3 = 1, x4 = 6.

(b) Fe2 O3 + Al −→ Al2 O3 + Fe

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

The general solutions is x1 = 21 t, x2 = t, x3 = 12 t, x4 = t. The smallest possible


integer values occur when t = 2. Hence, x1 = 1, x2 = 2, x3 = 1, x4 = 2.

5. (Application, MATLAB) A network of one-way streets of a downtown section can


be represented by the diagram below, with traffic flowing in the direction indicated.
The average hourly volume of traffic entering and leaving this section during rush hour
is given in the diagram.

300 200 100


500 A x1 B x2 C 600

x3 x4 x5
400 D x6 E x7 F 450

350 600 400


(a) Do we have enough information to find the traffic volumes x1 , x2 , x3 , x4 , x5 , x6 ,
and x7 ?

Solution: No, there are 6 equations (junctions), but 7 unknowns.

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.

The general solution is x1 = 50 + s, x2 = 450 + t, x3 = 750 − s, x4 = 600 − s + t,


x5 = t − 50, x6 = s, x7 = t.

(b) Suppose x6 = 50 and x7 = 100. What is x1 , x2 , x3 , x4 , and x5 ?

Solution: x1 = 100, x2 = 550, x3 = 700, x4 = 650, x5 = 50.

(c) Can the road between junction A and B be closed for construction while still
keeping the traffic flowing on the other streets? Explain.

Solution: No, for in that case, x6 = −50, a contradiction.

6. (Application) A simple model for estimating the temperature distribution on a square


plate gives rise to a linear system of equations. To construct the appropriate linear
system, we use the following information: The square plate is perfectly insulated on
its top and bottom so that the only heat flow is through the plate itself. The four
edges are held at various temperatures. To estimate the temperature at an interior
point on the plate, we use the rule that it is the average of the temperature at its four
compass-point neighbours, to the west, north, east and south.
Suppose we wish to estimate the temperatures Ti , i = 1, 2, 3, 4, at the four equispaced
interior points on the plate as shown in the figure below.
1000 C

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 now set up an equation for each of the temperatures T1 through T9 :


100 + 60 + T2 + T4
T1 = ⇒ 4T1 − T2 − T4 = 160,
4
100 + T1 + T3 + T5
T2 = ⇒ −T1 + 4T2 − T3 − T5 = 100,
4
100 + T2 + 40 + T6
T3 = ⇒ −T2 + 4T3 − T6 = 140,
4
T1 + 60 + T5 + T7
T4 = ⇒ −T1 + 4T4 − T5 − T7 = 60,
4
T2 + T4 + T6 + T8
T5 = ⇒ −T2 − T4 + 4T5 − T6 − T8 = 0,
4
T3 + T5 + 40 + T9
T6 = ⇒ −T3 − T5 + 4T6 − T9 = 40,
4
T4 + 60 + T8 + 0
T7 = ⇒ −T4 + 4T7 − T8 = 60,
4
T5 + T7 + T9 + 0
T8 = ⇒ −T5 − T7 + 4T8 − T9 = 0,
4
T6 + T8 + 40 + 0
T9 = ⇒ −T6 − T8 + 4T9 = 40.
4
We may rewrite this system as a matrix equation Ax = b, where x is the column
matrix whose entries are given by T1 , . . . , T9 .
    
4 −1 0 −1 0 0 0 0 0 T1 160
 −1 4 −1 0 −1 0 0 0 0   T2   100 
    
 0 −1 4 0 0 −1 0 0 0   T3   140 
    
 −1 0 0 4 −1 0 −1 0 0   T4   60 
    
 0 −1 0 −1 4 −1 0 −1 0   T5 = 0 .
    
 0
 0 −1 0 −1 4 0 0 −1   T6

 
  40 

 0
 0 0 −1 0 0 4 −1 0    T7
  
  60 

 0 0 0 0 −1 0 −1 4 −1  T8    0 
0 0 0 0 0 −1 0 −1 4 T9 40

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.

>‌> rref([A b])

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.

You might also like