Notebook 5 – Math 2121, Fall 2020

In today's notebook we'll explore the plots of some linear transformations.

Running this notebook (optional)

If you have Pluto up and running, you can access the notebook we are currently viewing by entering this link (right click -> Copy Link) in the Open from file menu in Pluto.

Linear transformations

A linear transformation RnRm is a function T that takes inputs xRn and produces outputs T(x)Rm such that T(x+y)=T(x)+T(y) and T(cx)=cT(x) for all x,yRn and cR.

If you have an m×n matrix A, then the formula T(x)=Ax for xRn defines a linear transformation RnRm. In this case we say that A is the standard matrix of T.

Does every linear transformation arise in this way? (Yes.)

Can a linear transformation have more than one standard matrix? (No.)

Given a linear transformation, how do you find its standard matrix?

Let's investigate these questions when n and m are small numbers.

17 μs
Helper methods
7.9 μs
pprint (generic function with 1 method)
49.4 μs
mesh_inputs (generic function with 1 method)
44.7 μs
input_plot (generic function with 1 method)
62.8 μs
transformation_plot (generic function with 2 methods)
70.8 μs
Creating a linear transformation from R1R2
6.5 μs
random_linear_transformation (generic function with 1 method)
120 μs
T
#2 (generic function with 1 method)
67.2 ms

Input in R1

x = 1

218 ms
22.6 s
9.9 μs
true
75.3 ms

The pictures above show a random linear transformation T:R1R2.

When we vary the input value x, the output is a vector that always points along the same line.

Changing x just rescales this vector.

If A=T([1]) then T([x])=A[x]=xA for all xR.

6.7 μs
Creating a linear transformation from R2R2
3.5 μs
U
#2 (generic function with 1 method)
35.5 μs

Display: sum mesh

14.2 ms

Input vectors in R2

x1 = y1 =

x2 = y2 =

rotate =

19.4 ms
x = [ 1.0]     y = [ 0.0]
    [ 0.0]         [ 1.0]
61 μs
U(x) = [ 0.8]     U(y) = [ 0.2]
       [-0.2]            [-0.3]
23.6 μs
25.8 ms
2×2 Array{Float64,2}:
  0.8   0.2
 -0.2  -0.3
82 ms
true
20.8 μs

The pictures above show a random linear transformation U:R2R2.

The key property of this transformation is that it preserves parallelograms: the output of all points in the parallelogram with sides x and y is just the parallelogram with sides U(x) and U(y).

Another crucial aspect of linear transformations is that if U1:RmRp and U2:RnRm are both linear, then the function U(x)=U1(U2(x)) is a linear transformation U:RnRp.

We can test this for n=m=p=2.

8.7 μs
Creating a linear transformation from a matrix

A_11 = A_12 =

A_21 = A_22 =

138 μs
A
2×2 Array{Int64,2}:
 1  0
 0  1
31.9 ms
73.5 ms

Input vectors in R2

x1 = y1 =

x2 = y2 =

rotate =

168 μs
x = [ 1.0]     y = [ 0.0]
    [ 0.0]         [ 1.0]
69.6 μs
6.9 ms
Nonlinear transformations

Finally, let's compare with plots of functions R2R2 that are not linear.

5.8 μs
random_quadratic_transformation (generic function with 1 method)
96.4 μs
Q
(::Main.workspace741.var"#f#8"{Int64,Int64,Array{Array{Float64,2},1}}) (generic function with 1 method)
67.4 ms

Input vectors in R2

x1 = y1 =

x2 = y2 =

rotate =

173 μs
x = [ 1.0]     y = [ 0.0]
    [ 0.0]         [ 1.0]
72.4 μs
Q(x) = [-0.18]     Q(y) = [ 1.13]
       [ 1.91]            [-1.68]
30.2 μs
12.1 ms

Note that parallelograms are not preserved by this transformation.

3 μs