Posts tagged with mappings

The rank-nullity theorem in linear algebra says that dimensions either get

  • thrown in the trash
  • or show up

after the mapping.


By “the trash” I mean the origin—that black hole of linear algebra, the /dev/null, the ultimate crisscross paper shredder, the ashpile, the wormhole to void and cancelled oblivion; that country from whose bourn no traveller ever returns.

The way I think about rank-nullity is this. I start out with all my dimensions lined up—separated, independent, not touching each other, not mixing with each other. ||||||||||||| like columns in an Excel table. I can think of the dimensions as separable, countable entities like this whenever it’s possible to rejigger the basis to make the dimensions linearly independent.


I prefer to always think about the linear stuff in its preferably jiggered state and treat how to do that as a separate issue.

So you’ve got your 172 row × 81 column matrix mapping 172→ separate dimensions into →81 dimensions. I’ll also forget about the fact that some of the resultant →81 dimensions might end up as linear combinations of the input dimensions. Just pretend that each input dimension is getting its own linear λ stretch. Now linear just means multiplication.

linear maps as multiplication
linear mappings -- notice they're ALL straight lines through the origin!

Linear stretches λ affect the entire dimension the same. They turn a list like [1 2 3 4 5] into [3 6 9 12 15] (λ=3). It couldn’t be into [10 20 30 − 42856712 50] (λ=10 except not everywhere the same stretch=multiplication).


Also remember – everything has to stay centred on 0. (That’s why you always know there will be a zero subspace.) This is linear, not affine. Things stay in place and basically just stretch (or rotate).

So if my entire 18th input dimension [… −2 −1 0 1 2 3 4 5 …] has to get transformed the same, to [… −2λ −λ 0 λ 2λ 3λ 4λ 5λ …], then linearity has simplified this large thing full of possibility and data, into something so simple I can basically treat it as a stick |.

If that’s the case—if I can’t put dimensions together but just have to λ stretch them or nothing, and if what happens to an element of the dimension happens to everybody in that dimension exactly equal—then of course I can’t stick all the 172→ input dimensions into the →81 dimension output space. 172−81 of them have to go in the trash. (effectively, λ=0 on those inputs)

So then the rank-nullity theorem, at least in the linear context, has turned the huge concept of dimension (try to picture 11-D space again would you mind?) into something as simple as counting to 11 |||||||||||.

A fun exercise/problem/puzzle introducing function space.


A perlmonk asked for a “custom random number generator”. This is a non-maths person’s word for a probability distribution.


It was a slightly unusual case, but not hard. After I’d finished several easy steps, though, the final formula looked like it had been scrivened by a wizard:


Of course, I’m not a wizard; I’m not even an acolyte. The steps I took just involved (1) a certain viewpoint on probability distributions, and (2) puzzles that an 11-year-old could solve. 

This is how formulas in textbooks get to look so daunting.

 —skippable interlude— 

I guess I figured this out years ago, when I first saw the Black-Scholes-Merton formula in business school.


The BSM is just a continuous-time limit of “Did the stock go up or down in the last 5 minutes?” But the BSM is dressed up with such frightening language that it seems much more inscrutable than “A tree generated from two alternatives which are repeated”.

\frac{\partial V}{\partial t} + \frac{1}{2}\sigma^2 S^2 \frac{\partial^2 V}{\partial S^2} + rS\frac{\partial V}{\partial S} - rV = 0

For example in the Wikipedia article on BSM the subheads include: Greeks (), elliptic PDE’s, derivation, interpretation, criticism, extensions of the model, notation, assumptions, references. It’s 24 pagedowns long. From this pretence of sophistication follows:

I’ve seen it in biology, chemistry, and physics textbooks as well. A convoluted formula encodes the results of a simple model. Because of scientism the students commit it to memory as well as more derived results. Hopefully they come to find that it was not so complicated only a professors could understand it.

But I don’t think that’s common knowledge, so formulæ retain an impenetrable mysticism and the rituals of uncomprehending repetition continue.

 —back to the main idea— 

It needn’t be so enigmatic. I can demonstrate that by showing how the ugly beast above looks if you break it into steps. It’s simpler as several lines of code than as one formula.

Client Request

Anonymous Monk wanted a probability distribution like this:


with the median at x and equal probability masses between [x/y,x] and [x, x•y]


I’m going to take a Gaussian and map the endpoints to what the client wants.


The result will tend to the centre a “normal” amount of the time and yet will be squashed onto the domain the client wants.

Match up the Endpoints

I know that exp maps (−∞,0] onto (0,1]

To follow that, I need a transformation that will match (0,1) to (x/y, x). So 1 ⟼ x and 0 ⟼ x/y.

0 ⟼ x and 1 ⟼ xy

