Lesson 6: Functions

Now that we know all about sets (enough, in fact, to derive the paradox of lesson 5), there is a very natural question to ask: What happens when we have two of them? In other words, what types of relationships can exist between sets?

We’ll formalize this in a second, but let me comment first about the generality of this procedure. Perhaps the most pervasive idea studied in mathematics is the concept of “relationships between structures”. A mathematician first defines some new object (in our case the object that we’ve defined is a set) and then studies the behavior of “relationships” between two such objects. As we’ll see, there is always a remarkably subtle interaction between the mathematical object itself, and the relationships that can be established between two such objects. One of the most general types of mathematical object is the set, and therefore the relationships that can be established between sets are some of the most general as well. Let us therefore quit the philosophizing and move on to studying these relationships.

The most basic and fundamental relationship between two sets that mathematicians study is known as a function. We’ll make a somewhat precise definition shortly, but intuitively a function from one set to another set (these two sets can be arbitrary—they could even be the same!) is something which “sends” every element of one set to some element of the other. Of course, “out there” in the world of mathematics there is nothing that literally picks up elements in one set and carries them over to some other set, so let us try to formalize this idea as much as we can. By “sends”, I really mean “associates”. Thus, a function takes each individual element in one set and associates to it some element of the other set. In other words, a function “assigns” some element of one set to some element in the other.

There is more to a function than just this “assigning” of elements, however. In particular, a function always “goes” from one set to another (I use scare quotes because there isn’t really anything moving “out there”, but the dynamical nature of a function is a good analogy to keep in one’s head). Whichever set the function “starts at” must have every one of its elements assigned to some element of the set it’s going to. Let us see an example to make all of this concrete.

Consider the set {A=\{1,2,3\}} and the set {B=\{a,b\}}. Then a function from A to B is an assignment of every element in A to some element in B. Thus I could assign {1\rightarrow a, 2\rightarrow a,} and {3\rightarrow b}, and this would be a perfectly good function because I’ve given a “value” to every element in A. I use scare quotes on “value” here because the “value” of an element in A is some element in B. Normally we like to think of “values” as being numerical, but we really can generalize the notion of “value” to any set. If A is given as above and {C=\{\mathrm{donkey,\ horse,\ cow,\ chicken}\}}, and we have the function {1\rightarrow \mathrm{horse}, 2\rightarrow \mathrm{chicken}, 3\rightarrow \mathrm{cow}}, then the “value” of 1 is horse, and the “value” of 3 is cow.

There are a couple of things that we need to note about these examples that will in fact be crucial for when we actually define a set rigorously. The first thing to note is that although every element in A is given a value in B, it is not the case that every element in B has some element in A assigned to it. For example, donkey never got an element in A assigned to it. That’s fine, because the function is defined to be from A to B, and not the other way around. Whenever a function is from one set, it must assign some “value” to every element in that set. We could, for example, assign chicken to every element in A, and that would be a perfectly fine function. I.e., the function {1\rightarrow \mathrm{chicken}, 2\rightarrow \mathrm{chicken}, 3\rightarrow \mathrm{chicken}} is perfectly fine because nowhere in our “definition” of a function (scare quotes because we haven’t rigorously defined a function yet) did we say anything about whether or not we could assign the same value to every element in the “from” set. The last thing to note is that we are only assigning one element (i.e., one “value”) to every element in A. In other words, the function {1\rightarrow \mathrm{cow}, 2\rightarrow \mathrm{chicken}, 3\rightarrow \mathrm{(cow,\ donkey)}} is not a function because 3 was “sent to” both cow and donkey, which is not okay. We simply define a function to be something which assigns only one value to each element in the “from” set.

This reminds me of something important, and something very “mathematical” in a general sense. We could, of course, have defined a function to be otherwise. We could have defined a function to be something that always assigns two elements to each element in its “from” set. We could have defined a function so that it did not have to assign a value to every element in its “from” set. We’re simply choosing to define a function in this way, because it appears to be one of the most interesting definitions to study. Remember, once we define some object (in this case, a function), the logical deductions that can be made about that object are completely out of our control. We can choose the definition, but we can’t choose the deductions because the deductions are firmly rooted in the world of mathematics, which is already “out there”, beyond us. It just so happens that this definition of a function is much more interesting than other definitions, which means that we’ve stumbled across the definition that is somehow “right”. Let us therefore just go ahead and make this definition and then we’ll study its consequences in coming lessons.

Definition 6.1: Let A and B be two arbitrary sets. A function from A to B is an assignment to every element in A exactly one element in B. //

That’s it. There are no requirements for how many elements of B we end up using, or which elements go where. Thus, this is an extremely general definition, since all we need to remember is that every element of A needs to go somewhere (in B), and each element in A only goes to one place (in B).

Let us now set up some notation (remember, notation isn’t scary, we just need to learn what it is). If we have two sets A and B and a function from A to B, and if we denote this function by f (short for “function”, perhaps), then we denote the entire phrase “f is a function from A to B” simply by {f:A\rightarrow B}. Thus, in that small amount of writing, we know that A and B are sets, we know that f is a function between them, and we know that f goes from A to B (i.e., that every element in A has one and only one element in B associated with it). We sometimes also call A the domain of f, and B the codomain of f. In this sense, then, A is the “domain of influence” of the function f (since f sends every element of A somewhere), and the word codomain is used just to remember “where f sends things to”. Accordingly, if g were a function from C to D, we would write {g:C\rightarrow D}. Here, C would be the domain, and D would be the codomain.

