31
Linear Transformations Spring 2019 Linear Transformations Spring 2019 1 / 21

Linear Transformations - Loyola University Marylandmath.loyola.edu/~chidyagp/sp19/linear_transformations.pdfLinear Transformations in 2D We focus on T from R2!R2 A is a 2 2 matrix

  • Upload
    others

  • View
    6

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Linear Transformations - Loyola University Marylandmath.loyola.edu/~chidyagp/sp19/linear_transformations.pdfLinear Transformations in 2D We focus on T from R2!R2 A is a 2 2 matrix

Linear Transformations

Spring 2019

Linear Transformations Spring 2019 1 / 21

Page 2: Linear Transformations - Loyola University Marylandmath.loyola.edu/~chidyagp/sp19/linear_transformations.pdfLinear Transformations in 2D We focus on T from R2!R2 A is a 2 2 matrix

Linear Transformations

A function T from Rn → Rm is called a linear transformation if thereexists an m × n matrix A such that

T (~x) = A~x

for all ~x ∈ Rn satisfying the following:

T (~v + ~w) = T (~v) + T (~w), ∀~v , ~w ∈ Rn

T (c~v) = cT (~v), ∀~v ∈ Rn, c ∈ R

Linear transformations preserve lines, unlike nonlinear transformations thatmay transform a line segment into a parabolic curve, or ellipse

Linear Transformations Spring 2019 2 / 21

Page 3: Linear Transformations - Loyola University Marylandmath.loyola.edu/~chidyagp/sp19/linear_transformations.pdfLinear Transformations in 2D We focus on T from R2!R2 A is a 2 2 matrix

Linear Transformations

A function T from Rn → Rm is called a linear transformation if thereexists an m × n matrix A such that

T (~x) = A~x

for all ~x ∈ Rn satisfying the following:

T (~v + ~w) = T (~v) + T (~w), ∀~v , ~w ∈ Rn

T (c~v) = cT (~v), ∀~v ∈ Rn, c ∈ R

Linear transformations preserve lines, unlike nonlinear transformations thatmay transform a line segment into a parabolic curve, or ellipse

Linear Transformations Spring 2019 2 / 21

Page 4: Linear Transformations - Loyola University Marylandmath.loyola.edu/~chidyagp/sp19/linear_transformations.pdfLinear Transformations in 2D We focus on T from R2!R2 A is a 2 2 matrix

Linear Transformations

A function T from Rn → Rm is called a linear transformation if thereexists an m × n matrix A such that

T (~x) = A~x

for all ~x ∈ Rn satisfying the following:

T (~v + ~w) = T (~v) + T (~w), ∀~v , ~w ∈ Rn

T (c~v) = cT (~v), ∀~v ∈ Rn, c ∈ R

Linear transformations preserve lines, unlike nonlinear transformations thatmay transform a line segment into a parabolic curve, or ellipse

Linear Transformations Spring 2019 2 / 21

Page 5: Linear Transformations - Loyola University Marylandmath.loyola.edu/~chidyagp/sp19/linear_transformations.pdfLinear Transformations in 2D We focus on T from R2!R2 A is a 2 2 matrix

Linear Transformations in 2D

We focus on T from R2 → R2

A is a 2× 2 matrix and ~v is a 2× 1 column vector.

Special examples of linear transformations include:1 scaling transformations2 rotations3 translations

Linear Transformations Spring 2019 3 / 21

Page 6: Linear Transformations - Loyola University Marylandmath.loyola.edu/~chidyagp/sp19/linear_transformations.pdfLinear Transformations in 2D We focus on T from R2!R2 A is a 2 2 matrix

Linear Transformations in 2D

We focus on T from R2 → R2

A is a 2× 2 matrix and ~v is a 2× 1 column vector.

Special examples of linear transformations include:1 scaling transformations2 rotations3 translations

Linear Transformations Spring 2019 3 / 21

Page 7: Linear Transformations - Loyola University Marylandmath.loyola.edu/~chidyagp/sp19/linear_transformations.pdfLinear Transformations in 2D We focus on T from R2!R2 A is a 2 2 matrix

Linear Transformations in 2D

We focus on T from R2 → R2

A is a 2× 2 matrix and ~v is a 2× 1 column vector.

Special examples of linear transformations include:1 scaling transformations2 rotations3 translations

Linear Transformations Spring 2019 3 / 21

Page 8: Linear Transformations - Loyola University Marylandmath.loyola.edu/~chidyagp/sp19/linear_transformations.pdfLinear Transformations in 2D We focus on T from R2!R2 A is a 2 2 matrix

