0% found this document useful (0 votes)
18 views20 pages

En 1-4 Linear Transformations - Last Update 02-10-2024

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views20 pages

En 1-4 Linear Transformations - Last Update 02-10-2024

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

LINEAR ALGEBRA WITH PROGRAMMING

Chapter 1
VECTORS AND MATRICES
LINEAR ALGEBRA WITH PROGRAMMING

1.3 Linear Transformations


FUNCTIONS ON PYTHON
LINEAR ALGEBRA WITH PYTHON

Idea
Seeing matrices as “functions”…

The vector 𝒙 is transformed into the vector 𝐴𝒙

𝒙 𝑨𝒙

ℝ𝑛 - Domain ℝ𝑚 - Codomain
Linear transformation

A map 𝑇: ℝ𝑛 ⟶ ℝ𝑚 is called a linear transformation if there is a 𝑚 × 𝑛 matrix 𝐴 𝑇 , such


that 𝑇 is defined by
𝑇 𝒙 = 𝐴𝑇 𝒙
for all 𝒙 ∈ ℝ𝑛 .
In that case, the matrix 𝐴 𝑇 is unique and it is called the transformation matrix of 𝑇.

4
Example −1 2
Consider the linear transformation 𝑇: ℝ2 ⟶ ℝ3 with transformation matrix 𝐴 𝑇 = 1 2 .
0 5

• What is the image of the vector 𝑢 = (3, 1) through 𝑇 ?


−1 2 −1
3
𝑇 𝑢 = 𝐴𝑇 𝑢 = 1 2 = 5 = (−1, 5, 5)
1
0 5 5

• What are the objects which image through 𝑇 is 𝑣 = (3, 1, 5) ?


−1 2 𝑥 3 −1 2 3 1 0 −1 𝑥1 = −1
1
𝑇 𝒙 = 𝑣 ⇔ 𝐴𝑇 𝒙 = 𝑣 ⇔ 1 2 𝑥 = 1 ⇝ 1 2 1 ⟶ ⋯ ⟶ 0 1 1 ⇝ ቐ 𝑥2 = 1
2
0 5 5 0 5 5 0 0 0 0=0

Only the vector 𝒙 = (−1, 1) has image equal to 𝑣 through 𝑇.

• What is the general expression that defines 𝑇 ?


−1 2 𝑥 −𝑥1 + 2𝑥2
1
𝑇 𝒙 = 𝐴 𝑇 𝒙 = 1 2 𝑥 = 𝑥1 + 2𝑥2 = (−𝑥1 + 2𝑥2 , 𝑥1 + 2𝑥2 , 5𝑥2 )
2
0 5 5𝑥2
5
Kernel and range
Let 𝑇: ℝ𝑛 ⟶ ℝ𝑚 be a linear transformation.

• The kernel of 𝑇, denoted by Ker(𝑇), is the set of vectors in ℝ𝑛 which are mapped
onto 0𝑚×1 through 𝑇,
Ker 𝑇 = 𝒙 ∈ ℝ𝑛 : 𝑇 𝒙 = 0𝑚×1 ⊆ ℝ𝑛 ;

• The range of 𝑇, denoted by Range(𝑇), is the set of images through 𝑇 of vectors in


ℝ𝑛 ,
Range 𝑇 = 𝑇 𝒙 : 𝒙 ∈ ℝ𝑛 ⊆ ℝ𝑚 .

6
Example
How can we find the transformation matrix of the linear transformation 𝑇: ℝ3 ⟶ ℝ2 defined by

𝑇(𝑥1 , 𝑥2 , 𝑥3 ) = (𝑥1 − 3𝑥2 , 2𝑥2 − 4𝑥3 )


for all (𝑥1 , 𝑥2 , 𝑥3 ) ∈ ℝ3 ?

𝑥 𝑥1
𝑥 − 3𝑥2 1 −3 0 𝑥1
𝑇 𝑥1 , 𝑥2 , 𝑥3 = 𝑥1 − 3𝑥2 , 2𝑥2 − 4𝑥3 = 1 = 2 = 𝐴 𝑇 𝑥2
2𝑥2 − 4𝑥3 0 2 −4 𝑥 𝑥3
3

1 −3 0
∴ 𝐴𝑇 =
0 2 −4

Notice that:

1 1 0 −3 0 0
𝑇 0 = , 𝑇 1 = , 𝑇 0 =
0 0 0 2 −4
1
7
Proposition

If 𝑇: ℝ𝑛 ⟶ ℝ𝑚 is a linear transformation, then the following conditions hold:


