You are on page 1of 19

MA111 SOLUTIONS ASSIGNMENT 2

PART I: Theoretical Problems (Total: 130 Marks)

1 [20 MARKS]
Consider the system of linear equations
10y 4z + w = 1
x + 4y z + w = 2
3x + 2y + z + 2w = 5
2x 8y + 2z 2w = 4
x 6y + 3z

= 1

(a) Obtain the reduced row-echelon form of the augmented matrix.

4 1 1 | 2 R1 R2

10 4 1 | 1

2 1 2 | 5

8 2 2 | 4

1 6 3 0 | 1

4 1 1 | 2

10 4 1 | 1

10 4 1 | 1
3R1 + R3 R3

0 0 0|

0
2R1 + R4

R1 + R5 R5

0 10 4 1 | 1

1 4 1 1 | 2

R4

1
52 10

1
10

10 4 1 | 1
0 0 0 | 0

0 10 4 1 | 1

R2/10

R2

4 1 1 | 2

1 52

1
10

1
10

0 0 0 | 0
0 0 0 | 0

00 0 0 | 0

3
5

1 52

3
5

8
5

1
10

1
10

10R2 + R3

10R2 + R4

0 0 0 | 0
0 0 0 | 0

00 0 0 | 0

R3
R4

10R2 + R5 R5

4R2 + R1

R1

(b) Use Mathematica's command RowReduce to obtain the reduced rowechelon form and hence check that your answer in (a) is correct. [See
attached Mathematica document.]
(c) Use the Gauss-Jordan elimination to solve the system.
Solution. From the reduced row-echelon form of the augmented matrix,
we have
3
8
1
1
3
2
x + z + w = and y z + w =
5
5
5
5
10
10
There are three unknowns and two equations. This means there are innitely many solutions. Thus, let w = r R and z = s R. Then, we
have the solutions
3
1
2
1
3
8
r+ s ,
r + s , s, r
(x, y, z, w) =
5
5
5
10
5
10


(d) Use Mathematica's command LinearSolve to directly solve the system


and hence check that your answer in (c) is correct.
Solution. If r = s = 0, then we have the Mathematica output.
[10 + 3 + 4 + 3 = 20]

2 [20 MARKS]
Consider the system:
x + 2y

3z = 4

3x y +

5z = 2

4x + y + (a2 14)z = a + 2

marks

(a) Which value(s) of a will the system have: (i) No solutions? (ii) Exactly
one solution? (iii) Innitely many solutions?
Solution. By Gaussian elimination, we have:

1 2

4 1 a2 14 | a + 2

14

| 10

3R1 + R2

R2

0 7 a2 2 | a 14 4R1 + R3 R3

10
7

R2/7 R2

(1)

0 0 (a 4)(a + 4) | a 4 7R2 + R3 R3

The reduced row-echelon form is:

00|

8
7

10|

10
7

001|

Thus

1
a+4

2
a+4

1
a+4

1 10
2
1
8

,
+
,
7 a+4 7
a+4 a+4
(i) There are no solutions if a = 4. (ii) There is exactly one solution if
a 6= 4. (iii) There are innitely many solutions if a = 4. This can be
deduced from matrix (1), where, if a = 4, then the last row is a row of
(x, y, z) =

zeros.
(b) For part (iii), with a value of a you found, plot the three equations in
3-dimensional space in one diagram using Plot3D command for values of
x, y [5, 5]. Your graphs should all meet along a line in 3-D space. Get
the best possible view by rotating the diagram and submit that view.
(See attached Mathematica document.)
[6 + 6 + 6 + 2 = 20]

marks

3 [40 MARKS]
For each of the systems below;
(1) Use the Gauss-Jordan Elimination to derive the inverse of the coecient
matrix.
(2) Use the Mathematica's command Inverse to check your answer in (a).
(3) Use the inverse matrix to conclude whether (a) there is exactly one solution, or (b) there are innitely many or no solutions. Give your reasons.
(i)
2b + 3c = 1
3a + 6b 3c = 2
6a + 6b + 3c = 5
[15 + 3 + 2 = 20]

Solution.
(1) Reducing the matrix

2 3 | 1 0 0
6 3 | 0 1

6 6

3 |001

by the Gauss-Jordan elimination, we get

0 2 |0

13

1
3

1 32 | 0

1
3

16

00 0 |1

2
3

13

marks

(2)

Since we cannot have the form [I|A1 ], the coecient matrix, A, does not have
an inverse.

(2) Mathematica shows that A is singular. See notebook attached.


