# Functions

# Sets

A **set** is a collection of things. This sentence is a set of words. This paragraph is a set of sentences. This explanation is a set of excessive examples.

To write down a set, we make a list of the things in that set separated by commas. Around the outside we draw "curly brackets.''

For example, {1, 2, 3} is a set.

Curly brackets may take a bit of practice to draw. It's no recreating the Mona Lisa, but it is a character you likely aren't used to scripting, so don't feel badly if your first few attempts look more like a backwards 3, or an eagle with a clipped wing. It might help to think of the top half of the bracket as a funny-shaped letter *s*. This bracket is called the **left** or **opening** bracket:

{

The other one is the **right** or **closing** bracket:

}

In order to have a set, we must have both an opening bracket and a closing bracket, just as every sentence has to start with a capital letter and end with some sort of punctuation. Them's the rules.

Something like 3, 6, 9 is *not* a set, because there's no opening bracket. In fact, this is mathematical gibberish. Mathematical gibberish is just like gibberish in English, only more number-y.

Mathematicians call the things in a set **elements**, which are not the same thing as the items on a Periodic Table of Elements. They call them elements because they're the things from which we build everything else. Two sets are equal if they have the same elements. You don't even have to treat them like separate individuals. They're totally cool with it.

Since two sets have the same elements,

{1, 2, 3} = {2, 3, 1}.

Because two sets are the same if they contain the same elements, something horrible like

{1, 1, 2, 2, 3, 3, 3, 3}

is actually the same as the set

{1, 2, 3}.

To write a set, we include each element only once. That first set we looked at went crazy on the duplication. If someone asks you to name all the state capitals, there's no sense in naming Santa Fe seven times, even if it is a lovely place.

Also, the order we write the things in a set doesn't matter. Since they have the same elements,

{4, 5, 6} = {6, 4, 5}.

We can write the elements in any order, so long as we include all of them. They have gotten used to sticking together, so it would be a crime to break them up now.

The things in a set don't have to be numbers. We could have a set with sets in it:

{1, 2, 3, {4}, {1, 2, 5}}

or we could have a set with letters in it:

{*a*, *b*, *c*}

We could also have a set with nothing at all in it:

{}

Boy, that's depressing. No one wants to be in this set? Seriously, anyone? It's very spacious and utilities are included.

The set with no things at all is called the **empty set**. So creative. It's a bit like naming your cat "Cat, " isn't it? There's a special symbol for this set, which looks like a zero with a slash through it, or an out-of-control, backwards Q:

∅ = {}

Sets can be finite or infinite. One way to show that a set is infinite is to write down some of the things in the set, and then write dots:

. . .

to show that there are more things in the set. You should be used to writing dots such as these. You already use them in text messages when you can't think of a good way to wrap up your thoughts...

For example, the infinite set of all natural numbers may be written as

{1, 2, 3, . . .}

The dots mean that the pattern is continuing forever. That makes us feel, that makes us feel, that makes us feel like a natural number.