Scaling Transformations

T : R2 → R2 defined by T (~v) = c~v for c ∈ (0,∞)

c > 1 - dillation by a factor of c

c < 1 - contraction by a factor of c

In matrix form

T([

xy

])=

[c 00 c

] [xy

]=

[cxcy

]

Linear Transformations Spring 2019 4 / 21

Page 9: Linear Transformations - Loyola University Marylandmath.loyola.edu/~chidyagp/sp19/linear_transformations.pdfLinear Transformations in 2D We focus on T from R2!R2 A is a 2 2 matrix

Scaling Transformations

-10 -8 -6 -4 -2 0 2 4 6 8 10

-10

-8

-6

-4

-2

0

2

4

6

8

10Scaling

Linear Transformations Spring 2019 5 / 21

Page 10: Linear Transformations - Loyola University Marylandmath.loyola.edu/~chidyagp/sp19/linear_transformations.pdfLinear Transformations in 2D We focus on T from R2!R2 A is a 2 2 matrix

Rotations

Rotations by an angle θ about the origin where the rotation is measuredfrom the positive x-axis in an anticlockwise direction

In matrix form, the linear transformation can be represented as:

T([

xy

])=

[cos θ − sin θsin θ cos θ

] [xy

]

Linear Transformations Spring 2019 6 / 21

Page 11: Linear Transformations - Loyola University Marylandmath.loyola.edu/~chidyagp/sp19/linear_transformations.pdfLinear Transformations in 2D We focus on T from R2!R2 A is a 2 2 matrix

Reflections

Reflections about a line L through the origin, e.g.

Reflecting a point in R2 about the y -axis:

T([

xy

])=

[−xy

]in matrix form

T([

xy

])=

[−1 00 1

] [xy

]In general, the transformation corresposinding to a reflection aboutthe line L making an angle θ with the positive x − axis is given by

A =

[cos 2θ sin 2θsin 2θ − cos 2θ

]=

[a bb −a

], a2 + b2 = 1

Linear Transformations Spring 2019 7 / 21

Page 12: Linear Transformations - Loyola University Marylandmath.loyola.edu/~chidyagp/sp19/linear_transformations.pdfLinear Transformations in 2D We focus on T from R2!R2 A is a 2 2 matrix

Reflections

Reflections about a line L through the origin, e.g.

Reflecting a point in R2 about the y -axis:

T([

xy

])=

[−xy

]in matrix form

T([

xy

])=

[−1 00 1

] [xy

]

In general, the transformation corresposinding to a reflection aboutthe line L making an angle θ with the positive x − axis is given by

A =

[cos 2θ sin 2θsin 2θ − cos 2θ

]=

[a bb −a

], a2 + b2 = 1

Linear Transformations Spring 2019 7 / 21

Page 13: Linear Transformations - Loyola University Marylandmath.loyola.edu/~chidyagp/sp19/linear_transformations.pdfLinear Transformations in 2D We focus on T from R2!R2 A is a 2 2 matrix

Reflections

Reflections about a line L through the origin, e.g.

Reflecting a point in R2 about the y -axis:

T([

xy

])=

[−xy

]in matrix form

T([

xy

])=

[−1 00 1

] [xy

]In general, the transformation corresposinding to a reflection aboutthe line L making an angle θ with the positive x − axis is given by

A =

[cos 2θ sin 2θsin 2θ − cos 2θ

]=

[a bb −a

], a2 + b2 = 1

Linear Transformations Spring 2019 7 / 21

Page 14: Linear Transformations - Loyola University Marylandmath.loyola.edu/~chidyagp/sp19/linear_transformations.pdfLinear Transformations in 2D We focus on T from R2!R2 A is a 2 2 matrix

Reflection

-3 -2 -1 0 1 2 3

-3

-2

-1

0

1

2

3

Linear Transformations Spring 2019 8 / 21

Page 15: Linear Transformations - Loyola University Marylandmath.loyola.edu/~chidyagp/sp19/linear_transformations.pdfLinear Transformations in 2D We focus on T from R2!R2 A is a 2 2 matrix

Shear

y -shear

T =

[1 0a 1

]x-shear

T =

[1 b0 1

]

Linear Transformations Spring 2019 9 / 21

Page 16: Linear Transformations - Loyola University Marylandmath.loyola.edu/~chidyagp/sp19/linear_transformations.pdfLinear Transformations in 2D We focus on T from R2!R2 A is a 2 2 matrix