(3) It is clear from the matrix (2) that there are innitely many solutions
because the last row of the row-echelon form of A contains only zeros.

(ii)
x1 + x2 + 2x3 = 8
x1 2x2 + 3x3 = 1
3x1 7x2 + 4x3 = 10
[15 + 3 + 2 = 20]

Solution.

marks

(1) Reducing the matrix [A|I], that is,

1 2 | 1 0 0

2 3 | 0 1

3 7 4 | 0 0 1

by the Gauss-Jordan elimination, we get

00|

1
4

9
26

10|

1
4

1
5
26
52

001|

1
4

5
26

7
52

1
52

(3)

Since we have the form [I|A1 ], the coecient matrix, A, has the inverse

1
4

9
26

1
4

1
5
26
52

1
4

5
26

7
52

1
52

(2) Mathematica shows the same result. See notebook attached.


(3) It is clear from the matrix (3) that there is exactly one solution since A1
exists.

4 [50 MARKS]
Consider the following system
2x1

= 4

2x1 + x2 x3

= 4

6x1 + 2x2 + x3

= 15
x4 = 1

(a) Via the Gauss-Jordan elimination, nd a sequence of elementary matrices


whose product is the coecient matrix A.

SOLUTION

1 0 0 0 R1/2 R1

2 1 1 0

A1 =

6 2 1

0 0 0 1

E1 =

1/2 0 0 0 2 0 0 0

0 1 0 0 2 1 1 0

E1 A =

0 01

0 001

6 2 1

0 0 0 1

1 0 0

0 1 1 0 2R1 + R2 R2

A2 =

6 2 1

0 0 0 1

E2 E1 A = E2 A1 =

0 01

0 001

6 2 1

= A1

1 0 0 0

2 1 0 0

1 0 0 0

2 1 0 0

E 1 =
E2 =

0 0 1 0
0 0 1 0

0 1 0
6 2 1

0001

0 0 0 1

0 0 0 1 0 0 0

1 0 0
2 1 1 0

0001

E11 =

0 0 1

1 0 0 0

2 1 1 0

0001

2 0 0 0

0 1 0 0

1/2 0 0 0

0 1 0 0

0 0 0 1

0 0

2 1

1 1 0

0 0 0 1

0 001

= A2

A3 =

0 0

1 1 0

2 1

0 0 0 1

6R1 + R3

E3 =
R3

0 0 0

1 0 0

01

E31 =

0 001

0 0 0

1 0 0

0 1 0

0001

E3 E2 E1 A = A3

A4 =

0 0

1 1 0

0 3

0 0 0 1

2R2 + R3

E4 =
R3

0 0 0

1 0 0

2 1

E41 =

0 0 0

1 0 0

0001

0 0 01

E4 E3 E2 E1 A = A4

A5 =

0 0

1 1 0

0 1

0 0 0 1

R3/3

E5 =
R3

0 0 0

1 0 0

1
3

0001

E51 =

0 0 0

1 0 0

0 3 0

0001

E5 E4 E3 E2 E1 A = A5

A6 =

1 0 0 0

0 1 0 0

1 1 0

0 1

0 0 0 1 R3 R3

E6 =

01 0

1 0 0 0

1 0 0 0

0 1 0 0

E61 =

0 0 1 0

1 0 0 0

0 1 1 0

0 0 0 1

0 0 0 1

E6 E5 E4 E3 E2 E1 A = A6

1 0 0 0

0 1 0 0 R3 + R2 R2

A7 =

0 0 1 0

0001

1 0 0 0

0 1 1 0

E 1 =
E7 =

0 0 1 0
0 0 1 0

0001

00 0 1

E7 E6 E5 E4 E3 E2 E1 A = A7 = I

(b) Use the elementary matrices to nd A1 . Check you answer using Mathematica.

Solution.

E7 E6 E5 E4 E3 E2 E1 A = I E7 E6 E5 E4 E3 E2 E1 = A1

2 1 0

Indeed, we have (see Mathematica le):

1
2

2
3

E7 E6 E5 E4 E3 E2 E1 =

0 0 0

1 1
0

3 3

23 31

0 0 1

Using Mathematica's Inverse[A] yields the same answer.


(c) Use A1 you found in (b) to solve the system. Check you answer using
Mathematica.

Solution

x = A1 b =

2
3

0 0 0 4

1 1
0
4
3 3

32 13

0 0 1

1
2

15

2


1


1

Using Mathematica's LinearSolve[A,b] yields the same answer.


(d) Find an LU -factorization of A.

Solution. From (a), it is clear that