The last bit of notation that we’ll set up is a succinct way to describe where a function f sends individual elements. In other words, we’ll set up notation that not only encapsulates where a function starts and finishes (i.e. f starts at A and finishes at B), but also where the individual elements go. Suppose {A=\{1,2,3\}, B=\{\mathrm{cat,\ donkey,\ apple}\}}, and {f:A\rightarrow B} (read aloud as “f is a function from A to B”, so that this sentence is in fact grammatically correct). Moreover, suppose f is the function which assigns {1\rightarrow \mathrm{cat}, 2\rightarrow \mathrm{apple}, 3\rightarrow \mathrm{apple}}. Then we simply denote this by {f(1)=\mathrm{cat}, f(2)=\mathrm{apple,\ and} f(3)=\mathrm{apple}}. I.e., the notation {f(1)=\mathrm{cat}} is simply shorthand notation for the phrase “f is a function which sends 1 to cat”.

Just as sets may have seemed trivial until we were able to derive a highly non-trivial result from them, functions may at first sight seem like a rather trivial concept. Nonetheless, they form a cornerstone of mathematics and are absolutely pivotal in understanding virtually all of the field. In fact, in only a few lessons we’ll use functions to make precise the notion that there are, in fact, some infinities which are in a clear sense “more infinite” than others. For now, let’s be patient and simply internalize the idea of a function, and the corresponding vocabulary and notation (of which there is very little).

Next Lesson

Previous Lesson


5 Responses to Lesson 6: Functions

  1. very nice lesson indeed…….. but i have a question, let me explain my question with an example
    let A = {1,2,3} and B = {cat, dog}…
    as we defined function f, as f is a function which assigns every element in A, exactly one element in B…
    or we can imagine there is an imaginary road built as soon as we call f, that f now takes from set A an element e.g 1 and give that 1 a “cat” from set B…………
    but like if i assign as this, f: A -> B, such that 1 -> cat, 2 -> cat, 3 -> dog
    can elements association had to be “distinct” or not… like 1 -> cat, 2 -> dog and thats it.

    • That’s a great question! In short, your first example is just fine. We CAN define a function f in this case to send 1–>cat, 2–>cat, and 3–>dog. Namely, what’s important is to satisfy the requirements of a function, and these requirements are “send EVERY element in A to some element in B, and don’t send any given element in A to MORE than one element in B”. We notice that this requirement says nothing about whether or not every element in A is sent to a DISTINCT element in B. Indeed, your second example isn’t actually a function, since it never sends 3 to any element in B. In fact, in a later lesson, titled “injective, surjective, bijective”, we will see that we sometimes CAN have functions that satisfy this extra requirement, but then this is a separate, extra requirement. Remember, we can make whatever definitions we want and then see what they lead to, and for various reasons (that we’ll see throughout the lessons), this definition of function is a good one.

      I hope that makes sense, and let me know if there are any other questions!

      • thank you for a quick response………
        and yes now i see, we can make just as many definitions by ourself and then can try to satisfy them through math logic……..

        but i’ve read somewhere that all the field of studies including math are flawed, it just gave a blow to my understanding of all the subjects, like i believe they can explain everything in the realm of universe….. are these tools really perfect? or are the flawed? if yes then to how much extent?

        and another question is i was searching about abstraction, and so far what i digested is…
        for example, we have a remote control which sends signals through infra red rays to our TV set, so we can change the channels, if e.g there were no remotes or anything had been invented for manipulating TV to change channels or increase decrease volume, then for changing a simple channel, we had to go through ages to figure out how it can be done.
        but luckily,we have remotes, which have buttons, buttons have symbols on them which we know, like they are common knowledge, e.g button 1 will give us channel 1 e.t.c………..
        so what those buttons do is they do abstraction in a way so that we dont have to manually send IR codes to tv to change a channel, we just press the button and remote circuitry do it for us………….. remote provide an abstraction layer for us…

        how i can be better in doing abstraction in any way possible, can we learn this, i mean, is this thing learnable, or this just comes naturally to some people to abstract on higher levels…. and we cant reach there levels by just learning how to abstract things.

        • Sorry for my late response! Indeed the questions you ask about whether or not math is really flawed is a question about the foundations of mathematics. This is a very deep subject, and is primarily a philosophical one. As a very vague explanation of what it’s all about, and why we don’t really worry too much about the validity of math at its core, let me use the following example. We all know, in some sense, that numbers “exist”. In precisely what sense they exist is slightly unimportant (depending on who you ask), because for most of what we want to do with numbers we care most about how to manipulate them, not so much about whether or not (or in what sense) they exist. If the question of whether or not the number 5 “exists” is one that interests you, then the foundations of math are what you want to study and it is there that you’ll find a rather deep (infinitely deep?) rabbit hole where one might possibly question the validity of math at its core. But if you’re willing to accept some of these basic notions (which undoubtedly involves sweeping a large amount of interesting (if inapplicable) material under the rug), then these deep questions won’t bother you. I do want to make clear, though, that these foundational questions are indeed important, interesting, and often lead to interesting insights in other fields. That probably doesn’t answer your question at all, but it’s the best I can do with limited knowledge.

          As for your comments about abstract thought, yes this example about the remote control is great. In particular, the people who invented remote controls need to think abstractly about what one needs to do with a TV (change the volume, change channels, search through thousands of channels, etc.) and hone in on what’s important, what isn’t, and how to maximize the functionality of a remote control while minimizing the effort of the television watcher. There are lots and lots of non-mathematical examples of abstract thought, and the remote control is a great one!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s