Associated Topics || Dr. Math Home || Search Dr. Math

### Intersection, Difference, Union

```Date: 12/18/2002 at 21:10:00
From: Phoebe
Subject: Algebra 1

I do not understand 'members of both A but not of B and members of
both A and B'. My math book does not introduce these sorts of
problems. All it covers is sets and subsets, rational numbers, whole
mumbers, etc.

Example: A = {-3, -2, -1/2, 0, 1, 3} B = {-2, 1/2, 1, 3/2, 2, pi}

The problem: integers that are members of A but not of B, integers
that are members of both A and B, integers that are members of either
A or B.

Integers of A but not of B: does this mean set A only and not B?
```

```
Date: 12/20/2002 at 11:54:03
From: Doctor Ian
Subject: Re: Algebra 1

Hi Phoebe,

Suppose we line up the sets like this:

A = { -3, -2, -1/2, 0,      1,          3     }

B = {     -2,          1/2, 1,  3/2, 2,    pi }

To find the elements that are in both A and B, we can see which ones
in A have a matching element from B:

*                *
A = { -3, -2, -1/2, 0,      1,          3     }

B = {     -2,          1/2, 1,  3/2, 2,    pi }

So

elements in both A and B = { -2, 1 }

Note that we get the same thing if we look at elements of B, and see
which ones have a matching element in A:

A = { -3, -2, -1/2, 0,      1,          3     }

B = {     -2,          1/2, 1,  3/2, 2,    pi }
*                *

So

elements in both A and B = elements in both B and A

This is called the 'intersection' of the sets.

To find elements that are in A, but not in B, we look for elements
where there is no match:

*        *   *                   *
A = { -3, -2, -1/2, 0,      1,          3     }

B = {     -2,          1/2, 1,  3/2, 2,    pi }

So

elements in A but not in B = { -3, -1/2, 0, 3 }

In this case, the order _does_ matter. If we look for elements that
are in B, but not in A, we get a different set:

A = { -3, -2, -1/2, 0,      1,          3     }

B = {     -2,          1/2, 1,  3/2, 2,    pi }
*        *   *      *
So

elements in B but not in A = { 1/2, 3/2, 2, pi }

We call the set of elements that are in A but not B the 'difference'
of A and B. You can think of it this way: To find the difference A-B,
you start with the elements of A, and remove any elements that also
happen to be in B.

To find the elements that are in A or B, we just take all the elements
in both sets:

A = { -3, -2, -1/2, 0,      1,          3     }

B = {     -2,          1/2, 1,  3/2, 2,    pi }
*   *    *   *   *   *    *   *  *   *
So

elements in A or B = {  -3, -2, -1/2, 0,
1/2,  1,  3/2, 2, 3, pi }

This is called the 'union' of the sets.

Now, in your case, you were asked to find the _integers_ that survived
these operations. So you'd want to rule out anything that ended up in
any of your result sets that isn't an integer, e.g.,

elements in A or B = {  -3, -2, -1/2, 0,
1/2,  1,  3/2, 2, 3, pi }

integers in A or B = { -3, -2, 0, 1, 2, 3 }

In effect, you're finding an intersection, difference, or union of A
and B; and then you're finding the intersection of that with the set
of all integers. Does that make sense?

When you're first getting used to this, it's easier to think in terms
of sets that are more meaningful than collections of numbers or
letters. For example,

Actors = { Julia Roberts,
Tom Hanks,
Helena Bonham Carter,

Women  = { Julia Roberts,
Helena Bonham Carter,
Sally Ride,
Valerie Shute }

Now let's think about those same operations:

Operation          What it means        Result
----------------   ----------------     -----------
Intersection       Actors who are       Julia Roberts
also women           Helena Bonham Carter

Difference         Actors who are       Tom Hanks
(actors - women)   not women            Brad Pitt

Difference         Women who are        Sally Ride
(women - actors)   not actors           Valerie Shute

Union              People who are       Julia Roberts
actors or women      Tom Hanks
Helena Bonham Carter
Sally Ride
Valerie Shute

Note that the use of the word 'or' is a little tricky.  In everyday
English, we usually use 'or' to mean that something is in one of two
mutually exclusive conditions.  For example, we say that it's raining
OR it's not. We say that a person is male OR female. And so on. But
that's not how we use it in set theory.

In set theory, when we say that something is in set A or set B, we
mean that it's in A, or in B, or in both sets. If we want to specify
the elements that are in either set but not the other, we have to be
explicit about that: "in either A or B, but not both."

To simply say that something is "in either A or B" without
adding "but not both" is somewhat ambiguous, because it's
not clear which meaning is intended.

How would we find the people who are either actors, or women, but not
both? One way would be to subtract the women from the actors,

(actors - women) = { Tom Hanks, Brad Pitt }

and then subtract the actors from the women,

(women - actors) = { Sally Ride, Valerie Shute }

and then take the union of these:

(women - actors) U (actors - women)

This is called a 'symmetric difference'.  So we can add that to our
table:

Operation          What it means        Result
----------------   ----------------     -----------
Intersection       Actors who are       Julia Roberts
also women           Helena Bonham Carter

Difference         Actors who are       Tom Hanks
(actors - women)   not women            Brad Pitt

Difference         Women who are        Sally Ride
(women - actors)   not actors           Valerie Shute

Union              People who are       Julia Roberts
actors or women      Tom Hanks
Helena Bonham Carter
Sally Ride
Valerie Shute

Symmetric          People who are       Tom Hanks
or women, but        Sally Ride
not both             Valerie Shute

Anyway, the whole business with 'or' takes some getting used to, but
these are the main ideas.

Does this help?

- Doctor Ian, The Math Forum
http://mathforum.org/dr.math/
```
Associated Topics:
High School Sets

Search the Dr. Math Library:

 Find items containing (put spaces between keywords):   Click only once for faster results: [ Choose "whole words" when searching for a word like age.] all keywords, in any order at least one, that exact phrase parts of words whole words

Submit your own question to Dr. Math
Math Forum Home || Math Library || Quick Reference || Math Forum Search