1. 𝑇 𝑢+𝑣 =𝑇 𝑢 +𝑇 𝑣 , ∀𝑢, 𝑣 ∈ ℝ𝑛 ;
2. 𝑇 𝑘𝑢 = 𝑘 𝑇 𝑢 , ∀𝑘 ∈ ℝ, ∀𝑢 ∈ ℝ𝑛 ;
3. 𝑇 0𝑛×1 = 0𝑚×1 .

8
Remark
If 𝑇: ℝ𝑛 ⟶ ℝ𝑚 is a linear transformation, notice that:

𝑥1 1 0 0 1 0 0
𝑥2 0 +𝑥 1 + ⋯+ 𝑥 0 0 +𝑥 𝐴 1 + ⋯+ 𝑥 𝐴 0
𝑇 𝒙 = 𝐴𝑇 ⋮ = 𝐴 𝑇 𝑥1 2 𝑛 = 𝑥1 𝐴 𝑇 2 𝑇 𝑛 𝑇
⋮ ⋮ ⋮ ⋮ ⋮ ⋮
𝑥𝑛 0 0 1 0 0 1

9
Proposition

A linear transformation 𝑇: ℝ𝑛 ⟶ ℝ𝑚 is completely determined by the images of the


columns of the identity matrix 𝐼𝑛 .

10
Example
Consider 𝑇: ℝ3 → ℝ3 , such that 𝑇 𝑥, 𝑦, 𝑧 = 2𝑦, 𝑥, −𝑧 , ∀(𝑥, 𝑦, 𝑧) ∈ ℝ3 .
We have
𝑇 1,0,0 = 0,1,0 ; 𝑇 0,1,0 = 2,0,0 ; 𝑇(0,0,1) = (0,0, −1).
Then
0 2 0
𝐴𝑇 = 1 0 0 .
0 0 −1
Notice that, for example,
0 2 0 2 8 4 0 2 0 1
𝑇 2,4, −6 = 1 0 0 4 = 2 =2 1 =2 1 0 0 2 = 2𝑇 1,2, −3
0 0 −1 −6 6 3 0 0 −1 −3
or, for example,
0 2 0 2 8 0 8 0 2 0 2 0 2 0 0
𝑇 2,4, −6 = 1 0 0 4 = 2 = 2 + 0 = 1 0 0 0 + 1 0 0 4
0 0 −1 −6 6 0 6 0 0 −1 0 0 0 −1 −6
= 𝑇 2,0,0 + 𝑇 0,4, −6

11
Proposition

A linear transformation 𝑇: ℝ𝑛 ⟶ ℝ𝑚 is invertible if and only if 𝑚 = 𝑛 and the matrix 𝐴 𝑇


is invertible.
In that case,
𝐴 𝑇 −1 = (𝐴 𝑇 )−1 .

12
Example
Let 𝑇: ℝ3 → ℝ3 defined by 𝑇(𝑥, 𝑦, 𝑧) = (𝑦 + 𝑧, 2𝑥, 4𝑧) for all (𝑥, 𝑦, 𝑧) ∈ ℝ3 .

1
0 0
−1 2
0 1 1 0 1 1 1
𝐴𝑇 = 2 0 0 ⟹ 𝐴 𝑇 −1 = 2 0 0 = 1 0 − .
0 0 4 0 0 4 4
1
0 0
4

Then 𝑇 is invertible and the linear transformation 𝑇 −1 : ℝ3 → ℝ3 is defined by


1
0 0
2 𝑥
−1 1 𝑦 𝑧 𝑧
𝑇 𝑥, 𝑦, 𝑧 = 1 0 − 𝑦 = ,𝑥 − ,
4 𝑧 2 4 4
1
0 0
4
for all (𝑥, 𝑦, 𝑧) ∈ ℝ .
3

13
Proposition

Let 𝑇1 : ℝ𝑛 ⟶ ℝ𝑝 and 𝑇2 : ℝ𝑝 ⟶ ℝ𝑚 be linear transformations.


The transformation matrix of the composition 𝑇2 ∘ 𝑇1 can be find by

𝐴 𝑇2 ∘ 𝑇1 = 𝐴 𝑇2 𝐴 𝑇1 .

14
CHALLENGE
Define on Python the linear transformation 𝑇 of the
previous example and check the image through 𝑇 of
the vector (23,477,100).
Exercises
1.4.1 Find the transformation matrices of the linear transformations defined below.
a) 𝑇: ℝ3 → ℝ2 , 𝑇 𝑥1 , 𝑥2 , 𝑥3 = 𝑥1 − 5𝑥2 + 4𝑥3 , 𝑥2 − 6𝑥3
b) 𝑇: ℝ2 → ℝ4 , 𝑇 𝑥1 , 𝑥2 = 2𝑥2 − 3𝑥1 , 𝑥1 − 4𝑥2 , 0, 𝑥2
c) 𝑇: ℝ4 → ℝ4 , 𝑇 𝑥1 , 𝑥2 , 𝑥3 , 𝑥4 = 0, 𝑥1 + 𝑥2 , 𝑥2 + 𝑥3 , 𝑥3 + 𝑥4