as 6 lines of Code

my $random = ...; #Gaussians, however you fry them up
if ($random <= 0) { 
$random = exp($random); #map (−∞,0) → (0,1)
$random =     ; #map (0,1) → (x, x•y)

else { #map (0, +∞) → (0,1)
$random = 1 − exp(−$random);  #map (0, +∞) → (0,1) ... which is the same problem as above except backwards
$random =     ; #map (0,1) → (x/y, x)


  1. use paper first, write code second
  2. draw a picture
  3. if necessary, break it into a simpler picture
  4. compose the answers to the parts
  5. code the pieces in separate lines

The equation at the top does decompose into the sequence of steps I just outlined. But even though it looks simple as a sequence of steps, the one-line formula is scary.

[Alexander] Grothendieck expanded our … conception of geometry … by noticing that a geometric object 𝑿 can be … understood in terms of … maps from other objects into 𝑿.
Kevin Lin (@sqrtnegative1)

(Source: quora.com)

Here’s a physically intuitive reason that rotations ↺

Matrix Transform

(which seem circular) are in fact linear maps.


If you have two independent wheels that can only roll straight forward and straight back, it is possible to turn the luggage. By doing both linear maps at once (which is what a matrix
\begin{pmatrix} a \rightsquigarrow a  & | &  a \rightsquigarrow b  & | &  a \rightsquigarrow c \\ \hline b \rightsquigarrow a  & | &  b \rightsquigarrow b  & | &  b \rightsquigarrow c \\ \hline c \rightsquigarrow a  & | &  b \rightsquigarrow c  & | &  c \rightsquigarrow c   \end{pmatrix}
or Lie action does) and opposite each other, two straights ↓↑ make a twist ↺.

Or if you could get a car | luggage | segway with split (= independent = disconnected) axles


to roll the right wheel(s) independently and opposite to the left wheel(s)


, then you would spin around in place.

Discontinuities  in the 2-D level sets and how they might look one dimension higher.







Gully, gulch, defile, draw, glen, cañon, ravine, rill, gorge, arroyo, rambla, strath, Guadal, rill, couloir, wash, …
— protëa(@isomorphisms) March 5, 2013

Discontinuities  in the 2-D level sets and how they might look one dimension higher.File:Draw javorinky.jpg


File:Défilé de l'Ecluse.jpg




File:A gully (Budanova Gora) 1.jpg

File:Gully in the Kharkov region.jpg





File:Gorges of Ak-SHur.jpg







(Source: Wikipedia)


Further along my claim that what separates mathematicians from everyone else is:

and that learning 20th-century geometry might expand your imagination beyond the usual impoverished shapes of taxonomies.


Here are some calisthenics you can do with a pen and paper that I hope give you a feel for what a (mathematical) group is. (It’s a shame that “group”, “set”, “class”, “category”, “bundle” all have distinct meanings within mathematics. Another part of the language barrier.)

Think of “a group” this way. A group catalogues the relationships between “verbs”.

That is: think of a function as a “verb” and the thing it operates on as a “noun”. One of the tricks of abstraction is that these can be interchanged. Maybe what that might mean will already come clear from this example.

group theory via pentagons


Starting with a pentagon, which I’ll just represent with five numbers for the points. (So: whatever works here might work on other “circles of five”—or "decks of 52"—or … something else you come up with!) That will be the one “thing” or “noun” and in the group exploration you’ll see that the “structure of the verbs” is more interesting than whatever they’re acting on. (This is why in group theory the name of the object is usually omitted and people just list the operations/verbs.)


In John Baez’s week62 you can read about reflection groups. I picked two “axes” in my pentagon ⬟ arbitrarily. If you’re writing along you can draw a different -gon or different axes. Reflection is going to mean interchanging numbers across the axis (“mirror”).

reflections across two arbitrary corners
reflection A
reflection B

It’s the same as reflecting the Mona Lisa except you don’t have to re paint the portrait every time. The same 2-dimensional plane can be indexed by the numbers more easily than by the whole image. (Unless you’re following along with computer tools and you’ve chosen “the square” as your shape. Then transforming Mona is probably more interesting.)


Without my saying so it’s probably obvious that reflecting twice would bring you back to the start. Flip Mona upside-down, flip the pentagon ⬟ along a, then repeat.


If you wanted to give “starting point of noun" a verb-name you could just say 1•noun.

What that establishes, formulaically, is that ƒ(ƒ(X))=X (where X is Mona or ). Where ƒ is “flip”. We’ve also established that ƒ=ƒ⁻¹. Trivial observation, maybe-not-trivial in formula form! After all, suppose you had some science problem and it included a long sequence of ƒ(g(ƒ(ƒ(ƒ(h(g(X))))))) type stuff. You could make it shorter (and maybe the resulting formula or computation easier) if you could cancel ƒƒ’s like that.

That works for either of my pentagon ⬟ reflections a(⬟) or b(⬟).

  • a(a(⬟))=⬟ and
  • b(b(⬟))=⬟.

we are looking at how functions compose


What group theory is going to talk about is how the two verbs interact. What happens when I do a(a(b(a(b(⬟))))) ? Well I can already simplify it by reducing any trains of a∘a∘a∘a's or b∘b∘b's.

first few reflections a, b, a, ...

Above are the first few results of a∘b∘a[⬟]. (NB: “The first” operation is on the right since the thing it’s acting on only appears all the way to the right. So in group theory we have to read right-to-left ←.) I’ll write a bit more text for those who want to continue the chain on their own to give you time to look away. You could also try doing b∘a∘b[⬟] where I did a∘b∘a[⬟] (read right to left! ←).

Just like it’s “sort of amazing” in some sense that

  1. •••—•••—•••—••• (four groups of three…um, regular meaning of “group”!) is the same as ••••—••••—•••• (three groups of four)…and that not only in this specific case but we could make a “law” out of it

So is it also a bit amazing that maybe these reflection laws will be order-invariant in some sense as well.

That may seem like less big of a deal if you think “Everything in maths is commutative and symmetrical”—but it’s not! And most things in life are not commutative or symmetrical. Try to drink your milk and then pour it into the glass or don your underwear after your pants.


It’s also not so obvious (if nobody had told you the answer first and you just had to figure it out yourself) that b∘a∘b∘a∘b∘a∘b∘a∘b∘a[⬟] = ⬟.


Another fairly easy shape to explore its groups is the square. (And what goes for the square, goes for the plane 𝔸²—or for 1-dimensional complex numbers ℂ.)

see plane transformations with the letter F


Symmetries of the square

That’s the end of what a group is. Next: looking ahead to put them in context.


All of these activities amount to exploring the building blocks of a particular group.

But someone (Arthur Cayley) has also come up with a good way to look at the entire structure of the verbs.


Which is ultimately where this theory wants to go: to help us compare & contrast verb-structures. (Look up “group homomorphism”.) Or to notice that two natural phenomena exhibit the same verb-structure.


You can download a free program called Group Explorer to look at various Cayley diagrams.



In an upcoming post called The Shape of Logic, the Logic of Shape I’ll talk about the relationship between groups and manifolds.


Where I’ll ultimately want to go with this is to call groups a “periodic table of elements” for logic. That may not be exact but it’s a gist. Given that semigroups, groups, Lie groups, and other assumption-swapped variations on the group concept usually turn out to be “Factorable” into simple components (Jordan-Hölder, Krohn-Rhodes, etc.)—and assuming that the Universe somehow builds itself out of primitives sufficiently determined or governed by mathematics—or at the least, that normal people can learn this periodic table and expand their imagination with powers of 20th century geometry.

We want to take theories and turn them over and over in our hands, turn the pants inside out and look at the sewing; hold them upside down; see things from every angle; and sometimes, to quotient or equivalence-class over some property to either consider a subset of cases for which a conclusion can be drawn (e.g., “all fair economic transactions” (non-exploitive?) or “all supply-demand curveses such that how much you get paid is in proportion to how much you contributed” (how to define it? vary the S or the D and get a local proportionality of PS:TS? how to vary them?)

Consider abstractly a set like {a, b, c, d}. 4! ways to rearrange the letters. Since sets are unordered we could call it as well the quotient of all rearangements of quadruples of once-and-yes-used letters (b,d,c,a). /p>

Descartes’ concept of a mapping is “to assign” (although it’s not specified who is doing the assigning; just some categorical/universal ellipsis of agency) members of one set to members of another set.

  • For example the Hash Map of programming.
     '_why' => 'famous programmer',
     'North Dakota' => 'cold place',
     ... }
  • Or to round up ⌈num⌉: not injective because many decimals are written onto the same integer.


  • Or to “multiply by zero” i.e. “erase” or “throw everything away”:

In this sense a bijection from the same domain to itself is simply a different—but equivalent—way of looking at the same thing. I could rename A=1,B=2,C=3,D=4 or rename A='Elsa',B='Baobab',C=√5,D=Hypathia and end with the same conclusion or “same structure”. For example. But beyond renamings we are also interested in different ways of fitting the puzzle pieces together. The green triangle of the wooden block puzzle could fit in three rotations (or is it six rotations? or infinity right-or-left-rotations?) into the same hole.


By considering all such mappings, dividing them up, focussing on the easier classes; classifying the types at all; finding (or imposing) order|pattern on what seems too chaotic or hard to predict (viz, economics) more clarity or at least less stupidity might be found.

The hope isn’t completely without support either: Quine explained what is a number with an equivalence class of sets; Tymoczko described the space of musical chords with a quotient of a manifold; PDE’s (read: practical engineering application) solved or better geometrically understood with bijections; Gauss added 1+2+3+...+99+100 in two easy steps rather than ninety-nine with a bijection; ….


It’s hard for me to speak to why we want groups and what they are both at once. Today I felt more capable of writing what they are.

So this is the concept of sameness, let’s discuss just linear planes (or, hyperplanes) and countable sets of individual things.

Leave it up to you or for me later, to enumerate the things from life or the physical world that “look like” these pure mathematical things, and are therefore amenable by metaphor and application of proved results, to the group theory.

But just as one motivating example: it doesn’t matter whether I call my coordinates in the mechanical world of physics (x,y,z) or (y,x,z). This is just a renaming or bijection from {1,2,3} onto itself.

Even more, I could orient the axis any way that I want. As long as the three are mutually perpendicular each to the other, the origin can be anywhere (invariance under an affine mapping — we can equivalence-class those together) and the rotation of the 3-D system can be anything. Stand in front of the class as the teacher, upside down, oriented so that one of the dimensions helpfully disappears as you fly straight forward (or two dimensions disappear as you run straight forward on a flat road). Which is an observation taken for granted by my 8th grade physics teacher. But in the language of group theory means we can equivalence-class over the special linear group of 3-by-3 matrices that leave volume the same. Any rotation in 3-D

Sameness-preserving Groups partition into:

  • permutation groups, or rearrangements of countable things, and
  • linear groups, or “trivial” “unimportant” “invariant” changes to continua (such as rescaling—if we added a “0” to the end of all your currency nothing would change)
  • conjunctions of smaller groups

The linear groups—get ready for it—can all be represented as matrices! This is why matrices are considered mathematically “important”. Because we have already conceived this huge logical primitive that (in part) explains the Universe (groups) — or at least allows us to quotient away large classes of phenomena — and it’s reducible to something that’s completely understood! Namely, matrices with entries coming from corpora (fields).

So if you can classify (bonus if human beings can understand the classification in intuitive ways) all the qualitatively different types of Matrices,


then you not only know where your engineering numerical computation is going, but you have understood something fundamental about the logical primitives of the Universe!

Aaaaaand, matrices can be computed on this fantastic invention called a computer!



Here’s another example of what mathematicians mean by an “ugly discontinuity”.

The Torus is the Cartesian product of circles ◯×◯. I.e. an abstract geometry in which concrete angular measurement pairs (or triples or quadruples or quintuples or …) are realised.


The Sphere is … not that.

A is the north pole and C is the south pole in the Sphere picture.

It’s nontrivial to recognise that ◯×◯≠sphere. For example the people who wrote the Starfox battle mode drew the screen as a sphere but programmed the battle mode on a torus.

By the Hairy Ball Theorem we know that spheres are different to independent pairs of circles. Specifically: one circle “vanishes” at the top and bottom of the other, to make a sphere. Changing your latitude coordinate at the North Pole  leaves you in the same place. In other words “two” collapses to “one” at the poles which also implies that, for consistency, latitude needs to be close to collapse around 89°N—not at all like ◯×◯. where the two capstans spin freely independent of one another.

(This is half of the “joke” … or, “prank”, or “not-funny joke” in my twitter location. I designate myself at (−90,45) so you can imagine a person spinning around uselessly as they try to “walk in a circle” on the South Pole. OK … it’s only slightly funny even to me.)

This is like how globes can represent the Earth much better than maps on a flat sheet of paper. Since it’s impossible to map onto , flat maps can never be perfect. (The fact that the difference is merely a point—that is does map onto S²\{0}—is a distraction from how distorted real maps get. Look how different Greenland looks from the North versus the European view


Furthermore the torus can’t be deformed into a sphere, and it’s difficult for mathematicians to see the relationships between high-dimensional and low-dimensional spheres. (And this has something to do with the story of what Grigory Perelman achieved in solving that Clay Prize.)

The savvy way of talking about this is to say that the sphere has ugly symmetries. How can I say that when the Sphere is a Platonically perfect elementary shape?! The Sphere is so perfect that mass in outer space likes to form itself into that most balanced of balanced shapes.

Basically because when you hold the globe with two fingers and your friend spins it, the antipodes where your two fingers are holding it don’t move. (Yes, neighbourhoods around them move—but "points" in the infinitely-deep-down-continuum-set-of-measure-zero sense are singularities (erm, singularities in the 1/z sense, not in the “black hole” sense).)

Tomorrow: a post on a statistical application of the humble circle.

(Source: )