Lecture 7 Linear Transformations
Lecture 7 Linear Transformations
Daniele Venturi
F : V 7→ W (1)
is linear if
1. F (u + v) = F (u) + F (v) ∀u, v ∈ V ,
2. F (cu) = cF (u) ∀u ∈ V, ∀c ∈ K.
Conditions 1. and 2. imply that
F :R→R
x → sin(x)
• Example 2: Let V = C (1) (R) (vector space of real-valued continuously differentiable functions),
W = C (0) (R) (vector space of real-valued continuous functions), K = R. The transformation
F : C 1 (R) → C 0 (R)
df (x)
f (x) →
dx
is linear. In fact, we have
df df (x) dg(x)
(af (x) + bg(x)) = a +b ∀f, g ∈ C (1) (R), ∀a, b ∈ R. (3)
dx dx dx
F : R3 → R2
x1
x2 → x1 − x2
2x1 + x2 − x3
x3
Page 1
AM 10 Prof. Daniele Venturi
is linear. In fact,
Tr(aA + bB) = aTr(A) + bTr(B). (7)
Hereafter we show that the composition of two linear transformation is a linear transformation.
Injective, surjective and invertible transformations. Let V and W be two sets (not neces-
sarily vector spaces). Consider the following (linear or nonlinear) transformation
F :U →V (9)
1
The trace of a square matrix is defined to be the sum of all diagonal entries of A.
Page 2
AM 10 Prof. Daniele Venturi
Note that there may be more than one element in V that is mapped onto w. In the figure
above, two elements u and v are mapped onto the same element w.
3. We say that F is invertible2 if is is one-to-one and onto (injective and surjective). The following
diagram sketches an invertible transformation between the sets V and W .
2
Invertible transformations are often called bijections or bijective transformations.
Page 3
AM 10 Prof. Daniele Venturi
F :R→R
x → sin(x)
In fact, there are multiple points on the x axis with the same value of sin(x). For example,
Hence the function is not injective.The function sin(x) is also not surjective in R, as there is no
x ∈ R such that sin(x) = 2. However, if we restrict the domain and range of F as follows
h π πi
F : − , → [−1, 1]
2 2
x → sin(x)
then F is invertible, since it is injective and surjective. The inverse function is denoted by sin−1 (x)
or arcsin(x)
F : R2 → R2
x1 1 2 x1 x1 + 2x2
→ = ,
x2 −1 1 x2 −x1 + x2
| {z } | {z } | {z }
x A x
is one-to-one and onto. In fact it is easy to show Ax = Ay implies x = y (inejctivity), and that for
each y ∈ R there exits x ∈ R2 such that Ax = y. Therefore the transformation F is invertible. The
inverse transformation is defined by the inverse matrix A−1
F −1 : R2 → R2
x1 1 1 −2 x1 1 x1 − 2x2
→ = .
x2 3 1 1 x2 3 x1 + x2
| {z } | {z } | {z }
x A−1 x
Page 4
AM 10 Prof. Daniele Venturi
F : V → Kn (15)
x1
..
v→ . (16)
xn
is linear, one-to-one and onto. These properties follow immediately from the definition of basis
(surjectivity), and from the fact that the coordinates of v ∈ V relative to a basis are unique
(injectivity). Hence, (16) defines a bijection between V and K n . This means that V is isomorphic
to K n .
Example 8: The space of polynomials of degree at most 4 with real coefficients, i.e., P4 (R), is
isomorphic to R5 . In fact, if we set up a basis for P5 (R), i.e., a set of 5 linearly independent
polynomials of degree at most 4, e.g.,
then we see that each polynomial in p ∈ P4 (R) is uniquely identified by 5 real coefficients x0 , . . . , x4 :
Hence, there exists a bijection between R5 and the space of polynomials P4 (R). In other words,
P4 (R) and R5 are isomorphic.
Example 9: The vector space of 3 × 3 symmetric matrices with real coefficient is isomorphic to
R6 .
Since the inverse of an isomorphism is an isomorphism we have that all vector spaces of dimension
n over some field K are isomorphic to one another. For example, the vector space of polynomials
of degree at most 3 is isomorphic to the vector space of 2 × 2 matrices with real coefficients.
Theorem 3. The set of all linear mappings between two vector spaces V and W is a vector space.
Such a space is denoted by L(V, W ).
Page 5
AM 10 Prof. Daniele Venturi
Nullspace and range of a linear transformation. Let V , W be vector spaces. Consider the
linear transformation
F : V → W. (19)
• The nullspace (or kernel3 ) of F is the set vectors in V that are mapped into 0W (zero vector
of W ), i.e.,
Clearly, since F is linear we have that the element 0V is always mapped onto 0W . Therefore,
0V is always in the nullspace of F .
• The range of F is the set of vectors w in W such that w is the image of some v ∈ V under F ,
i.e., there exists v ∈ V such that F (v) = w.
Let us determine the nullspace and the range of simple linear transformations.
F : R3 → R2
x1 x1
x2 → x1 + x2 + x3 = 1 1 1 x2 (22)
x3 0 0 1
x3 | {z } x3
A
3
The nullspace/kernel of a linear transformation F is often denoted as ker(F ).
Page 6
AM 10 Prof. Daniele Venturi
The nullspace of F is the set of vectors in R3 that mapped onto the zero vector of R2 . Hence, the
nullspace of F is defined by the following homogeneous linear system of equations
( (
x1 + x2 + x3 = 0 x1 = −x2
⇒ (23)
x3 = 0 x3 = 0
Note that the nullspace of F is a vector subspace of R3 (line passing through the origin). The range
of F is the image of R3 under F . Such range coincides with column space of the matrix A, i.e., the
span of the columns of A. In fact,
x1 + x2 + x3 1 1 1
= x1 + x2 + x3 . (24)
x3 0 0 1
Hence,
1 1 1 1 1
R(F ) = span , , = span , = R2 (25)
0 0 1 0 1
The nullspace and the range of linear transformation characterize the injectivity and surjectivity of
the transformation. In particular we have the following two theorems.
Page 7
AM 10 Prof. Daniele Venturi
2. F is injective ⇐ N (F ) = {0V }.
⇒ Suppose that F is one-to-one. We want to show that this implies N (F ) = {0V }. To this end,
let v ∈ N (F ), i.e., F (v) = 0W . Clearly v = 0V is mapped onto 0W , i.e., 0V ∈ N (F ). The
assumption that F is one-to-one rules out the existence of any other element in V mapped
onto 0W . In other workds, 0V is the only element of V mapped into 0W . Hence, if F is
one-to-one then N (F ) = {0V }.
⇐ Conversely, let us assume that N (F ) = {0V }. We want to show that this implies that F is
one-to-one. To this end, suppose there are two elements u, v ∈ V such that F (u) = F (v). By
using the linearity of F we have F (u − v) = 0W , i.e., (u − v) ∈ N (F ). Since, by assumption,
the only element in the nullspace of F is 0V we have that u − v = 0V , i.e., u = v. In other
words, N (F ) = {0V } implies that F is one-to-one.
Next we present a very important theorem for linear transformations between vector spaces.
Theorem 7. Let F : V → W be any linear transformation between two vector spaces V and W .
Then
dim(V ) = dim(N (F )) + dim(R(F )). (26)
Proof. If R(F ) = 0W the statement is trivial since the entire V is mapped to the 0W . This
implies N (F ) = V , and of course dim(N (F )) = dim(V ). Consider now dim(R(F )) = s > 0
and let {w1 , . . . , ws } be a basis of R(F ). Then there exist s elements v1 , . . . , vs ∈ V such that
F (v1 ) = w1 , . . . , F (vs ) = ws . Suppose dim(N (F )) = q and let {u1 , . . . , uq } be a basis for N (F ).
We would like to show that {u1 , . . . , uq , v1 , . . . , vs } is a basis of V 4 . To this end, pick an arbitrary
v ∈ V . Then, there exists x1 , . . . , xs ∈ K such that F (v) = x1 w1 + . . . + xs ws (since w1 , . . . , ws is a
basis for R(F )). Recalling that F (v1 ) = w1 , ..., F (vs ) = ws
F (v) = x1 F (v1 ) + . . . + xs F (vs )
= F (x1 v1 + . . . + xs vs ).
4
Note that if {u1 , . . . , uq , v1 , . . . , vs } is a basis of V then dim(V ) = q +s, where q = dim(N (F ) and s = dim(R(F )).
Page 8
AM 10 Prof. Daniele Venturi
F (v − x1 v1 − · · · − xs vs ) = 0W ⇒ (v − x1 v1 − · · · − xs vs ) ∈ N (F ).
v − x1 v1 − . . . − xs vs = y1 u1 + . . . + yq uq ,
i.e.,
v = x1 v1 + . . . + xs vs + y1 u1 + . . . + yq uq .
This shows that V = span{v1 , . . . , vs , u1 , . . . , uq }, i.e., that V is generated by {v1 , . . . , vs , u1 , . . . , uq }.
To prove the theorem it remains to prove that the the vectors {v1 , . . . , vs , u1 , . . . , uq } are linearly
independent. In this way we can claim that n = s + q, i.e., dim(V ) = dim(N (F )) + dim(R(F )).
To this end, consider the linear combination
x1 v1 + . . . + xs vs + y1 u1 + . . . + yq uq = 0V . (27)
x1 w1 + . . . + xs ws = 0W ⇒ x1 , . . . , xs = 0. (28)
In fact {w1 , . . . , ws } is a basis for R(F ) and therefore wi are linearly independent. Substituting this
result back into (27) yields
x1 v1 + . . . + xs vs = 0V ⇒ x1 , . . . , x s = 0 (29)
since {v1 , . . . , vs } is a basis for N (F ). Equations (28), (29) and (27) allow us to conclude that
{v1 , . . . , vs , u1 , . . . , uq } are linearly independent. Moreover the vectors {v1 , . . . , vs , u1 , . . . , uq } gen-
erate V , and therefore they are a basis for V . This implies that
F : Rn → Rm
x1 a11 · · · a1n x1
.. .. ... .
.. ...
. → . (31)
xn am1 · · · amn xn
| {z } | {z } | {z }
x A x
We know that range of F coincides with the column space of A. Also the dimension of the column
space is the rank of the matrix A. Therefore from equation (26) it follows that
Page 9
AM 10 Prof. Daniele Venturi
The transformation F is uniquely determined by the image of the basis BV under F , i.e.,
Clearly, for all i = 1, . . . , n we have that F (vi ) ∈ R(F ) ⊆ W . Therefore, each F (vi ) can be
represented in terms of the basis BW as
F (v1 ) = a11 w1 + · · · + am1 wm
..
. . (35)
F (vn ) = a1n w1 + · · · + amn wm
Note that aij is the i-th component of F (vj ) relative to the basis {w1 , . . . , wm }. The matrix asso-
ciated with the linear transformation F depends bases BV and BW and it is defined as
a11 · · · a1n
ABBW (F ) = ... .. .. . (36)
V
. .
am1 · · · amn
Example 11: Let V and W be vector spaces of dimension dim(V ) = 2 and dim(W ) = 3, respectively.
We consider the following bases in V and W :
Page 10
AM 10 Prof. Daniele Venturi
Note that the coordinates of F (v) relative to the basis BW , i.e., {y1 , y2 , y3 } are given by the standard
matrix-vector product
y1 1 1
y2 = −2 1 x1 (41)
x2
y3 −1 1
As we shall see hereafter this is a general result. In fact, consider an arbitrary element v ∈ V , and
represent it in terms of the basis BV
v = x1 v1 + · · · + xn vn . (42)
representing the coordinates of v and F (v) relative to BV and BW , respectively. With this notation,
we see from (43) and (36) that
[F (v)]BW = ABBWV
(F )[v]BV . (45)
Therefore, the coordinates of F (v) relative to BW are obtained by taking the matrix-vector product
between the matrix ABBWV
(F ) and the coordinates of v relative to BV .
Change of basis transformation Consider the following two bases in the vector space V
B1 = {u1 , . . . , un }
B2 = {v1 , . . . , vn }
Page 11
AM 10 Prof. Daniele Venturi
Obviously, we can express any element in B1 as a linear combination of elements in B2 and vice
versa. For example,
F (v1 ) = α11 u1 + · · · + αn1 um
..
. . (46)
F (vn ) = α1n u1 + · · · + αnn un
The matrix associated with the linear transformation “change of basis from B1 to B2 ” is
α11 · · · α1n
MBB12 = ... . . . .. . (47)
.
αn1 · · · αnn
Such a matrix is invertible and it allows us to transform the coordinates of any vector v ∈ V from
those relative to B1 to those relative to B2 , i.e.,
Moreover, we have
−1 −1
[v]B1 = MBB21 [v]B2 = MBB12 [v]B2 which implies MBB21 = MBB12 . (49)
The change of basis transformation can be also used to represent a linear transformation F : V → W
relative to different bases in V and W . To show this, let
B1 , B2 → Bases of V , dim(V ) = n,
B3 , B4 → Bases of W , dim(V ) = m.
We have,
[F (v)]B4 = MBB34 [F (v)]B3 = MBB34 ABB32 [v]B2 = MBB34 ABB32 MBB12 [v]B1 , (50)
| {z }
B
AB4
1
i.e.,
ABB41 = MBB34 ABB32 MBB12 . (51)
The matrix ABB41 represents the linear transformation F relative to the bases B1 (basis of V ) and B4
(basis of W ). Similarly, ABB32 represents the linear transformation F relative to the bases B2 (basis
of V ) and B3 (basis of W ).
F : R2 → R2 (52)
Page 12
AM 10 Prof. Daniele Venturi
as
1 1 0 1
F = , F = . (53)
0 1 1 2
Clearly, (
v1 = e 1 + e 2
. (54)
v2 = e1 + 2e2
The following figure sketches {e1 , e2 } and {v1 , v2 } as vectors in the Cartesian plane.
v =x1 v1 + x2 v2
=x1 (e1 + e2 ) + x2 (e1 + 2e2 )
=(x1 + x2 )e1 + (x1 + 2x2 )e2 . (55)
Denote by
y x
[v]B1 = 1 , [v]B2 = 1 . (56)
y2 x2
the coordinates of v relative to B1 and B2 , respectively. Then equation (55) implies that
B1 B1 1 1
[v]B1 = MB2 [v]B2 , where MB2 = . (57)
1 2
MBB21 is the matrix associated with the change of basis transformation B2 → B1 . Clearly, MBB21 is
invertible with inverse
B2 B1 −1
2 −1
MB1 = MB2 = (58)
−1 1
MBB12 is the matrix associated with the change of basis transformation B1 → B2 . Let us see if this is
indeed true. To this end, we consider the vector v = e1 and compute the coordinates of this vector
relative to B2 . We have
1 2 −1 1 2
[v]B1 = ⇒ [v]B2 = = (59)
0 −1 1 0 −1
| {z }
B
MB 2
1
The following figure illustrates that the components of v = e1 relative to B2 are indeed x1 = 2 and
x2 = −1.
Page 13
AM 10 Prof. Daniele Venturi
The matrix associated with the transformation F relative to the basis BV = {e1 , e2 } is
BV cos(θ) − sin(θ)
ABV (F ) = (2D rotation matrix). (62)
sin(θ) cos(θ)
Any vector with components [v]BV is rotated to a vector F (v) with components
[F (v)]BV = ABBVV [v]BV . (63)
2 2
For example, the vector v = has components relative to the canonical basis BV , and it is
1 1
transformed to a vector F (v) with components
cos(θ) − sin(θ) 2 2 cos(θ) − sin(θ)
[F (v)]BV = = . (64)
sin(θ) cos(θ) 1 2 sin(θ) + cos(θ)
Page 14
AM 10 Prof. Daniele Venturi
The inverse transformation (inverse rotation) is obtained by replacing θ with −θ in (62), i.e.,
BV −1 cos(θ) sin(θ)
ABV (F ) = . (66)
− sin(θ) cos(θ)
It is straightforward to verify that for all θ ∈ [0, 2π] we have
BV −1 BV
ABV (F ) ABV (F ) = I2 . (67)
In fact,
cos θ + sin2 θ
2
cos θ − sin θ cos θ sin θ 0 1 0
= = .
sin θ cos θ − sin θ cos θ 0 cos2 θ + sin2 θ 0 1
Example 14: (Rotations in R3 ) We can define rotations along each of the three axes of a 3D Cartesian
coordinate system, i.e.,
cos θ3 − sin θ3 0
R3 = sin θ3 cos θ3 0
0 0 1
5
In general, we say that A ∈ Mn×n (R) is orthogonal if
AT = A−1 . (68)
This is equivalent to the statement that orthogonal matrices satisfy
AAT = In . (69)
Page 15
AM 10 Prof. Daniele Venturi
1 0 0
R1 = 0 cos θ1 − sin θ1
0 sin θ1 cos θ1
cos θ2 0 − sin θ2
R2 = 0 1 0
sin θ2 0 cos θ2
Note that the composition of two rotation in R3 do not commute. For example, R1 R3 6= R3 R1 .
F : R3 → R3
1 0 0
B3 = {e1 , e2 , e3 } = 0 , 1 , 0
0 0 1
Page 16
AM 10 Prof. Daniele Venturi
Note that P 2 = P . The orthogonal projection transformation basically project any vector v ∈ R3
onto the plane spanned by e1 and e2 . If we are interested in a projection onto different plane, we
can use e.g., the 3D rotation matrices Ri and rotate the plane before applying the projection. Note
that with just R1 and R3 we can orient the (x1 , x2 ) plane in all possible directions. Hence,
To explain this formula suppose for simplicity that we just rotate the plane (x1 , x2 ) counterclockwise
of an angle θ1 around the x1 axis.
The projection of any object onto such plane is obtained by rotating the object clockwise of an
angle θ1 around x1 (matrix R1T (θ3 ) projecting onto the (x1 , x2 ) plane and then rotating the result
back (matrix R1 (θ3 )). Clearly, (71) satisfies the condition for orthogonal projections,
Page 17
AM 10 Prof. Daniele Venturi
v1
Example 16: (Oblique projection) Let v = v2 be a vector of R3 representing the direction of a
v3
x1
light beam. A light beam passing through an arbitrary point x = x2 has the form
x3
y1 v1 x1
y2 = c v2 + x2 where c ∈ R (73)
y3 v3 x3
If we set y3 = 0 we obtain c = −x3 /v3 . With such a value for c, the light beam passing through the
point x intersects the horizontal plane. The linear transformation defined by
v1
y1 = − x3 + x1
v3
v2
y2 = − x3 + x2 (74)
v3
y3 = 0
defines an oblique projection onto the horizontal plane. The matrix associated with such oblique
projection transformation (relative to the canonical basis of R3 ) is
1 0 −v1 /v3
P = 0 1 −v2 /v3 (75)
0 0 0
The oblique projection can be used to compute the shadow of any object in 3D. The following figure
shows the shadow projected by a horse for various angles of the light beam.
Note that for v1 = v2 = 0 the oblique projection reduces to the projection we studied in the previous
example.
Page 18
AM 10 Prof. Daniele Venturi
Example 17: Let P4 = span{1, x, x2 , x3 , x4 } be the space of polynomials of degree at most 4. Define
the linear transformation
F : P4 → P3
dp(x)
p(x) → .
dx
B4 = {1, x, x2 , x3 , x4 },
B3 = {1, x, x2 , x3 }.
We define the derivative transformation by mapping each element of P4 and representing the result
in terms of P3 . This yields
The matrix associated with F (derivative operator) relative to the bases B4 and B3 is
0 1 0 0 0
0 0 2 0 0
ABB34 =
0
.
0 0 3 0
0 0 0 0 4
For example, let us compute the derivative of the polynomial
Therefore we obtained
dp(x)
= −3 + 0x + 18x2 + 0x3 = −3 + 18x2 , (77)
dx
which is indeed the derivative of the polynomial (76).
Page 19