U = A4 =

0 0

0 3

1 1 0

0 0 0 1

Thus, A = E11 E21 E31 E41 U , so that

2 0 0 0

2 1 0 0

L = E11 E21 E31 E41 =

6 21

0 001

(e) Solve the system using the LU -factorization method. Check that your
answer coincides with your answer in (c).
8

Solution. Let y = (y , y , y , y ). Then Ly = b yields


1

2 0 0 0 y1

2 1 0 0 y2

6 21

15




0
y3

0 001

y4

or
2y1

= 4

2y1 + y2

= 4

6y1 + 2y2 + y3

= 15
y4 = 1

from which y = (y1 , y2 , y3 , y4) = (2, 0, 3, 1). Then solving Ux = y yields

0 x1


1 1 0
x2
0 0

0 3


0
x3

0 0 0 1

x4

or
x1

= 2
x2 x3

= 0

3x3

= 3

x4 = 1

from which x = (x1 , x2 , x3 , x4 ) = (2, 1, 1, 1).

[10 marks each]


PART II Applied Problems (Total: 70 Marks)

5 Predictive Modeling [15 MARKS]


Read Problem 17, page 32, of our textbook Elementary Linear Algebra by
Larson, 7th Edition.
(1) Derive the polynomial and predict the population in 2020 and 2030.
9

Solution. Let Year 0 be 1990. Then Year 10 is 2000, Year 20 is 2010,

Year 30 is 2020 and Year 40 is 2030. We want to t the polynomial


p = a0 + a1 t + a2 t2 , t 0

where t is in years, and p is in millions, through the points,


(t, p) = (0, 249), (10, 281), (20, 309)

Thus, we have a system of linear equations


a0

= 249

a0 + 10a1 + 100a2 = 281


a0 + 20a1 + 400a2 = 309

or, since a0 = 249, we have simply


10a1 + 100a2 = 281 249 = 32
20a1 + 400a2 = 309 249 = 60

This is simple to solve to get (a1 , a2 ) = (17/5, 1/50). Thus, the polynomial is

1
17
t t2 , t 0
5
50
Thus, in 2020, that is, after t = 30 years, the population will be p(30) =
333 million, and in 2030, that is, after t = 40years, p(40) = 353 million.
p(t) = 249 +

(2) Use Mathematica to plot the polynomial and extend it to include the
years up to 2030.

p
400
300
200
100
0
0

10

20

30

40

Here t = 0, 10, 20, 30, 40 represent 1990, 2000, 2010, 2020 and 2030, respectively.

[10 + 5 = 15] marks


10

6 Network Analysis [15 MARKS]


Do Problem 30, page 33, of the textbook.

Solution. The system of linear equations is


x1 x2
x1

= 400
+x3 x4

x2 +x3

= 600
+x5 = 300

x4 +x5 = 100

The augmented matrix is

1 0 0 0 | 400

0 1 1 0 | 600

1 1 0 1|

300

0 0 0 1 1 | 100

By Gauss-Jordan elimination, we have the reduced row-echelon form

1 0 1 0 1 | 700

0 1 1 0 1 | 300

0 0 1 1 | 100

00000| 0

from which
x1 + x3 + x5 = 700
x2 + x3 + x5 = 300
x4 + x5

= 100

(a) From the last row of the matrix, which has all zero entries, we know there
are innitely many solutions. Now, let x5 = s, s R, and x3 = r, r R.
Then we have the solutions of the form
(x1 , x2 , x3 , x4 , x5 ) = (700 [r + s], 300 [r + s], r, 100 s, s)

(b) If x3 = 0 and x5 = 100, then


(x1 , x2 , x3 , x4 , x5 ) = (600, 200, 0, 0, 100)

11

(c) If x3 = 100 and x5 = 100, then


(x1 , x2 , x3 , x4 , x5 ) = (500, 100, 100, 0, 100)

[15 marks]
7 Encryption [40 MARKS]
Read Example 5 (page 88) and Example 6 (page 89). Repeat the same examples, but use a dierent 3 3 invertible matrix, A. Will you get the same
message?

Solution. Any 3 3 invertible matrix, A, will produce the same message.


[20 + 20 = 40] marks
END OF ASSIGNMENT

12

Assignment 2 Solutions
Part I

Question 1
A = 880, 10, - 4, 1<, 81, 4, - 1, 1<, 83, 2, 1, 2<, 8- 2, - 8, 2, - 2<, 81, - 6, 3, 0<<;
Ab = 880, 10, - 4, 1, 1<, 81, 4, - 1, 1, 2<,
83, 2, 1, 2, 5<, 8- 2, - 8, 2, - 2, - 4<, 81, - 6, 3, 0, 1<<;
b = 81, 2, 5, - 4, 1<;
MatrixForm@AbD

