# OpenStax-CNX

You are here: Home » Content » Functions » Difference of sets

### Recently Viewed

This feature requires Javascript to be enabled.

Inside Collection:

Collection by: Sunil Kumar Singh. E-mail the author

# Difference of sets

Module by: Sunil Kumar Singh. E-mail the author

We can extend the concept of subtraction, used in algebra, to the sets. If a set “B” is subtracted from set “A”, the resulting difference set consists of elements, which are exclusive to set “A”. We represent the symbol of difference of sets as “A-B” and pronounce the same as “A minus B”.

Definition 1: Difference of sets
The difference of sets “A-B” is the set of all elements of “A”, which do not belong to “B”.

In the set builder form, the difference set is :

A - B = { x : x A a n d x B } A - B = { x : x A a n d x B }

and

B - A = { x : x B a n d x A } B - A = { x : x B a n d x A }

On Venn’s diagram, the difference "A-B" is the region of “A”, which excludes the common region with set “B”.

## Interpretation of difference set

Let us examine the defining set of intersection :

A - B = { x : x A a n d x B } A - B = { x : x A a n d x B }

We consider an arbitrary element, say “x”, of the difference set. Then, we interpret the conditional meaning as :

I f x A - B x A a n d x B . I f x A - B x A a n d x B .

The conditional statement is true in opposite direction as well. Hence,

I f x A a n d x B x A - B . I f x A a n d x B x A - B .

We can summarize two statements with two ways arrow as :

I f x A - B x A a n d x B . I f x A - B x A a n d x B .

### Composition of a set

From Venn’s diagram, we observe that if we derive union of ( A B A B ) to either of the difference sets, then we get the complete individual set.

A = A - B A B A = A - B A B

and

B = B - A A B B = B - A A B

### Difference of sets is not commutative

The positions of sets about minus operator affect the result. It is clear from the figure above, where “A-B” and “B-A” represent different regions on Venn’s diagram. As such, the difference of sets is not commutative. Let us consider the example used earlier, where :

A = { 1,2,3,4,5,6 } A = { 1,2,3,4,5,6 }

A = { 4,5,6,7,8 } A = { 4,5,6,7,8 }

Then,

A B = { 1,2,3 } A B = { 1,2,3 }

and

B A = { 7,8 } B A = { 7,8 }

Clearly,

A B B A A B B A

### Symmetric difference

From the Venn’s diagram, we can see that union of two sets is equal to three distinct regions. Alternatively, we can say that the region represented by the union of two sets is equal to the sum of the regions representing three “disjoint” sets (i) difference set A-B (ii) intersection set " A B A B " and (iii) difference set B-A.

We use the term “symmetric set” for combining two differences as marked on Venn’s diagram. It is denoted as “ A Δ B A Δ B ”.

A Δ B = A B B A A Δ B = A B B A

## Complement of a set

The complement is a special case of the difference operation. The set in question is subtracted from universal set, “U”. Thus, one of the sets in difference operation is fixed. We define complement of a set as its difference with universal set, "U". The complement of a set is denoted by the same symbol as that of set, but with an apostrophe. Hence, complement of set A is set A’.

Definition 2: Complement of a set
The complement of a set “A” consists of elements, which are elements of “U”, but not the elements of “A”.

We write the complement set in terms of set builder form as :

A = { x : x U a n d x A } A = { x : x U a n d x A }

Note that elements of A’ does not belong to set “A”. On Venn’s diagram, the complement of “A” is the remaining region of the universal set.

### Interpretation of complement

Proceeding as before we can read the conditional statement for the complement with the help of two ways arrow as :

x A x U a n d x A x A x U a n d x A

In terms of minus or difference operation,

A = U A A = U A

It is clear from the representation on Venn’s diagram that the universal set comprises of two distinct sets – set A and complement set A’.

U = A A U = A A

### Compliment of universal set