1.4.2. Show that the transformations below are not linear.


a) 𝑇: ℝ2 → ℝ3 , 𝑇 𝑥1 , 𝑥2 = 2𝑥1 − 3𝑥2 , 𝑥1 + 4, 5𝑥2
b) 𝑇: ℝ2 → ℝ2 , 𝑇 𝑥1 , 𝑥2 = 4𝑥1 − 2𝑥2 , 3 𝑥2
c) 𝑇: ℝ4 → ℝ2 , 𝑇 𝑥1 , 𝑥2 , 𝑥3 , 𝑥4 = 𝑥1 𝑥2 , 𝑥3 + 𝑥4 ,

16
Exercises
1.4.3 Consider two linear transformations 𝑇: ℝ3 → ℝ3 and 𝐺: ℝ3 → ℝ3 . It is known that
𝑇 1,1,0 = 1,0,1 , 𝑇 1,0,0 = 1,0,2 , 𝑇 0,1,1 = 0,1,0 and 𝐺 𝑥, 𝑦, 𝑧 = 𝑥, 2𝑥 + 𝑦 − 𝑧, 𝑦 .
a) Find 𝑇 0,1,0 .
b) Find 𝐴 𝑇 .
c) Is the 𝐺 the inverse of 𝑇?

1.4.4. Consider two linear transformations 𝑇1 : ℝ → ℝ3 and 𝑇2 : ℝ3 → ℝ3 defined as:


𝑇1 𝑥 = 𝑥, 0,2𝑥 and 𝑇2 𝑥, 𝑦, 𝑧 = 𝑦 − 𝑧, 𝑥 + 2𝑦 − 𝑧, −𝑥 − 𝑦 .
a) Find (𝑇2 ∘ 𝑇1 ) 3 .
b) Find the transformation matrices of 𝑇1 , 𝑇2 and 𝑇2 ∘ 𝑇1 .
c) Show that 𝑇2 is not surjective, i.e., there are vectors of ℝ3 that are not images
of any vector of the domain of 𝑇2 .

17
Exercises
1.4.5 Let 𝑇: ℝ3 → ℝ3 and 𝑆: ℝ2 → ℝ3 be linear transformations, 𝑆 ∘ 𝑇 their composition,
−2 −1 3
𝑇 𝑥1 , 𝑥2 , 𝑥3 = 𝑥1 , 𝑥2 − 𝑥3 , 𝑥3 − 𝑥1 and 𝐴𝑆∘𝑇 = 1 −1 1 .
1 0 −1
a) Find the transformation matrix of 𝑇.
b) Find the transformation matrix of 𝑆.

1.4.6. Consider 𝑇: ℝ4 → ℝ3 , defined by 𝑇 𝑥1 , 𝑥2 , 𝑥3 , 𝑥4 = 2𝑥1 + 𝑥3 + 3𝑥4 , 2𝑥1 + 2𝑥4 , 𝑥3 + 𝑥4 .


a) Find 𝐴𝑇 , the transformation matrix of 𝑇.
b) Find the general expression of the linear transformation 𝑆 whose
transformation matrix, 𝐴𝑆 , is the transpose of 𝐴𝑇 .
c) Verify if different objects have necessarily different images through 𝑇.
d) Consider 𝒗 = 𝑎, 𝑏, 𝑐 where 𝑎, 𝑏, 𝑐 are the last three digits of your student’s
number. Verify if there is an object which image through 𝑇 is 𝒗.

18
Exercises
1.4.7 For 𝑘 ∈ ℝ, consider 𝑇: ℝ3 → ℝ3 , defined by 𝑇 𝑥, 𝑦, 𝑧 = −2𝑥 + 𝑦, 2𝑥 + 𝑦 + 𝑧𝑘, 𝑦 + 𝑘𝑧 .
a) Find the transformation matrix of 𝑇 as a function on 𝑘.
b) For which values of 𝑘 is 𝑇 invertible?

1.4.8. True or false?


a) There are linear transformations from ℝ4 to ℝ2 , such that to different objects
necessarily correspond different images.
b) There is no linear transformation 𝑇 that transforms the vectors 1,1,0 , 1,0,1
and (2,1,1) into the vectors 1,0,0 , 0,1,0 and (0,0,1), respectively.

19
1.4.9 Carefully explain the output of the following programs. Exercises
i. A

ii. B

iii. C

20

You might also like