Introduction to sets
Back to mathematicsIn maths we often need to talk about a whole group of things at once. For example: all the numbers from 2 to 5, all the answers to an equation, or all the students in a class who play football. A set is the tool for this. With it, we can say exactly which things are in the group and which are not.
We start with a box, because a set behaves very much like one. Then we put all the numbers on a line and use sets to describe a stretch of it. At the end we combine two sets: join them, keep what they share, or take one away from the other.
What is a set?
A set is a collection of elements. “Collection” just means a group of things. An “element” means one thing in that group. For example, an apple can be an element, so we can collect it in a set.
We write this set as . The two curly brackets mean “a set”. What we write between them are its elements, separated by commas. So is a set with two elements.
A box helps us picture this. In the model below, the two ends of the box are shaped like and : the walls of the box are the brackets. You can put anything inside: an apple, a ball, a toy dog. In maths we usually put in numbers, such as and .
Click an object, or its button, to put it in the box. Click it again to take it out. Under the box, the set is written out as you go.
Loading the box…
A pressed button means the object is in the box. Drag the picture to look from another side.
We usually name a set with a capital letter, such as . To say “the apple is in ”, we write . The symbol is read “is an element of”. To say the dog is not in , we cross the symbol out: .
Three rules of the box
Rule 1: A set records which elements are present. It does not record where they are placed or which one was put in first. For example, listing the apple before the ball and listing the ball before the apple both describe exactly those two elements. That is why the order in a set's list does not change the set. A physical box also has positions, but we deliberately leave those positions out of our set record.
Loading the box…
A pressed button means the object is in the box. Drag the picture to look from another side.
Put a few objects in the box above, then press “Shake the box”. The objects move, and the set under the box is read again from left to right. The list is in a new order, but nothing went in or came out. So it is the same set: .
Rule 2: each element must be definite. Second rule. We have not yet said what an element must be. An apple is fine: it is a specific thing you know. But suppose you want to put in “something I saw on the street yesterday”. Well, you may have seen lots of things on the street yesterday. Which one goes in?
As it stands, that description does not tell us which element to include. We need a description that fixes the membership: changing the person reading it must not change which things count. This is what well-defined means here. Finding the answer may still take work; the requirement is a definite rule, not that every answer must be immediately known. In the cards below, decide whether the wording gives a definite rule.
Rule 3: the same element counts only once. Now distinguish an object from what it represents. The two wooden blocks are two different objects, but here both stand for the same number . We are recording numbers, so putting in the second block does not add a new number: was already present. Thus . If our elements were the individual wooden blocks instead, we would name them separately, and there would be two elements. Decide what the elements mean before counting them.
A set can also have nothing in it. That is reasonable, because a box can be empty too. This set is called the empty set. We write it as or, more often, . Press “Empty the box” to see it.
All the numbers on one line
Anything can be an element, so numbers like , and are all fine. Now suppose we want the set of all the numbers from to . We cannot list them. Between and there are , , , and so on, without end.
Integers, fractions such as , and numbers such as all have a place on a straight line; that line is the number line drawn below. The numbers that have a place on it are called real numbers in this lesson. is about : it is the distance around a circle divided by the distance across its centre. The set of all real numbers is written .
We put all the real numbers on a line, called the number line. First choose a point for and a length for . Then every number has its own point: positive numbers to the right of , negative numbers to the left.
Move the slider below; the point on the line moves with it. Its displayed coordinate is rounded, so an approximation sign appears in front. Zoom in to inspect nearby positions. The screen and slider show only finitely many positions, but the line is not a string of separate dots: between any two different numbers there is always another number. Take 2 and 5: their midpoint 3.5 lies between them, and between 3.5 and 5 there is 4.25; this can go on forever. The screen shows only part of that line.
The marker starts at π. Each zoom shows ten times more detail around it.
A stretch of the line: intervals
All the real numbers from to , including and , can be written as an interval: . It means every real number between and , together with and themselves. On the number line it is the whole stretch from to , with a filled dot at each end.
Sometimes we want to leave an end out. A round bracket means “not including”. So includes but not , includes but not , and includes neither. On the line, an end that is left out gets a hollow dot.
Click an end dot to switch it between filled and hollow, and use the sliders to move the ends. Then move the test number and see whether it belongs to the interval.
Look closely at the end. , but . Yet , and are all in . This interval gets as close to as we like, but itself is left out.
Joining sets and finding what they share
Now we want to combine sets. We use two small sets: and . A picture called a Venn diagram helps. Each set is drawn as a circle, with its elements written inside.
The numbers and are in both sets. So the two circles overlap, and and sit in the overlapping part.
Putting both sets together gives their union, written and read “ union ”. It contains every element that is in , or in , or in both. Here . We write and only once, because a set has no repeats.
The overlapping part is the intersection, written and read “ intersect ”. It contains only the elements that are in both and . Here . If two sets share nothing, their intersection is the empty set .
Choose an operation below. The part of the picture it keeps is shaded, and the result is written underneath.
Bold numbers are in the result. , .
Taking away, and what is left outside
Sometimes we want without the elements of . This is the difference, written and read “ minus ”. It keeps the elements of that are not in . Here . But , so here the order does matter.
For the last operation, we must say what “everything” means. The set of all the things we are talking about is called the universal set, . In the picture it is the rectangle: . The numbers and are in but in neither circle.
The complement of is everything in that is not in . We write it ; some books write . Here . It is the same as : the universal set with taken away.
Bold numbers are in the result. , .
Set operations on the number line
Intervals are sets too, so we can join them, find their overlap and take one away from another. Let and .
The two pieces overlap between and , so together they cover everything from to without a gap: . The part they share runs from to . Both and are in both intervals, so .
removes from every number that is in . That removes everything from to , including itself, because . What is left starts at and stops just before : . This is where round brackets are needed.
Take all real numbers as the universal set. The complement of is every number less than and every number greater than . These stretches never end. We show “goes on without end” with the symbol , read “infinity”. It is not a number, so it always gets a round bracket: the complement is .
Slide along the line and choose an operation. Watch the ends of the answer switch between square and round brackets.
Choose one number and follow the vertical guide through , and the green result. A filled marker means that row includes the number; a hollow marker means it does not.
Try it yourself
Is the same set as ?
Which of these describes a set?
Is an element of ?
With and , what is ?
What is ?
