Difference

Learn about the difference and symmetric difference of sets.

Set difference

If we have two sets, AA and BB, the difference, ABA−B, is the set containing all the elements that are members of AA and not members of BB. Some authors also denote this difference as ABA \setminus B. We can represent it mathematically as follows:

Because the difference ABA−B contains all the elements of AA except those that are common with BB, we can infer the following:

Examples

Let’s explore a few examples.

For the first example, let’s consider the following sets:

To find the members of AA that are not in MM, we look at their set difference as follows:

To find the members of MM that are not members of AA, we derive the difference as follows:

Now, let’s look at another example. In the English alphabet, each letter is a vowel or a consonant, but not both. We can represent this information using set-theoretic notation, as shown below:

The following set of consonants contains the letters from the alphabet that are not vowels:

Similarly, we can tell that V=ECV = E\setminus C.

Properties of set differences

The set difference operation is not commutative, as can be seen from the examples above. From its definition, we can note the following:

BA={xxBx∉A}B-A=\{ x \mid x\in B \land x\not\in A\} ...

Set difference of A and B
Set difference of A and B
Access this course and 1400+ top-rated courses and projects.