0 10 - 4 1 1
1 4 -1 1 2
3 2 1 2 5
-2 -8 2 -2 -4
1 -6 3 0 1
MatrixForm@RowReduce@AbDD
MatrixForm@LinearSolve@A, bDD
1 0
0 1
0 0
0 0
0 0

3
5
2
-5

3
5
1
10

8
5
1
10

0
0
0

0
0
0

0
0
0

8
5
1
10

0
0

Question 2
Ab = 881, 2, - 3, 4<, 83, - 1, 5, 2<, 84, 1, a ^ 2 - 14, a + 2<<;
MatrixForm@AbD
1 2
-3
4
3 -1
5
2
4 1 - 14 + a2 2 + a

MatrixForm@RowReduce@AbDD
1 0 0
0 1 0
0 0 1

8
1
- 4+a
7
10
2
+ 4+a
7
1
4+a

ASS_02_PART_I.nb

Plot3D@8HHx + 2 yL - 4L 3, H2 - H3 x - yLL 5, H6 - H4 x + yLL 2<, 8x, - 5, 5<, 8y, - 5, 5<D


5

-5

10

-10
-5
0
5

Question 3 (i)
AI = 880, - 2, 3, 1, 0, 0<, 83, 6, - 3, 0, 1, 0<, 86, 6, 3, 0, 0, 1<<;
MatrixForm@AID
MatrixForm@RowReduce@AIDD
0 -2 3 1 0 0
3 6 -3 0 1 0
6 6 3 0 0 1
1 0

0 -3

1
3
2
3

0 1 -2 0
0 0

1
3
1
-6
1
-3

A = 880, - 2, 3<, 83, 6, - 3<, 86, 6, 3<<;


Inverse@AD

Inverse::sing : Matrix 880, -2, 3<, 83, 6, -3<, 86, 6, 3<< is singular.

Inverse@880, - 2, 3<, 83, 6, - 3<, 86, 6, 3<<D

Question 3 (ii)
AI = 881, 1, 2, 1, 0, 0<, 8- 1, - 2, 3, 0, 1, 0<, 83, - 7, 4, 0, 0, 1<<;
MatrixForm@AID
MatrixForm@RowReduce@AIDD
1 1 2 1 0 0
-1 -2 3 0 1 0
3 -7 4 0 0 1
1 0 0
0 1 0
0 0 1

1
4
1
4
1
4

- 26
1

- 26
5
26

7
52
5
- 52
1
- 52

ASS_02_PART_I.nb

A = 881, 1, 2<, 8- 1, - 2, 3<, 83, - 7, 4<<;


MatrixForm@Inverse@ADD
1
4
1
4
1
4

- 26
1

- 26
5
26

7
52
5
- 52
1
- 52

Question 4
A = 882, 0, 0, 0<, 8- 2, 1, - 1, 0<, 86, 2, 1, 0<, 80, 0, 0, - 1<<;
b = 84, - 4, 15, - 1<;
MatrixForm@AD
MatrixForm@bD
2
-2
6
0

0 0 0
1 -1 0
2 1 0
0 0 -1

4
-4
15
-1

E1 = 881 2, 0, 0, 0<, 80, 1, 0, 0<, 80, 0, 1, 0<, 80, 0, 0, 1<<;


A1 = E1.A;
MatrixForm@A1D
1
-2
6
0

0 0 0
1 -1 0
2 1 0
0 0 -1

E2 = 881, 0, 0, 0<, 82, 1, 0, 0<, 80, 0, 1, 0<, 80, 0, 0, 1<<;


A2 = E2.E1.A;
MatrixForm@A2D
1
0
6
0

0 0 0
1 -1 0
2 1 0
0 0 -1

1
0
0
0

0 0 0
1 -1 0
2 1 0
0 0 -1

E3 = 881, 0, 0, 0<, 80, 1, 0, 0<, 8- 6, 0, 1, 0<, 80, 0, 0, 1<<;


A3 = E3.E2.E1.A;
MatrixForm@A3D

ASS_02_PART_I.nb

E4 = 881, 0, 0, 0<, 80, 1, 0, 0<, 80, - 2, 1, 0<, 80, 0, 0, 1<<;


A4 = E4.E3.E2.E1.A;
MatrixForm@A4D
1
0
0
0

0 0 0
1 -1 0
0 3 0
0 0 -1

