Set

A **set** is an idea from mathematics. A set has _members_ (also called _elements_). A set is defined by its members, so any two sets with the same members are the same (i.e., if set  and set  have the same members, then **').

A set cannot have the same member more than once. Membership is the only thing that matters. For example, there is no order or other difference among the members. _Anything_ can be a member of a set, including sets themselves; sets can even contain themselves.

It is very important that sets are defined by their members, not by the properties of their members. A group of elements defined by a property is called a class. All sets are classes, but not all classes are sets. The idea that classes and sets are the same is called naive set theory, and causes many paradoxes such as Russell's paradox. An example of a class that is not a set is "the class of all sets".

## What to do with sets

Imagine the set is a bag.

### Element of

Various things can be put into a bag. Later on, a good question would be if a certain thing is in the bag. Mathematicians call this _element of_. Something is an element of a set, if that thing can be found in the respective bag. The symbol used for this is :

,

which means that  is in the bag  or  is an element of .

Unlike a bag, a set can contain at most one item of a given type. So for a set of fruits, it would make no difference if there is one orange, or if there are 10 oranges.

### Empty set

Like a bag, a set can also be _empty_. The empty set is like an empty bag: it has nothing in it. The "empty set" is also called the _null set_ and is represented by the symbol .

### Universe

If we consider, say, some sets of American cars, e.g. a set of all Fords and a set of all Dodges, we may also wish to consider the whole set of American cars. In this case, the set of all American cars would be called a universe.

In other words, a universe is a collection of all the elements one wishes to consider in a given problem. The universe is usually named .

### Comparing sets

Two sets can be compared. This is like looking into two different bags. If they contain the same things, they are equal. No matter, in which order these things are.

_For example_, if  and , the sets are the same.

### Cardinality of a set

When mathematicians talk about a set, they sometimes want to know how big a set is (or what is the cardinality of the set). They do this by counting how many elements are in the set (how many items are in the bag). For finite sets the cardinality is a simple number. The empty set has a cardinality of 0. The set  has a cardinality of 2.

Two sets have the same cardinality if we can pair up their elements—if we can join two elements, one from each set. The set  and the set  have the same cardinality. E.g., we could pair _apple_ with _sun_, and _orange_ with _moon_. The order does not matter. It is possible to pair all the elements, and none is left out. But the set  and the set  have different cardinality.
If we try to pair them up, we always leave out one animal.

#### Infinite cardinality

At times cardinality is not a number. Sometimes a set has infinite cardinality. The set of all integers is a set with infinite cardinality. Some sets with infinite cardinality are bigger (have a bigger cardinality) than others. There are more real numbers than there are natural numbers, for example, which means we cannot pair up the set of integers and the set of real numbers, even if we worked forever.

#### Countability

If you can count the elements of a set, it is called a countable set. Countable sets include all sets with a finite number of members. Countable sets also include some infinite sets, such as the natural numbers. You can count the natural numbers with . The natural numbers are nicknamed "the counting numbers", since they are what we usually use to count things with.

An uncountable set is an infinite set that is impossible to count. If we try to count the elements, we will always skip some. It does not matter what step we take. The set of real numbers is an uncountable set. There are many other uncountable sets, even such a small interval like .[3]

### Subsets

If you look at the set  and the set , you can see that all elements in the first set are also in the second set.
 We say:  is a subset of

As a formula it looks like this:

In general, when all elements of set  are also elements of set , we call   a subset of :

.

It is usually read " is contained in ."

_Example:_ Every Chevrolet is an American car. So the set of all Chevrolets is contained in the set of all American cars.

### Set operations

There are different ways to combine sets.

#### Intersections

The intersection  of two sets  and  is a set that contains all the elements that are both in set  **and** in set  at the same time.

_Example:_ When  is the set of all cheap cars, and  is the set of all American cars, then  is the set of all cheap American cars.

#### Unions

The union  of two sets  and  is a set that contains all the elements that are in set  **or** in set .
This "or" is the _inclusive_ disjunction, so the union also contains the elements, that are in set  _and_ in set .
By the way, this means, that the intersection is a subset of the union:
.

_Example:_ When  is the set of all cheap cars, and  is the set of all American cars, then  is the set of all cars, without all expensive cars that are not from America.

#### Complements

Complement can mean two different things:

- The **complement of ** is the universe  without all the elements of :

The universe  is the set of all things you speak about.

_Example:_ When  is the set of all cars, and  is the set of all cheap cars,
 then <sup>C</sup> is the set of all expensive cars.

- The _set difference_ of  and  is the set  without all the elements of :

It is also called the **relative complement of  in _' .

_Example:_ When  is the set of all cheap cars, and  is the set of all American cars, then  is the set of all expensive American cars.

If you exchange the sets in the set difference, the result is different:
In the _example_ with the cars, the difference  is the set of all cheap cars, that are not made in America.

## Notation

Most mathematicians use uppercase _ITALIC_ (usually Roman) letters to write about sets (such as , , ). The things that are seen as elements of sets are usually written with lowercase Roman letters.

One way of showing a set is by a list of its members, separated by commas, included in braces.
_For example_,
- is set which has members 1, 2, and 3.

Another way, called the set-builder notation, is by a statement of what is true of the members of the set, like this:
- {_x_ | _x_ is a natural number & _x_ < 4}.
In spoken English, this reads: "the set of all _x_ such that _x_ is a natural number and _x_ is less than four". The symbol ipe "|" means "such that" or "so that".

The empty set is written in a special way: ,  or .

When object _a_ is the member of set  it is written as:
- .
In spoken English, this reads: "_a_ is a member of ".

## Venn diagrams

To illustrate operations on sets mathematicians use [Venn diagrams. Venn diagrams use circles to show individual sets. The universe is depicted with a rectangle. Results of operations are shown as colored areas. In the illustration of the intersection operation the left circle shows set  and the right circle shows set .

## Special sets

Some sets are very important to mathematics. They are used very often. One of these is the _empty set_.
Many of these special sets are written using blackboard bold typeface, and these include:
- , denoting the set of all primes.
- , denoting the set of all natural numbers. That is to say,  = {1, 2, 3, ...}, or sometimes  = {0, 1, 2, 3, ...}.
- , denoting the set of all integers (whether positive, negative or zero). So  = {..., -2, -1, 0, 1, 2, ...}.
- , denoting the set of all rational numbers (that is, the set of all proper and improper fractions). So, , meaning all fractions  where _a_ and _b_ are in the set of all integers and _b_ is not equal to 0. For example,  and . All integers are in this set since every integer _a_ can be expressed as the fraction .
- , denoting the set of all real numbers. This set includes all rational numbers, together with all irrational numbers (that is, numbers which cannot be rewritten as fractions, such as   and √2).
- , denoting the set of all complex numbers.

Each of these sets of numbers has an infinite number of elements, and .

## Paradoxes about sets

The mathematician Bertrand Russell found that there are problems with the informal definition of sets. He stated this in a paradox called _Russell's paradox_. An easier to understand version, closer to real life, is called the _Barber paradox_.

### The barber paradox

There is a small town somewhere. In that town, there is a barber. All the men in the town do not like beards, so they either shave themselves, or they go to the barber shop to be shaved by the barber.

We can therefore make a statement about the barber himself: _The barber shaves all men that do not shave themselves. He only shaves those men (since the others shave themselves and do not need a barber to give them a shave)._

This of course raises the question: What does the barber do each morning to look clean-shaven? This is the paradox.

If the barber shaves himself, he cannot be a barber, since a barber does not shave himself.
If he does not shave himself, he falls in the category of those who do not shave themselves, and so, cannot be a barber.

## Related pages

- Cantor set
- Group theory
- Open set
- Relation
- Set theory

## Further reading

The following books explore sets in more detail:

- Halmos, Paul R., _Naive Set Theory_, Princeton, N.J.: Van Nostrand (1960)
- Stoll, Robert R., _Set Theory and Logic_, Mineola, N.Y.: Dover Publications (1979)
- Allenby, R.B.J.T, _Rings, Fields and Groups'', Leeds, England: Butterworth Heinemann (1991)