Tutorial 5 Solution
Tutorial 5 Solution
Department of Mathematics
0 29
2 0 2 3 1 0
−1 3 4 6 −→ 0 1 0 152
.
0 2 3 6 0 0 1 −3
Thus
3 2 0 2
6 = 9 −1 + 15 3 − 3 4 .
2 2
6 0 2 3
1 3
(b) S = 1 , 4 .
0 2
Solution: The set S is linearly independent since S has only two vectors which
are not multiples of each other.
1 3 0
(c) S = 1 , 4 , 0 .
0 2 0
Solution: Any set containing the zero vector is linearly dependent. Indeed we
have
0 1 3
0 = 0 1 + 0 4 .
0 0 2
1 0 1
(d) S = 0 , 1 , 2 .
0 1 −1
1 0 1 0
Solution: Solving a 0 + b 1 + c 2 = 0,
0 1 −1 0
1 0 1 0 1 0 0 0
0 1 2 0 −→ 0 1 0 0 .
0 1 −1 0 0 0 1 0
1 0 1 0
So a 0 + b 1 + c 2 = 0 has only the trivial solution and S is a
0 1 −1 0
linearly independent set.
(b) S2 = {u − v, v − w, w − u},
(c) S3 = {u − v, v − w, u + w},
Solution: We have
Solution: We have
(e) S5 = {u + v, v + w, u + w, u + v + w}.
Solution: We have
(u + v) + (v + w) + (u + w) − 2(u + v + w) = 0.
Solution:
a+b
a + c
V = a, b, c, d ∈ R
c+d
b+d
1 1 0 0
1 0 1 0
= 0 + b 0 + c 1 + d 1 a, b, c, d ∈ R
a
0 1 0 1
1 1 0 0
1 0 1 0
= span , , , .
0 0 1 1
0 1 0 1
1 1 0 0 0 1 0 0 −1 0
1 0 1 0 0 0 1 0 1 0
−→ .
0 0 1 1 0 0 0 1 1 0
0 1 0 1 0 0 0 0 0 0
This means that the fourth vector is redundant. Notice that the last vector linearly
depend on the first 3. After throwing this vector out, one can check that
1 1 0
, , 1
1 0
0 0 1
0 1 0
is a basis for V .
1 −1 0 1
(b) V = span 0 , 2 , 3 , −1 .
−1 3 0 1
−1 2
−1 1
It is easy to see that 1 , 0 is linearly independent, and is thus a basis
0 −1
0 1
for V .
a −1 1
4. For what values of a will u1 = 1 , u2 = a , u3 = −1 form a basis for R3 ?
−1 1 a
Solution:
a −1 1 0 1 a −1 0 R2 − aR1
R ↔ R2
1 a −1 0 1 a −1 1 0 −→
−→
−1 1 a 0 −1 1 a 0 R3 + R1
1 a −1 0 1 a −1 0 1+a
0 −1 − a2 1 + a 0 −R2 0 1 + a2 −1 − a 0 R3 − 1+a2 R2
−→ −→
0 1+a a−1 0 0 1+a a−1 0
−1
1 a 0
0 1 + a2 −1 − a 0
a(a2 +3)
0 0 1+a2
0
So u1 , u2 , u3 will form a basis for R3 if and only if a ̸= 0.
a −1 1
Alternatively, the determinant of 1 a −1 is a(a2 + 3), which is 0 if and only if
−1 1 a
a = 0.
1 1 0 −1
(a) Is U ∪ V a subspace of R4 ?
Solution: No. We will show that it is not closed under linear combinations. We
have u1 ∈ U ∪ V and v1 ∈ U ∪ V . The sum is
1 1 2
1 0 1
u1 + v1 =
1 + 1 = 2 .
1 0 1
We will check that this is neither in U nor in V , and thus it cannot be in the union
U ∪V.
1 1 2 1 0 0
1 2 1 0 1 0
1 2 2 −→ 0 0 1
1 1 1 0 0 0
shows that u1 + v1 ̸∈ U , and
1 1 2 1 0 0
0 0 1
−→ 0 1 0
1 2 2 0 0 1
0 1 1 0 0 0
shows that u1 + v1 ̸∈ V . So u1 + v1 ̸∈ U ∪ V .
(b) Show that U + V a subspace by showing that it can be written as a span of a set.
What is the dimension?
Solution: A vector is in U if and only if it can be written as α1 u1 + α2 u2 , and
a vector is in V if and only if it can be written as β1 v1 + β2 v2 . So a vector in
U + V if and only if it has the form α1 u1 + α2 u2 + β1 v1 + β2 v2 . This shows that
U + V = span{u1 , u2 , v1 , v2 }, and hence, U + V is a subspace.
We will also give a general proof that for any subspaces U and V , U + V is a
subspace. Indeed clearly 0 ∈ U + V . Suppose now w1 , w2 ∈ U + V . Then by
definition of U + V , we can find u1 , u2 ∈ U and v1 , v2 ∈ V such that w1 = u1 + v1
and w2 = u2 + v2 . Then for any α, β ∈ R,
Since U and V are subspaces, (αu1 + βu2 ) ∈ U and (αv1 + βv2 ) ∈ V . So αw1 +
βw2 ∈ U + V .
In general, if U = span{u1 , ..., uk } and V = span{v1 , ..., vl }, then U + V =
span{u1 , ..., uk , v1 , ..., vl }.
(c) Show that U +V contains U and V . This shows that U +V is a subspace containing
U ∪V.
Solution: This is clear from (a) since span{u1 , u2 } and span{v1 , v2 } are subsets
of span{u1 , u2 , v1 , v2 }. In fact, U + V is the smallest subspace that contains U ∪ V .
(e) Show that U ∩ V a subspace by showing that it can be written as a span of a set.
What is the dimension?
1 1 0 −1
1 1 0 −1 0
1 1 −1 −1 0 1 0 0 2 0
1
2 0 0 0 0 1
−→ 0 −1 0
1 2 −1 −2 0 0 0 1 2 0
1 1 0 1 0 0 0 0 0 0
So for any choice of s ∈ R, α1 = −2s and α2 = s, or β1 = −2s and β2 = s will work,
that is, w = −s(2u1 − u2 ) = −s(2v1 − v2 ). Hence, U ∩ V = span{2u1 − u2 } =
span{2v1 − v2 }, and this shows that U ∩ V is a subspace, with dim(U ∩ V ) = 1.
Solution: Indeed, 3 = 2 + 2 − 1.
Extra problems
1. Let u1 , u2 , ..., uk be vectors in Rn and P a square matrix of order n.
(a) Show that if Pu1 , Pu2 , ..., Puk are linearly independent, then u1 , u2 , ..., uk are
linearly independent.
c1 u1 + c2 u2 + · · · + ck uk = 0
⇒ P(c1 u1 + c2 u2 + · · · + ck uk ) = P0
⇒ c1 Pu1 + c2 Pu2 + · · · + ck Puk = 0.
Since Pu1 , Pu2 , ..., Puk are linearly independent, we conclude that c1 = c2 = · · · =
ck = 0. Thus, u1 , u2 , ..., uk are linearly independent.
where the last implication follows from the fact that P is invertible. Since
u1 , u2 , ..., uk are linearly independent, we conclude that c1 = c2 = · · · = ck = 0.
Thus, Pu1 , Pu2 , ..., Puk are linearly independent.
(ii) If P is not invertible, are Pu1 , Pu2 , ..., Puk are linearly independent?
1 0
Solution: No conclusion. For example, let u1 = 0 and u2 = 1. It is
0 0
clear that
1u and
2u are linearly independent.
1 0 0
If P = 0 1 0, then Pu1 = u1 and Pu2 = u2 are linearly independent.
0 0 0
0
If P = 03×3 , then Pu1 = Pu2 = 0 are linearly dependent.
0
2. Prove the theorem that V ⊆ Rn is a subspace if and only if V = span{u1 , ..., uk } for
some ui ∈ Rn , i = 1, ..., k.
Solution:
(⇐) A spanning set contains the origin and is closed under linear combination.
(⇒) Suppose V = {0}. Then V = span{0}. Hence, we may assume V ̸= {0}. Since
V is a non-trivial subspace, we may pick a nonzero vector u1 ̸= 0 in V . If V =
span{u1 }, we are done. Otherwise, pick a u2 ∈ V \ span{u1 }. Now {u1 , u2 } is
necessarily linearly independent since u2 ̸∈ span{u1 }. Suppose the vectors u1 , ..., ui
has been chosen such that they are linearly independent. If span{u1 , ..., ui } =
V , we are done. Otherwise, pick a ui+1 ∈ V \ span{u1 , ..., ui }. We claim that
u1 , ..., ui , ui+1 are linearly independent. Suppose
c1 u1 + · · · + ci ui + ci+1 ui+1 = 0.
If ci+1 ̸= 0, then
−c1 −ci
u1 + · · · + ui = ui+1 ,
ci+1 ci+1
a contradiction to ui+1 ∈ V \ span{u1 , ..., ui }. This mean that
c1 u1 + · · · + ci ui = 0,
Remark. The proof of (⇒) yields a useful result for a subspace V of Rn . Let S =
{u1 , ..., uk } be a set of linearly independent vectors in V . If S is not a basis of V , then
we could add vectors into the set S so that
is a basis of V .
Solution:
Similarly, if u + v ∈ V , then
Let {w1 , ..., wr } be a basis for U ∩ V . Then dim(U ∩ V ) = r. Note that {w1 , ..., wr }
is a linearly independent subset of U . Thus we may extend it to be a basis
{w1 , ..., wr , u1 , ..., uk } of U . Then dim(U ) = r + k. Similarly, {w1 , ..., wr } is a lin-
early independent subset of V . So, we may extend it to be a basis {w1 , ..., wr , v1 , ..., vl }
of V . Then dim(V ) = r + l. From question 5b, we have
U + V = span{w1 , ..., wr , u1 , ..., uk , v1 , ..., vl }.
We claim that {w1 , ..., wr , u1 , ..., uk , v1 , ..., vl } is linearly independent. Suppose
a1 w1 + · · · + ar wr + b1 u1 + · · · + bk uk + c1 v1 + · · · + cl vl = 0. (1)
This is equivalent to
a1 w1 + · · · + ar wr + b1 u1 + · · · + bk uk = −(c1 v1 + · · · + cl vl ).
The left hand side of the equation is a vector in U and the right side is a vector in
V , and hence, c1 v1 + · · · + cl vl ∈ U ∩ V . Hence, there exists d1 , ..., dr such that
c1 v1 + · · · + cl vl = d1 w1 + · · · + dr wr
which is equivalent to
c1 v1 + · · · + cl vl − d1 w1 − · · · − dr wr = 0.
Since {w1 , ..., wr , v1 , ..., vl } is a basis of V , in particular, it is independent, we have
c1 = · · · = cl = 0 = d1 = · · · = dr . Furthermore,
a1 w1 + · · · + ar wr + b1 u1 + · · · + bk uk = −(c1 v1 + · · · + cl vl ) = 0.
Finally, since {w1 , ..., wr , u1 , ..., uk } is a basis for U , we can conclude that a1 =
· · · = ar = 0 = b1 = · · · = bk . This shows that equation 1 has only the trivial
solution, and hence {w1 , ..., wr , u1 , ..., uk , v1 , ..., vl } is independent. Therefore
dim(U + V ) = r + k + l = (r + k) + (r + l) − r = dim(U ) + dim(V ) − dim(U ∩ V ).
4. (MATLAB) In the last tutorial, we introduced the “binary n-space” Bn , which is
governed by the special addition rule: 1+1 = 0. Our goal in this problem is to investigate
how working with binary vectors can help us detect and correct errors in information
transmission.
When a computer transmits a piece of information (a binary string) to another device,
there is always a possibility of an error—that is, the receiving device might receive an
incorrect binary string, perhaps due to external interference or noise in the communica-
tion channel. One way that a computer might “protect” its message is by adding extra
information to the binary string so that the receiving device can detect—and ideally,
correct—any errors that may have occured in transmission.
Consider the following scenario: your friend Annette wants to send you a message u.
For the sake of simplicity, let’s assume that Annette’s message contains four bits—that
is, u is a vector in B4 (as opposed to a standard byte, which is a vector in B8 ). Annette,
however, is afraid that a transmission error might send you the wrong message—say, by
accidentally changing a 1 to a 0, or a 0 to a 1.
1. Rather than just sending you the message u, Annette instead sends you the 8-vector
that results when each bit in u is repeated twice. You receive the vector
0 0 1 1 0 0 0 1 ,
where divider bars have been used to split the string up into segments, each repre-
senting one bit in Annette’s original message. Do you have enough information to
decode Annette’s original message?
Solution: We can detect that an error was made in transmitting the fourth bit of
Annette’s original message. However, we do not have information to recover actual
message—it could easily be either ( 0 1 0 0 ) or ( 0 1 0 1 ).
From this, we formed the matrix M by taking the basis vectors v1 , v2 , v3 , v4 for
S = {x ∈ B7 | Hx = 0} (i.e., the basis for the null space of H) as its columns:
1 0 1 1
1 1 0 1
1 1 1 0
M = 1 0 0 0
.
0 1 0 0
0 0 1 0
0 0 0 1
(a) Explain why the set S is identical to the column space of M . Hence, without
explicitly calcuating any matrix products, explain why H (M x) = 0 for all
vectors x ∈ B4 .
Solution: The column space of M is simply the linear span of its columns,
which is precisely the set S = span {v1 , v2 , v3 , v4 } . Observe that for an arbi-
trary vector x ∈ B4 , we may write the matrix product M x as
x1
↑ ↑ ↑ ↑ x2
M x = v1 v2 v3 v4 x3 = x1 v1 + x2 v2 + x3 v3 + x4 v4 .
↓ ↓ ↓ ↓
x4
That is, the vector M x is a linear combination of the columns of M and must
hence lie in the column space of M . Since the column space of M and the
set S are identical, M x must lie in S = {x ∈ B7 | Hx = 0} as well—that is,
M x is a solution to the homogeneous linear system with coefficient matrix H.
Thus, H (M x) = 0.
An alternative method of checking H (M x) = 0. The columns v1 , . . . , v4 of
M are in the nullspace of H so
Hv1 = · · · = Hv4 = 0.
We compute
↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
HM = H v1 v2 v3 v4 = Hv1 Hv2 Hv3 Hv4 = 0.
↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
Hence
H(Mx) = (HM)x = (0)x = 0.
(b) Consider the vector v = M u, which is a vector in B7 . The first three entries
of v will later be used to detect errors. What are the last four entries of v?
Solution: Observe that the last four rows of the matrix M form the identity
matrix of order 4. We can partition the matrix M into two blocks—the first
three rows forming the matrix A, and the last four rows forming I4 . Thus,
1 0 1 1
1 1 0 1 ↑ ∗
Au ∗
1 1 1 0
↓ ∗
v = Mu = 1 0 0 0 u = ↑ = ↑ ,
0 1 0 0
I4 u u
0 0 1 0
↓ ↓
0 0 0 1
and the last four entries of the vector v contains the original message u.
(c) Instead of transmitting the vector u, Annette’s computer instead sends out
v = M u. Assume that at most one error can occur during transmission.
• What vector will you receive if no errors occur during transmission?
Solution: If no error occurs during transmission, then all the entries of
the vector v will remain unchanged—thus, we will receive the vector v.
• Let ei denote the standard unit vector whose i-th entry is 1 and remaining
entries are all 0’s. Explain why you would receive a vector of the form
v + ei , for some i ∈ {1, . . . , 7} , if an error has occured during transmission.
Solution: If an error has occurred during transmission, then one compo-
nent of the vector v would have been altered. That is, for one of the vector’s
components—say, the i-th component—a 0 would have been turned into a
1, or a 1 to a 0. Since 0 + 1 = 1 and 1 + 1 = 0, the error would be akin to
adding a 1 to the i-th component of v. Thus, we would receive v + ei : the
vector v whose i-th entry has been altered.
(d) Let w be the vector you receive on your device. Explain how calculating the
matrix product Hw will allow you to detect and correct a potential transmis-
sion error. [Hint: First consider what the vector w would look like if no error
has occured, then consider the possibility that an error has occured during
transmission.]
Solution: There are two possibilities for w, depending on whether or not an
error occurs during transmission.
• If no error has occurred, the vector w we receive would simply be the
vector v that Annette’s computer sends out. Since w = v = M u,
calculating the matrix product Hw will yield
Hw = Hv = H (M u) = 0.
Since the last four entries of the vector v contains Annette’s original
message u, we are easily able to decode Annette’s message.
• If an error has occured, then the vector w we receive would be of the
form w = v + ei . Calculating the matrix product Hw yields
Hw = H (M u + ei ) = H (M u) + Hei = 0 + Hei = Hei .
In particular, the product Hw = Hei is the i-th column of H. Since all
the columns of H are distinct, we can deduce the vector ei by finding the
corresponding column in H. This tells us which component of the vector
v contains an error.
>> mod(H*w,2)
1
We find that Hw = 1. Since Hw ̸= 0, an error has been made. Now Hw
0
is the 7th column of the matrix H, and we deduce that we received the vector
w = v + e7 , and an error has been made in transmitting the 7th component of
v. Thus, we recover the transmission sent from Annette’s computer to be
1
0
1
v = w + e7 = 0 .
1
0
1
Since the last four entries of v is the vector u, we deduce that Annette’s original
message is u = (0, 1, 0, 1)T .