NATIONAL UNIVERSITY OF SINGAPORE
Department of Mathematics
MA1508E Linear Algebra for Engineering Tutorial 2
1. (a) Suppose A is a square matrix such that A2 = 0. Show that I − A is invertible,
with inverse I + A.
(b) Suppose A3 = 0. Is I − A invertible?
(c) A square matrix A is said to be nilpotent if there is a positive integer n such that
An = 0. Show that if A is nilpotent, then I − A is invertible.
Solution:
(a) To show that I − A, suffice to check that it has a left inverse. Indeed,
(I − A)(I + A) = I2 − A2 = I.
(b) Substituting A into the polynomial identity (1 − x)(1 + x + x2 ) = 1 − x3 , we get
(I − A)(I + A + A2 ) = I − A3 = I.
(c) Substituting A into the polynomial identity (1−x)(1+x+x2 +· · ·+xn−1 ) = 1−xn ,
we get
(I − A)(I + A + · · · + An−1 ) = I − A3 = I.
So the inverse of I − A is (I + A + · · · + An−1 ).
Remark: The inverse could be derived from the formula for the sum of a geometric
progression,
n
X 1 − xn
xk−1 = ,
k=1
1 − x
Pn
which is equivalent to (1 − x) k=1 xk−1 = 1 − xn .
Extra: Show that every strictly upper or lower triangular matrix is nilpotent.
2. (i) Reduce the following matrices A to its reduced row-echelon form R.
(ii) For each of the elementary row operation, write the corresponding elementary
matrix.
(iii) Write the matrices A in the form E1 E2 . . . En R where E1 , E2 , . . . , En are elemen-
tary matrices and R is the reduced row-echelon form of A.
5 −2 6 0
(a) A = .
−2 1 3 1
−1 3 −4
(b) A = 2 4 1 .
−4 2 −9
1 −1 0
(c) A = 2 −2
1 .
1 2 3
Solution:
r1 :R2 + 2 R1 r2 : 1 R1 r :5R r4 :R1 + 2 R2
(a) (i) A −−−−−5−→−−−5−→−3−−→ 2
−−−−−5−→ R
1 2
1 0 0 1 0 1 5
(ii) E1 = 2 , E2 = 5 , E3 = , E4 = .
5
1 0 1 0 5 0 1
(iii)
1 − 25
1 0 5 0 1 0 1 0 12 2
A= .
− 25 1 0 1 0 51 0 1 0 1 27 5
1
1 r :R +2R
2 1 2 3 r :R −4R
1 3 r :R +R r :−R r5 : R2 r :R +3R
(b) (i) A −− −− −−→ −− −− −−→ −− −3−−→
2 4
−− 1
−−→ 10
−−− 6
−→−− 1
−− 2
−−→ R
1 0 0 1 0 0 1 0 0 −1 0 0
(ii) E1 = 2 1 0, E2 = 0 1 0, E3 = 0 1 0, E4 = 0 1 0,
0 0 1 −4 0 1 0 1 1 0 0 1
1 0 0 1 3 0
1
E5 = 0 10 0, E6 = 0 1 0.
0 0 1 0 0 1
(iii)
1 0 0 1 0 0 1 0 0 −1 0 0
A = −2 1
0 0 1 0 0 1 0 0 1 0
0 0 1 4 0 1 0 −1 1 0 0 1
0 19
1 0 0 1 −3 0 1 10
7
0 10 0 0 1 0 0 1 − 10 .
0 0 1 0 0 1 0 0 0
1 r :R −2R
2 1 2 r :R −R r :R ↔R r4 : 1 R2 r :R −R r :R +R
(c) (i) A −− −− −−→ −− −3−−→1 3
−− 2
−− 3
−−→ −−−3−→−−5
−2−−→
3 6
−− −1−−→
2
R
1 0 0 1 0 0 1 0 0 1 0 0
(ii) E1 = −2 1 0, E2 = 0 1 0, E3 = 0 0 1, E4 = 0 13 0,
0 0 1 −1 0 1 0 1 0 0 0 1
1 0 0 1 1 0
E5 = 0 1 −1 , E6 = 0 1 0.
0 0 1 0 0 1
(iii)
1 0 0 1 0 0 1 0 0 1 0 0
A = 2 1 0 0 1 0 0 0 1 0 3 0
0 0 1 1 0 1 0 1 0 0 0 1
1 0 0 1 −1 0 1 0 0
0 1 1 0 1 0 0 1 0
0 0 1 0 0 1 0 0 1
3. (Application) (Polynomial Interpolation)
Given any n points in the xy-plane that has distinct x-coordinates, it is known that
there is a unique polynomial of degree n − 1 or less whose graph passes through those
point. A degree n − 1 polynomial has the following expression
y = a0 + a1 x + a2 x2 + · · · + an−1 xn−1
Suppose its graph passes through the points (x1 , y1 ), (x2 , y2 ),...,(xn , yn ), it follows that
the coordinates of the points must satisfy
a0 + a1 x1 + a2 x21 + · · · + an−1 x1n−1 = y1
a0 + a1 x2 + a2 x22 + · · · + an−1 x2n−1 = y2
.. .. .. .. ..
. . . . .
2 n−1
a0 + a1 xn + a2 xn + · · · + an−1 xn = yn
This is a linear system in the unknowns a0 , a1 , ..., an−1 . The augmented matrix for the
system is
1 x1 x21 · · · xn−1 1 y 1
1 x2 x2 · · · xn−1 y2
2 2
(V)
.. .. .. .. .. ..
. . . . . .
1 xn x2n · · · xn−1
n yn
which has a unique solution whenever x1 , x2 , ..., xn are distinct.
(a) Find a cubic polynomial whose graph passes through the points
x 1 2 3 4
y 3 −2 −5 0
Solution: The augmented matrix is
1 1 1 1 3
1
2 4 8 −2
1 3 9 27 −5
1 4 16 64 0
Its RREF is
1 0 0 0 4
0 1 0 0 3
0 0 1 0 −5
0 0 0 1 1
So the cubic polynomial is x3 − 5x2 + 3x + 4.
(b) (MATLAB) The coefficient matrix of the linear system (V) is called a Vander-
monde Matrix. The function fliplr(vander(v)) returns the Vandermonde matrix
such that its rows are powers of the vector v. For example,
>> v=[1;2;3;4;5;6;7;8];
>> A=fliplr(vander(v))
will generate the following matrix
1 1 1 1 1 1 1 1
1 2 22 23 24 25 26 27
1 3 32 33 34 35 36 37
1 4 42 43 44 45 46 47
1 5 52 53 54 55 56 57
1 6 62 63 64 65 66 67
1 7 72 73 74 75 76 77
1 8 82 83 84 85 86 87
Use the Vandermonde matrix function to find a degree 7 polynomial that passes
through
x 1 2 3 4 5 6 7 8
y 12 70 1244 10500 54268 205682 630540 1657024
Solution: >> v=[1;2;3;4;5;6;7;8];
>> A=fliplr(vander(v))
>> b=[12;70;1244;10500;54268;205682;630540;1657024];
>> A\b OR >> rref([A b])
which gives a0 = 8, a1 = 7, a2 = −6, a3 = 5, a4 = −4, a5 = 3, a6 = −2, a7 = 1. Thus,
the polynomial is
x7 − 2x6 + 3x5 − 4x4 + 5x3 − 6x2 + 7x + 8
4. (Application) Electrical networks provides information about power sources, such as
batteries, and devices powered by these sources, such as light bulbs or motors. A power
source ‘forces’ a current of electrons to flow through the network, where it encounters
various resistors, each of which requires that a certain amount of force be applied in
order for the current to flow through it.
The fundamental law of electricity is Ohm’s law, which states exactly how much force
E is needed to drive a current I through a resistor with resistance R. Ohm’s law states
E = IR, in other words, force = current × resistance. Here, force is measured in volts,
resistance in ohms and current in amperes.
The following two laws (discovery due to Kirchhoff), govern electrical networks. The
first is a ‘conservation of flow’ law at each node; the second is a ‘balancing of votage’
law around each loop.
(Kirchoff ’s Current Law (KCL)) At each node, the sum of the currents flowing
into any node is equal to the sum of the currents flowing out of that node. For example,
in the diagram below, by KCL, we have I1 = I2 + I3 .
I2
I1
I3
(Kirchoff ’s Voltage Law (KVL)) In one traversal of any closed loop, the sum of
the voltage rises equals to the sum of the voltage drops.
In circuits with multiple loops and batteries there is usually no way to tell in advance
which way the currents are flowing, so the usual procedure in circuit analysis is to
assign arbitrary directions to the current flows in the branches and let the mathematical
computations determine whether the assignments are correct. In addition to assigning
directions to the current flows, Kirchoff’s Voltage Law requires a direction of travel for
each closed loop. The choice is arbitrary, but for the sake of consistency we will always
take this direction to be clockwise. We will also make the following conventions:
• A voltage drop occurs at a resistor if the direction assigned to the current through
the resistor is the same as the direction assigned in the loop, and a voltage rise
occurs at a resistor if the direction assigned to the current through the resistor is
the opposite to that assigned in the loop.
• A voltage rise occurs at a battery if the direction assigned to the loop is from −
to + through the battery, and a voltage drop occurs at a battery if the direction
assigned to the loop is from + to − through the battery.
If we follow these conventions when calculating currents, then those currents whose
directions were assigned correctly will have positive values and those whose direction
were assigned incorrectly will have negative values.
For each of the following circuits, use KCL and KVL to write down a linear system
with equations involving variables I1 , I2 , . . .. Solve the linear system by Gaussian Elim-
ination.
I1 I2
I3
5Ω 20 Ω 10 Ω
50 volts 30 volts
(a)
Solution: The linear system is
I1 + I2 − I3 = 0
5I1 + 20I3 = 50
− 10I2 − 20I3 = 30
Solving by Gaussian elimination, we have I1 = 6, I2 = −5 and I3 = 1. So the
actual direction of the current I2 is in the opposite direction from what is shown
in the figure.
5 volts
I1 I1
1Ω
2Ω
I2 I2
4Ω
I3 I3
8 volts
(b)
Solution: The linear system is
I1 − I2 + I3 = 0
I1 + 2I2 = 5
2I2 + 4I3 = 8
Solving by Gaussian elimination, we have I1 = 1, I2 = 2, I3 = 1. So the actual
direction of all the currents are in the from direction as shown in the figure.
5. (MATLAB) A Wheatstone bridge is a special type of electrical circuit that can be
used to measure resistance. One such circuit is illustrated below.
I0
I1 I3
r1 r3
rg Ig
r2 r4
I2 I4
(a) The main application of Wheatstone bridges is in determining an unknown re-
sistance. In the diagram above, the resistance r4 is usually unknown, while the
resistances r1 , r2 , and r3 are known. If the current flowing through the resistor rg
is zero—that is, Ig = 0 amperes—find an expression for r4 in terms of r1 , r2 , and
r3 . (Hint: Begin by setting up a linear system in the unknowns I0 , I1 , I2 , I3 , I4 ,
and Ig .)
(b) Suppose that, in the Wheatstone bridge illustrated above, the battery supplies
10 volts to the circuit. Moreover, suppose that the five resistance values are
known: r1 = 5 Ω, r2 = 10 Ω, r3 = 2 Ω, r4 = 4 Ω, and rg = 50 Ω. Determine the
currents I0 , . . . , I4 , and show that Ig = 0 amperes. What can you say about the
relationship between r1 , r2 , r3 and r4 ?
Solution:
(a) We set up a linear system in the unknown currents for a general Wheatstone
bridge. Applying Kirchhoff’s Current Law at the four nodes, we obtain the
equations
I0 − I1 − I3 = 0,
I1 − I2 − Ig = 0,
I3 − I4 + Ig = 0,
−I0 + I2 + I4 = 0.
Applying Kirchhoff’s Voltage Law to the two larger loops (involving I0 ), as well
as the two smaller loops on the right, we have
r1 I1 + r2 I2 = V,
+ r3 I3 + r4 I4 = V,
r1 I1 − r3 I3 + rg Ig = 0,
− r2 I2 r4 I4 + rg Ig = 0,
where V is the voltage due to the battery.
We now consider the case when Ig = 0. It suffices to consider the equations
involving Ig , which yields the system
I1 − I2 = 0
I3 − I4 = 0
.
r
1 1
I − r3 I3 = 0
− r2 I2 r4 I4 = 0
The four equations above give us four equalities:
I1 = I2 , I3 = I4 , r1 I1 = r3 I3 , r2 I2 = r4 I4 .
In particular, we have
r2 I2 r2 I1 r2 r3
r4 = = = .
I4 I3 r1
(b) We now consider the entire linear system, substituting in the given resistance
and voltage values:
I0 − I1 − I3 = 0
I − I − Ig = 0
1 2
I3 − I4 + Ig = 0
−I0 + I2 + I4 = 0
.
5I 1 + 10I2 = 10
2I3 + 4I4 = 10
5I − 2I3 + 50Ig = 0
1
− 10I2 4I4 + 50Ig = 0
Rewriting the linear system as a matrix equation Ax = b, we have
1 −1 0 −1 0 0 0
0
1 −1 0 0 −1 I0
0
0
0 0 1 −1 1
I1 0
−1 0 1 0 1 0
I2 = 0 .
0 5 10 0 0 0
I3 10
0 0 0 2 4 0
I4
10
0 5 0 −2 0 50 Ig 0
0 0 −10 0 4 50 0
We can use MATLAB to find the reduced row-echelon form of this system:
>> A = [1 -1 0 -1 0 0; 0 1 -1 0 0 -1; 0 0 0 1 -1 1;
-1 0 1 0 1 0; 0 5 10 0 0 0; 0 0 0 2 4 0; 0 5 0 -2 0 50;
0 0 -10 0 4 50]
>> b = [0; 0; 0; 0; 10; 10; 0; 0]
>> rref([A b])
This yields the augmented matrix
1 0 0 0 0 0 2.3333
0 1 0 0 0 0 0.6667
0 0 1 0 0 0 0.6667
0 0 0 1 0 0 1.6667
.
0 0 0 0 1 0 1.6667
0 0 0 0 0 1 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
In particular, we find that I0 = 7/3, I1 = I2 = 2/3 and I3 = I4 = 5/3. Further-
more, we have Ig = 0; since the current that goes through the central resistor is
0 amperes, we expect our resistances to be related by the equation we derived
previously:
r2 r3
r4 = .
r1
Indeed, our resistance values satisfy this equation: we have 4 = (10 · 2) ÷ 5.
Supplementary Problems
6. (Application, MATLAB)(Approximate integration)
There are some integral that are not possible to solve by finding the antiderivate. The
integral can be approximated by using an interpolating polynomial to approximate the
integrand and integrating the approximating polynomial. For example, suppose we
want to evaluate the integral Z 1
2
e−x dx
0
We begin by picking a few points between the limits, say
x0 = 0, x1 = 0.25, x2 = 0.5, x3 = 0.75, x4 = 1
2
and evaluate the integrand f (x) = e−x at these points. They are approximately
f (0) = 1, f (0.25) = 0.9394, f (0.5) = 0.7788, f (0.75) = 0.5698, f (1) = 0.3679
The interpolating polynomial is (check it!)
p(x) = 0.0416x4 + 0.4882x3 − 1.1846x2 + 0.0226x + 1
and Z 1
p(x)dx ≈ 0.7468
0
R1 2
which, up to the fourth decimal place, is exactly the integral 0 e−x dx. The more
points we pick, and thus the higher the degree of the polynomial, the more accurate
the approximation becomes.
By using MATLAB, we can easily approximate the integral using interpolating polyno-
mial. Suppose we want an interpolating polynomial of degree n. First create a vector
whose entries are n + 1 regular steps between a to b
>> v=[a:(b-a)/n:b]’;
Then we create the Vandermonde matrix
>> A=fliplr(vander(v));
2
Let b be the vector whose entries are the evaluation of e−x at the points of v
>> b=exp(-v.^2);
Then we obtain the coefficient of the interpolating polynomial of degree n
>> A\b
R1 2
Use an interpolating polynomial of degree 10 to approximate the integral 0
e−x dx.
Solution: >> v=[0:1/10:1]’;
The interpolating polynomial is
0.0043x10 − 0.0345x9 + 0.0893x8 − 0.0405x7
− 0.1440x6 − 0.0084x5 + 0.502x4 − 0.0003x3 − x2 + 1
whose antiderivative is
0.0043 11 0.0345 1 0.0893 9 0.0405 8 0.1440 7
x − x 0+ x − x − x
11 10 9 8 7
0.0084 6 0.502 5 0.0003 4 1 3
− x + x − x − x +x
6 5 4 3
Thus, the integral is approximately
0.0043 0.0345 0.0893 0.0405 0.1440 0.0084 0.502 0.0003 1
− + − − − + − − +1 = 0.7468
11 10 9 8 7 6 5 4 3