Variables, Sets, and Tuples
1Variables
What is the sum of all numbers between and ? Let’s simply compute it: . What is the sum of all numbers between and ? Let’s make the pupils spend an hour to compute it. At least this is what the teacher of Carl Friedrich Gauß intended when he gave this task to his class. Gauß, however, came back with the correct answer almost immediately. He had realized that the sum can be written as follows:
Mathematicians immensely like the argument of Gauß but at the same time see more behind it. In fact, whether we sum up to , or to some other even number (for example ) doesn’t really matter—the argument is always “the same.” Hence, mathematicians will try to prove a general theorem (a mathematical statement), involving a variable. The answer for the concrete number (or for , or for a milllion) can then be derived by plugging the concrete number into the variable. This would look as follows.
Let be a positive even number. Then the sum of all numbers between and is .
We note that is the lazy mathematician’s shortcut for the multiplication , and stands for division. In an offset formula (such as the following) where we have more vertical space, we would write as a fraction
Following Gauß, we write the sum as follows:
The little box on the right indicates the end of a proof. In some older textbooks (and in math fiction), the end of a proof is sometimes denoted by q.e.d., quod erat demonstrandum, Latin for what was to be shown.
In this theorem and its proof, the symbol is a (mathematical) variable. It is a placeholder for an actual number, and the theorem tells us what numbers we are allowed to plug in (“Let be a positive even number.”) For example, when we plug in , the sum is , as we already know. For , we do not need to repeat the proof but simply plug in to get that the sum of the numbers between and is .
The cool feature of a theorem is that it gives the answer for infinitely many numbers, with only one proof; in this case we get the answer for all positive even numbers. But in fact, the numbers between and always sum up to , also for a positive odd number such as . We invite you to come up with your own argument for this. Even for , the theorem works if we use the convention that there are no numbers “between and ”, so the sum is in this case. This means, we in fact have
Let be a natural number. Then the sum of all numbers between and is .
There is the related concept of a (mathematical) constant that simply gives a short name to a long number. For example, if we keep talking about the number (the speed of light in ), we could start with “Let ,” and then simply say whenever we mean .
Variables are not only used in theorems. Mathematicians use them whenever they want to say something about all numbers (or other mathematical objects) of some kind. A typical use case is a sentence such as “We use to denote the square root of a nonnegative number .” This tells us what means, but also or , as the variable can stand for all these numbers. In fact, in the first reading assignment we have already used variables such as and standing for true‐false statements. Back then, we called them placeholders, but the term variable is more appropriate for (mathematical) grown‐ups.
Place yourself into the mind of Carl Friedrich Gauß and answer the following questions (in less than an hour, preferably).
What is the sum of the even numbers between and , i.e.
What is the alternating sum of the numbers between and , i.e.
2Sets
A set is a “bag” of elements, possibly infinitely many. These elements are typically numbers or some other entities. They are in the bag in no particular order, but no element occurs more than once. Sets are written in curly braces, and in between, we just list the elements. For example, the set of even numbers between and is , and the set of odd numbers between and is .
We can also write this as , as order doesn’t matter. But typically, the elements are displayed as a familiar sequence, just to make it more readable. We could even write , and this would mean the same thing as , since duplicates are simply ignored. If a set has many elements, we use abbreviations. For example, the set of numbers between and is typically written as , and the set of odd numbers between and as , or to make the pattern even clearer. As the dots notation is very practical but not mathematically rigorous, we have to be careful to avoid misunderstandings.
The set of integers between and is , so variables can also naturally be used in sets.
The empty set (a bag containing nothing) is written as or . Elements may also be (text) symbols, such as in , or .
Just as for numbers, there are also set variables and set constants, as in “Let be a set of numbers,” or “Let .” Sets are usually denoted with upper‐case letters, sometimes calligraphic letters such as .
(computer scientists typically start counting from instead of ). For the set of all integers (positive or negative), something like would work. But this notation is a bit cumbersome, so it is more common to use standard names for such sets: for the set of natural numbers and for the set of integers.
So far, when we said “numbers”, we in fact meant natural numbers, the numbers we use for counting. There are infinitely many natural numbers. We could write the set of natural numbers asThe symbol denotes the set of real numbers (the infinite bag containing all numbers that we typically deal with, including integers, decimal numbers such as , fractions such as , square and third roots such as , , and other special numbers such as
By , we denote the set of nonnegative real numbers (numbers greater or equal to ); is the set of nonpositive real numbers (numbers smaller or equal to ). There are also more exotic numbers, called complex numbers, and in fact, the number of possible kinds of numbers that mathematicians can come up with is infinite. But we will only need , sometimes and .
As it is not always clear what we mean when talking about “a number”, we should generally say what kind of number we mean. For example, the Theorem “Kleiner Gauß” can without ambiguity be stated as follows: Let be a natural number. Then the sum of all natural numbers between and is . But in this case, the extra precision is unnecessary. By “all numbers between 1 and ”, even mathematicians mean the natural numbers .
Variables that stand for natural numbers or integers are in most cases called . Variables that stand for real numbers are often called .
Which of the following sets are equal to ?
How many elements do the following sets have?
Let’s look at sets where all elements are between 1 and 10. For example, is such a set, is another one, and so on. How many such sets are there? The empty set also counts. (You may first want to count the sets with elements between and , and then add , and so on.)
The mathematician immediately sees a general theorem here: Let be a natural number. There are sets with elements between and . In fact, as we already have a symbol for the set of natural numbers, we can use it and abbreviate “Let be a natural number” by “Let .” Here, the symbol stands for “element of”, so that the abbreviation literally says “Let be an element of .” The theorem then reads as follows.
Let . There are sets with elements between and .
3Tuples
A set is an unordered bag of elements. When we care about the order, we use tuples. A tuple is a “list” of elements where elements may also occur more than once. Tuples are written between normal braces. For example has five elements and is called a 5‐tuple. Here comes first on the list, then , then again, and so on. You can for example imagine that this tuple records the results of rolling a dice five times.
Hence, is not the same as . 2‐tuples are also called pairs, 3‐tuples are triples, and 4‐tuples are quadruples (a term already less common). You occasionally still hear about quintuples, but anyone saying sextuple or septuple is probably a nerd. There are 1‐tuples and even 0‐tuples, written as , but they are rarely needed. The dots notation naturally also applies to tuples, and even makes sense if we also say how many elements the tuple has. There are no infinite tuples; lists with infinitely many elements are called sequences.
Tuples are typically denoted by lower‐case letters (“Let ”), sometimes in bold to distinguish them from numbers (“Let ”).
There is a fundamental difference between sets and tuples; even if and seem to be the same, they aren’t. In , there is no order between and , while in , comes before . This isn’t just mathematical sophistry, it really lets you express different things; for example, if you want to say who competed in the 2018 world chess championship, you would write , but if you want to talk about the outcome, you would write .
How many elements do the following tuples have?
How many different triples are there with all elements between 1 and 10? For example, is such a triple, is another one, and so on.
Here is the mathematical theorem behind the previous exercise, this time with variables.
Let . There are ‐tuples with all elements between and .
Which of the following statements are true?
A tuple such as whose elements are numbers is typically called a vector. In contrast to tuples such as , we can compute with vectors, but we will get to this only in later reading assignments. Vector variables are typically called .