x-shear

T =

[1 2.50 1

]

-10 -5 0 5 10

-10

-8

-6

-4

-2

0

2

4

6

8

10Shear

Linear Transformations Spring 2019 10 / 21

Page 17: Linear Transformations - Loyola University Marylandmath.loyola.edu/~chidyagp/sp19/linear_transformations.pdfLinear Transformations in 2D We focus on T from R2!R2 A is a 2 2 matrix

Compositions of transformations

Given two linear transformations T and S both R2 → R2 with

T (~v) = A~v and S(~v) = B~v ∀~v ∈ R2

then the composition of the transformation T and S , T ◦ S AB(T ◦ S

)(~v) = T

(S(~v

))= T

(B~v

)= AB~v

Linear Transformations Spring 2019 11 / 21

Page 18: Linear Transformations - Loyola University Marylandmath.loyola.edu/~chidyagp/sp19/linear_transformations.pdfLinear Transformations in 2D We focus on T from R2!R2 A is a 2 2 matrix

Compositions of transformations

Rotation θ = π8 then reflection about y = 0, then dilation by a factor of 2.

-6 -4 -2 0 2 4 6

-6

-4

-2

0

2

4

6

Linear Transformations Spring 2019 12 / 21

Page 19: Linear Transformations - Loyola University Marylandmath.loyola.edu/~chidyagp/sp19/linear_transformations.pdfLinear Transformations in 2D We focus on T from R2!R2 A is a 2 2 matrix

Orthorgonal transformations

A linear transformation T : Rn → Rn is called orthogonal if itpreserves the length of vectors:

||T (~v)|| = ||~v ||, ∀~v ∈ Rn

If T (~v) = A~v is an orthogonal transformation, A is an orthogonalmatrix

1 ||A~v || = ||~v ||, ∀~v ∈ Rn

2 The columns of A form an orthonormal basis of Rn

3 ATA = I n4 A−1 = AT

Orthogonal transformations also preserve dot products of vectors andthus angles are preserved

Linear Transformations Spring 2019 13 / 21

Page 20: Linear Transformations - Loyola University Marylandmath.loyola.edu/~chidyagp/sp19/linear_transformations.pdfLinear Transformations in 2D We focus on T from R2!R2 A is a 2 2 matrix

Orthorgonal transformations

A linear transformation T : Rn → Rn is called orthogonal if itpreserves the length of vectors:

||T (~v)|| = ||~v ||, ∀~v ∈ Rn

If T (~v) = A~v is an orthogonal transformation, A is an orthogonalmatrix

1 ||A~v || = ||~v ||, ∀~v ∈ Rn

2 The columns of A form an orthonormal basis of Rn

3 ATA = I n4 A−1 = AT

Orthogonal transformations also preserve dot products of vectors andthus angles are preserved

Linear Transformations Spring 2019 13 / 21

Page 21: Linear Transformations - Loyola University Marylandmath.loyola.edu/~chidyagp/sp19/linear_transformations.pdfLinear Transformations in 2D We focus on T from R2!R2 A is a 2 2 matrix

Orthorgonal transformations

A linear transformation T : Rn → Rn is called orthogonal if itpreserves the length of vectors:

||T (~v)|| = ||~v ||, ∀~v ∈ Rn

If T (~v) = A~v is an orthogonal transformation, A is an orthogonalmatrix

1 ||A~v || = ||~v ||, ∀~v ∈ Rn

2 The columns of A form an orthonormal basis of Rn

3 ATA = I n4 A−1 = AT

Orthogonal transformations also preserve dot products of vectors andthus angles are preserved

Linear Transformations Spring 2019 13 / 21

Page 22: Linear Transformations - Loyola University Marylandmath.loyola.edu/~chidyagp/sp19/linear_transformations.pdfLinear Transformations in 2D We focus on T from R2!R2 A is a 2 2 matrix

Random Orthorgonal transformations

T= orth(rand(2,2))

-3 -2 -1 0 1 2 3

-3

-2

-1

0

1

2

3Orthorgonal Transformation

Linear Transformations Spring 2019 14 / 21

Page 23: Linear Transformations - Loyola University Marylandmath.loyola.edu/~chidyagp/sp19/linear_transformations.pdfLinear Transformations in 2D We focus on T from R2!R2 A is a 2 2 matrix

Random Transformation

M =

[0.8212 0.04300.0154 0.1690

]