The complement of universal set is empty set. It is so because difference of union set with itself is the empty set (see Venn's diagram).

U = { x : x U a n d x U } = φ U = { x : x U a n d x U } = φ

### Complement of empty set

The complement of the empty set is universal set. It is so because difference of union set with the empty set is universal set (see Venn's diagram).

φ = { x : x U a n d x φ } = U φ = { x : x U a n d x φ } = U

### Complement of complement set is set itself

The complement of complement set is set itself. The complement set is defined as :

A = U A A = U A

Now, complement of complement set is :

A = U A A = U A

Let us consider the example, where :

U = { 1,2,3,4,5,6,7,8 } U = { 1,2,3,4,5,6,7,8 }

A = { 1,2,3,4,5,6 } A = { 1,2,3,4,5,6 }

Then,

A = { 1,2,3,4,5,6,7,8 } - { 1,2,3,4,5,6 } = { 7,8 } A = { 1,2,3,4,5,6,7,8 } - { 1,2,3,4,5,6 } = { 7,8 }

Again taking complement, we have :

A = { 1,2,3,4,5,6,7,8 } - { 7,8 } = { 1,2,3,4,5,6 } = A A = { 1,2,3,4,5,6,7,8 } - { 7,8 } = { 1,2,3,4,5,6 } = A

### Union with complement set

The union of a set with its complement is universal set :

A A = { x : x U a n d x A } { x : x U a n d x A } = U A A = { x : x U a n d x A } { x : x U a n d x A } = U

From Venn’s diagram also, we see that universal set consists of set A and component A’.

U = A A U = A A

The two sets on the right side of the equation are disjoint sets. Hence,

A A = U A A = U

### Intersection with complement set

There is nothing common between set A and its component A’. Thus, intersection of a set with its complement yields the empty set,

A A = φ A A = φ

## De-morgan’s laws

In the real world situation, we want to negate a condition of incidence. For example, consider a class in the school. Some students play either basketball or football or both, but there are students, who play neither basketball nor football. We have to identify later category of students as a set.

Let the set of students playing basketball be “B” and that playing football be “F”. Then, students who do not play basketball is complement set B’ and students who do not play football is complement set F’. We have shown these complement sets separately for visualization. Actually, these complement sets are drawn to the same universal set, "U".

Two complement sets are but overlapping sets. There are students in the set B’ who play football and there are students in the set F’, who play basketball. In order to remove those students playing other game, we intersect two complements. The members of the intersection of two complements, therefore, represent students who play neither basketball nor football. This intersection is shown as third bottom Venn’s diagram in the figure.

Looking at the intersection of two complement sets, however, we observe that this is equal to the complement of union “ B F B F ”. This conclusion can be derived from basic interpretation as well. We know that union “ B F B F ” represents students, who play either or both games. The component of the union, therefore, represents, who neither play basketball nor football.

This fact, as a matter of fact, is the first De-morgan’s law. Symbolically,

B F = B F B F = B F

The second De-morgan’s law is :

B F = B F B F = B F

In the parlance of illustration given earlier, let us interpret right hand side of the second De-morgan's law. The intersection “ B F B F ” represents students playing both games. Its complement, therefore, represents students who do not play both games, but may play one of them.

### Analytical proof

Here, we shall prove first De-morgan’s law in this section. The second law can be proved in similar fashion. Let us consider an arbitrary element “x” belonging to set ( A B A B )’.

x A B x A B

x A B x A B

Then, by definition of union,

x { x : x A o r x B } x { x : x A o r x B }

Here, “not or” is interpreted same as “and”,

x A a n d x B x A a n d x B

x A a n d x B x A a n d x B

x A B x A B

But, we had started with ( A B A B )’ and used its definition to show that “x” belongs to another set. It means that the other set consists of the elements of the first set – at the least. Thus,

A B A B A B A B

Similarly, we can start with A B A B and reach the conclusion that :

A B A B A B A B

If sets are subsets of each other, then they are equal. Hence,

A B = A B A B = A B

### Example

Problem 1: In the reference of students in a class, the set “B” represents students, who play basketball. The set “F” represents students, who play football. The set “B” and “F” are left and right circles respectively on the Venn's diagram shown below. Identify regions marked 1 to 8 on the Venn’s diagram. Also interpret regions identified by combination U – (6+7).

Solution :The meaning of regions market 1 – 8 are as given hereunder :

1 : B-F : It represents the difference of “B” and “F”. It consists of students, who play basketball, but not football.

2 : F-B : It represents the difference of “F” and “B”. It consists of students, who play football, but not basketball.

3 : B F B F : It represents the intersection of two sets. It consists of students, who play both basketball and football.

4 : B: It represents the set “B”. It is union of two disjoint sets “B-F” and “ B F B F ”. It consists of students, who play basketball.

5 : F: It represents the set “F”. It is union of two disjoint sets “F-B” and “ B F B F ”. It consists of students, who play football.

6 : B∪F: It represents the union set of set “B” and “F”. Equivalently, it is union of three disjoint sets “B-F”, “ B F B F ” and “F-B”. It consists of students, who play either of two games or both.

7 : ( B F B F )’: It represents the component of union set “ B F B F ”. It consists of students, who play neither basketball nor football.

8 : B - F F - B B - F F - B : It represents union of two disjoint difference sets “B-F” and “F-B”. It consists of students, who play only one game.

The region, identified by U – (6+7), is complement of “ B F B F ”. It represents students, who do not play both games, but may play one of them.

## Content actions

### Give feedback:

#### Collection to:

My Favorites (?)

'My Favorites' is a special kind of lens which you can use to bookmark modules and collections. 'My Favorites' can only be seen by you, and collections saved in 'My Favorites' can remember the last module you were on. You need an account to use 'My Favorites'.

| A lens I own (?)

#### Definition of a lens

##### Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

##### What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

##### Who can create a lens?

Any individual member, a community, or a respected organization.

##### What are tags?

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

| External bookmarks

#### Module to:

My Favorites (?)

'My Favorites' is a special kind of lens which you can use to bookmark modules and collections. 'My Favorites' can only be seen by you, and collections saved in 'My Favorites' can remember the last module you were on. You need an account to use 'My Favorites'.

| A lens I own (?)

#### Definition of a lens

##### Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

##### What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

##### Who can create a lens?

Any individual member, a community, or a respected organization.

##### What are tags?

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

| External bookmarks
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "url": "http://cnx.org/content/m15198/latest/?collection=col10464/1.42", "fetch_time": 1405349346000000000, "content_mime_type": "application/xhtml+xml", "warc_filename": "crawl-data/CC-MAIN-2014-23/segments/1404776440762.97/warc/CC-MAIN-20140707234040-00008-ip-10-180-212-248.ec2.internal.warc.gz", "warc_record_offset": 20432528, "warc_record_length": 15817, "token_count": 3311, "char_count": 12151, "score": 4.78125, "int_score": 5, "crawl": "CC-MAIN-2014-23", "snapshot_type": "latest", "language": "en", "language_score": 0.8736547827720642, "file_path": "/sailhome/yjruan/project/latent-lm/data/processed/finemath-4plus/finemath-4plus/train-00047-of-00064.parquet"}