1
0
0
0

0 0 0
1 -1 0
0 1 0
0 0 -1

1
0
0
0

0 0
1 -1
0 1
0 0

1
0
0
0

0
1
0
0

E5 = 881, 0, 0, 0<, 80, 1, 0, 0<, 80, 0, 1 3, 0<, 80, 0, 0, 1<<;


A5 = E5.E4.E3.E2.E1.A;
MatrixForm@A5D

E6 = 881, 0, 0, 0<, 80, 1, 0, 0<, 80, 0, 1, 0<, 80, 0, 0, - 1<<;


A6 = E6.E5.E4.E3.E2.E1.A;
MatrixForm@A6D
0
0
0
1

E7 = 881, 0, 0, 0<, 80, 1, 1, 0<, 80, 0, 1, 0<, 80, 0, 0, 1<<;


A7 = E7.E6.E5.E4.E3.E2.E1.A;
MatrixForm@A7D
0
0
1
0

0
0
0
1

MatrixForm@Inverse@E1D.Inverse@E2D.
Inverse@E3D.Inverse@E4D.Inverse@E5D.Inverse@E6D.Inverse@E7DD
2
-2
6
0

0 0 0
1 -1 0
2 1 0
0 0 -1

MatrixForm@E7.E6.E5.E4.E3.E2.E1D
1
2
2
-3
5
-3

1
3
2
-3

1
3
1
3

0
0
0

0 -1

MatrixForm@Inverse@ADD
1
2
2
-3
5
-3

1
3
2
-3

1
3
1
3

0
0
0

0 -1

ASS_02_PART_I.nb

MatrixForm@Inverse@AD.bD
2
1
1
1
MatrixForm@LinearSolve@A, bDD
2
1
1
1

LU Factorization of A
L = Inverse@E1D.Inverse@E2D.Inverse@E3D.Inverse@E4D;
MatrixForm@LD
2
-2
6
0

0
1
2
0

0
0
1
0

0
0
0
1

MatrixForm@L.A4D
2
-2
6
0

0 0 0
1 -1 0
2 1 0
0 0 -1

y = 8y1, y2, y3, y4<;


MatrixForm@L.yD
2 y1
- 2 y1 + y2
6 y1 + 2 y2 + y3
y4

MatrixForm@bD
4
-4
15
-1
ysol = LinearSolve@L, bD
82, 0, 3, - 1<

x = 8x1, x2, x3, x4<;


MatrixForm@A4.xD
x1
x2 - x3
3 x3
- x4

xsol = LinearSolve@A4, ysolD


82, 1, 1, 1<

Assignment 2 Solutions
Part II

Question 5
A = 8810, 100<, 820, 400<<;
b = 832, 60<;
LinearSolve@A, bD
:

17

,5

50

>

17

p@t_D := 249 +

1
t -

t2 ;

50

p@30D
p@40D
333
353
Plot@p@tD, 8t, 0, 40<, LabelStyle Directive@LargeD,
PlotRange 880, 41<, 80, 400<<, GridLines Automatic, AxesLabel 8"t", "p"<D

p
400
300
200
100
0
0

10

20

30

40

ASS_02_PART_II.nb

Question 6
A = 881, - 1, 0, 0, 0<, 81, 0, 1, - 1, 0<, 80, 1, 1, 0, 1<, 80, 0, 0, 1, 1<<;
b = 8400, 600, 300, 100<;
Ab = 881, - 1, 0, 0, 0, 400<,
81, 0, 1, - 1, 0, 600<, 80, 1, 1, 0, 1, 300<, 80, 0, 0, 1, 1, 100<<;
MatrixForm@AD
MatrixForm@bD
MatrixForm@AbD
1 -1
1 0
0 1
0 0

0 0
1 -1
1 0
0 1

0
0
1
1

0 0
1 -1
1 0
0 1

0
0
1
1

400
600
300
100
1 -1
1 0
0 1
0 0

400
600
300
100

MatrixForm@RowReduce@AbDD
1
0
0
0

0
1
0
0

1
1
0
0

0
0
1
0

1 700
1 300
1 100
0 0

TeXForm@%D
\left(
\begin{array}{cccccc}
1 & 0 & 1 & 0 & 1 & 700 \\
0 & 1 & 1 & 0 & 1 & 300 \\
0 & 0 & 0 & 1 & 1 & 100 \\
0 & 0 & 0 & 0 & 0 & 0 \\
\end{array}
\right)
LinearSolve@A, bD
8700, 300, 0, 100, 0<

You might also like