Notebook 8 – Math 2121, Fall 2020

An n×n matrix for n=1 is just a number A=[a].

Such a matrix is invertible if and only if a0.

It is clear that we can "move around" in the subspace of invertible 1×1 matrices within R1, in the sense that we can perturb the entries of A slightly and still have an invertible matrix: specifically, [a+δ] is still invertible as long as |δ| is small.

In particular, this is true whenever |δ|<|a|.

However, it's also clear that there are the set of invertible 1×1 matrices has two connected components: the matrices A=[a] with a<0 and those with a>0.

If we start with a<0, then there is no way to gradually perturb a to get a positive value without passing through a=0, at which point the matrix would be non-invertible. So there is no path that stays completely within the set of invertible matrices connecting, say A=[1] and A=[1].

18.2 μs
420 μs

Let's investigate how this generalizes to 2×2 matrices.

A 2×2 matrix has four entries. Geometrically, there is no difference between the set of all 2×2 matrices and the set of vectors R4. We have just split our four numbers into two columns rather than kept them in one.

Suppose A=[abcd].

This matrix is invertible if and only if the vectors [ac] and [bd] are linearly independent, that is, not scalar multiples of each other. Assume this is the case.

I claim that it is still true that we can "move around" within the subset of invertible 2×2 matrices, in the sense that the perturbed matrix

[a+δ1b+δ2c+δ3d+δ4]

is still invertible for any choice of numbers δi that have sufficiently small absolute value.

Let's justify this with a random example.

9.4 μs
A
2×2 Array{Float64,2}:
 0.98  -1.89
 1.99  -1.64
156 ms

ε = 0.5

12.4 s

We need a way to visualize the matrix A.

A simple method is to draw the vectors [ac] and [bd] that are the columns of A:

4.6 μs
121 ms

In we increase the parameter ε above, then two colored regions appear in this graph.

The blue circle surrounds the set of vectors [a+δ1c+δ3] with δ12+δ32<ε.

The red circle surrounds the set of vectors [b+δ2d+δ4] with δ22+δ42<ε.

Choose ϵ to be small enough that the blue and red regions do not overlap. Suppose we have another 2×2 matrix B that we draw as a pair of vectors in R2. If the endpoints of these vectors are contained in the blue and red circles, then B is guaranteed to invertible. (Why?)

8.3 μs

Given A and ε, how would you figure out if the blue and red regions overlap? It's possible to give an exact mathematical formula for this, using only basic algebra and planar geometry. But this is a little complicated, as you can see if you examine the code below, which implements an overlaps method to compute the answer programatically.

8.2 μs
overlaps (generic function with 1 method)
333 μs
true
13 μs

As long as the red and blue regions do not overlap, then [a+δ1b+δ2c+δ3d+δ4] is invertible for every choice δ1,δ2,δ3,δ4 with δ12+δ32<ε and δ22+δ42<ε.

These conditions involving square roots are satisfied, for example, as long as we have 12ε<δi<12ε for each i=1,2,3,4.

This shows that we can 'move' from A to any matrix B, whose columns correspond to points in the red and blue squares, while always staying inside the set of 2×2 matrices.

The following method computes (approximately) the largest value of ε that ensures that the red and blue regions above do not overlap. I'll call this the radius of A.

13.2 μs
radius (generic function with 2 methods)
67 μs
0.4240976183724846
112 ms

Let's create another random invertible 2-by-2 matrix B.

7.2 μs
16.1 μs
18 ms

Is it possible to traverse a path from A to B that stays completely inside the set of invertible 2-by-2 matrices? There is certainly a path from A to B inside the set of all 2-by-2 matrices.

The simplest such path is the line from A to B: this is the sequence of matrices

A+t(BA)

as tR varies over the numbers in the interval 0t1.

13.2 μs

For our matrices, give equally spaces points on this line are given by

7.3 μs
48.6 ms

Some questions we could ask: what does this line look like in terms of our pictures of 2-by-2 matrices as pairs of vectors in R2? And does this line stay in the set of invertible 2-by-2 matrices?

10.4 μs
step! (generic function with 1 method)
1.6 ms

Using the above struct, we can implement a method that tells us whether the line from A to B does stay inside the set of invertible 2-by-2 matrices.

8.1 μs
line_stays_invertible (generic function with 1 method)
48.4 μs

The following method returns how many steps we take before we know if our line reaches B.

5.8 μs
path_length (generic function with 1 method)
106 μs

For the matrices A and B:

9.1 μs
4.8 μs
true
1.2 ms
1.5 ms

The animation below shows the path that results from trying to follow the line from A to B while staying inside the set of invertible matrices.

7.1 μs
animation (generic function with 1 method)
144 μs
1.9 s

Sometimes the line from A to B stays in the set of 2×2 invertible matrices, sometimes it doesn't.

A region of space that contains the line segment connecting any two of its points is called convex. The solid sphere is convex. The solid torus (donut shape) is not convex. All regular polygons are convex regions of R2. Star shapes are not convex.

Anyways, our experiments show that the set of invertible 2-by-2 matrices is not convex. But we can say something more precise.

9.4 μs
367 ns

We saw in the lecture notes that A=[abcd] is invertible if and only if adbc0.

In a week or so, we'll that the number adbc is called the determinant of A, and is written detA.

When we perturb A slightly, the value of detA changes by a small amount. So if detA starts out positive, and we perform a sequence of perturbations that remain in the set of invertible matrices, ending up at some invertible matrix B, then detB must also be positive.

In particular, traveling along our invertible matrix path from A to B cannot change the sign of the determinant. We can only change the sign by passing through a non-invertible matrix.

12.9 μs

It turns out there are exactly two connected components of the set of 2-by-2 invertible matrices: the subset of matrices with negative determinant and the subset of matrices with positive determinant.

There are exactly the same number of such matrices.

If A=[abcd] has positive determinant then [badc] has negative determinant.

(Because detA=adbc.)

Any two 2-by-2 matrices with positive determinant are connected by a path the stays completely inside the set of invertible matrices.

However, these paths cannot always be lines: the subset of 2-by-2 invertible matrices with positive (or negative) determinant is also not convex. We can check this:

11 μs
count_reachable_pairs (generic function with 1 method)
51.5 μs
65
200 ms
find_unreachable (generic function with 1 method)
65.3 μs

Here are two matrices with positive determinant:

7.4 μs
31.9 ms
1×2 Array{Float64,2}:
 50.566399999999994  15.118999999999998
285 ms

However, the line between them does not stay in the set of invertible matrices:

11.6 μs
false
4 ms
4.3 ms
3.6 s

By using a different step function we can nevertheless construct a path from source to target that stays inside the set of invertible matrices.

7.8 μs
nonlinear_step! (generic function with 1 method)
131 μs
248 ms
15.3 s

The shortest path from A to B that stays inside the set of invertible matrices is called a geodesic.

If the line from A to B always stays invertible, then it is the unique geodesic.

When this line does not stay invertible, how could we construct a geodesic from A to B? How could we derive a formula for its length in terms of A and B?

20 μs