## The Little Vulgar Book of Mechanics (v0.12.0) - Functions III

Last updated: March 7th 2022

Just updated this section of the book: Functions III

## Functions III #

Have you ever had your mind "blown" by some set theory geek? With the infinite sets shit and whatnot?

Well, I hate all that shit.

But the mathematical definition of a function uses the concept of *set*, so I'm gonna define a couple of *finite* sets such as this one:

\[X := \lbrace a, e, i, o, u \rbrace\]

That is an example of constructing a set by listing, one by one, the elements it contains. In this case, some letters of the alphabet.

Here's another one, which is also finite, but too much of a pain in the ass to write down entirely, so I'm gonna use the dots thing:

\[Y := \lbrace 1, 2, 3, \cdots, 98, 99, 100 \rbrace\]

I'm writing the elements of both sets in order, because of my normie human brain, but I should clarify that in *set theory* a set has no built-in order. You have to define some functions and shit for it to have order.

Anyway, \(Y\) is a set of 100 elements that I don't wanna write down fully. But it's still finite. I'm gonna be lazy and assume that you know that the unwritten elements are 4, 5, 6, and so on. (And again I'm writing them in the order we all know and love, but technically a set is not ordered "by default.")

I'm already sick of talking about sets, though, so let's leave the rest of the set shit for later, or never. We have what we need now. We can now define a function:

\[f : X \rightarrow Y\]

We say that \(f\) is a function from the finite *set* \(X\) to the finite *set* \(Y\).

\(f\) is a rule that assigns to each element \(x\) in the finite set \(X\), a unique element of \(Y\) which we call \(f(x)\).

We can define the rule explicitly, as a list of equations, like:

\[f(a) = 1.\] \[f(e) = 2,\] \[f(i) = 3,\] \[f(o) = 4,\] \[f(u) = 5\]

There are more possible functions from \(X\) to \(Y\). We could map all the vowels to `1`

for some reason.

We could have a function from X to itself. E.g.:

\[g : X \rightarrow X\]

Where the rule is:

\[g(a) = e,\] \[g(e) = i,\] \[g(i) = o,\] \[g(o) = u,\] \[g(u) = a\]

Note how \(g\) cycles through the elements. Do you see it? How about this, a set \(Z\) and a function \(r\):

\[ Z := \lbrace n, e, s, w \rbrace \]

\[ r : Z \rightarrow Z \]

Where the rule is: \[r(n) = e,\] \[r(e) = s,\] \[r(s) = w,\] \[r(w) = n\]

That is, a set \(Z\), whose members represent the cardinal points North, East, South, and West, and a function \(r\) representing a clockwise rotation. I say it "cycles" through the elements, because after four rotations you get back to the original position. I.e. for every element \(z\) in \(Z\), we have that \(z = r(r(r(r(z))))\). Just think of going with your finger clockwise. After four steps, you're back to the starting point.

Now here's a function that "goes in the other direction":

\[ l : Z \rightarrow Z \]

Where the rule is:

\[l(n) = w,\] \[l(w) = s,\] \[l(s) = e,\] \[l(e) = n\]

Because they "cycle" in opposite directions, we have that for each element z, \(r(l(z)) = z\). In this case we say that the functions "invert" each other.

So there, now you have examples of:

- Defining a finite set from scratch.
- Defining a function on it.
- Noticing certain properties of functions (invertibility in this case.)

By the way, these "invertible" functions from a set to itself are called *permutations*. But now I'm venturing into Group Theory, which is some abstract algebra shit that I don't wanna pollute this section with. So let's stop here.

You know what else is a set? The collection of horrible guitar riffs that is my metal track "Escape Mechanics Unlocked"!

### External resources #

### Books #

See current full book's WIP here.