-3 -2 -1 0 1 2 3

-3

-2

-1

0

1

2

3Random Transformation

Can this transformation be undone?

Yes! det(M)= 0.1381

Linear Transformations Spring 2019 15 / 21

Page 24: Linear Transformations - Loyola University Marylandmath.loyola.edu/~chidyagp/sp19/linear_transformations.pdfLinear Transformations in 2D We focus on T from R2!R2 A is a 2 2 matrix

Random Transformation

M =

[0.8212 0.04300.0154 0.1690

]

-3 -2 -1 0 1 2 3

-3

-2

-1

0

1

2

3Random Transformation

Can this transformation be undone?Yes! det(M)= 0.1381

Linear Transformations Spring 2019 15 / 21

Page 25: Linear Transformations - Loyola University Marylandmath.loyola.edu/~chidyagp/sp19/linear_transformations.pdfLinear Transformations in 2D We focus on T from R2!R2 A is a 2 2 matrix

Random non-invertable Transformation

M =

[0.9884 0.34090.0000 0.0000

]

-3 -2 -1 0 1 2 3

-3

-2

-1

0

1

2

3Random Singular Transformation

Linear Transformations Spring 2019 16 / 21

Page 26: Linear Transformations - Loyola University Marylandmath.loyola.edu/~chidyagp/sp19/linear_transformations.pdfLinear Transformations in 2D We focus on T from R2!R2 A is a 2 2 matrix

Affine transformations

These are mappings of the form

T (~v) = A~v + ~b

i.e. affine transformations are composed of a linear transformation (A~v)then shifted in the direction ~b

Affine transformations preserve collinearity and ratios of distances.

Translations, dilations, contractions,reflections and rotations are allexamples of affine transformations.

Linear Transformations Spring 2019 17 / 21

Page 27: Linear Transformations - Loyola University Marylandmath.loyola.edu/~chidyagp/sp19/linear_transformations.pdfLinear Transformations in 2D We focus on T from R2!R2 A is a 2 2 matrix

Affine transformations

These are mappings of the form

T (~v) = A~v + ~b

i.e. affine transformations are composed of a linear transformation (A~v)then shifted in the direction ~b

Affine transformations preserve collinearity and ratios of distances.

Translations, dilations, contractions,reflections and rotations are allexamples of affine transformations.

Linear Transformations Spring 2019 17 / 21

Page 28: Linear Transformations - Loyola University Marylandmath.loyola.edu/~chidyagp/sp19/linear_transformations.pdfLinear Transformations in 2D We focus on T from R2!R2 A is a 2 2 matrix

Affine transformations

T =

[12 00 −1

2

]+

[34

]

-6 -4 -2 0 2 4 6

-6

-4

-2

0

2

4

6Affine Transformations

Linear Transformations Spring 2019 18 / 21

Page 29: Linear Transformations - Loyola University Marylandmath.loyola.edu/~chidyagp/sp19/linear_transformations.pdfLinear Transformations in 2D We focus on T from R2!R2 A is a 2 2 matrix

Affine transformations and fractals

Consider three different linear transformations on points (x , y) starting at (0, 0)

and one linear transformation performed randomly with different probabilities

85% of the time:

T 1 = A1~v + ~b1 =

[0.85 0.04−0.04 0.85

]~v +

[0

1.6

]7% of the time:

T 2 = A2~v + ~b2 =

[0.20 −0.260.23 0.22

]~v +

[0

1.6

]7% of the time:

T 3 = A3~v + ~b3 =

[−0.15 0.280.26 0.24

]~v +

[0

0.44

]1% of the time:

T 4 = A4~v =

[0 00 0.16

]~v

Linear Transformations Spring 2019 19 / 21

Page 30: Linear Transformations - Loyola University Marylandmath.loyola.edu/~chidyagp/sp19/linear_transformations.pdfLinear Transformations in 2D We focus on T from R2!R2 A is a 2 2 matrix

Affine transformations and fractals

Linear Transformations Spring 2019 20 / 21

Page 31: Linear Transformations - Loyola University Marylandmath.loyola.edu/~chidyagp/sp19/linear_transformations.pdfLinear Transformations in 2D We focus on T from R2!R2 A is a 2 2 matrix

Affine transformations and fractals

randsample(4,1,true,[0.85 0.07 0.07 0.01]) to generaterandom integers with weights

Preallocate a matrix to store the computed points

Store each computed point in a matrix, then plot the matrix

Linear Transformations Spring 2019 21 / 21