Set union

Sets are objects that we can define operations on, just like we define addition and subtraction between two elements of the special set \(R\) of all real numbers. Addition on two real numbers is considered a binary operation since addition accepts two terms as input. Addition for sets is called “union,” and essentially adding all the elements in the two sets into one new set.

Let \(S_1\) and \(S_2\) be two sets. Then the union of \(S_1\) and \(S_2\) is a new set that is the collection of all elements in \(S_1\) and \(S_2.\) The traditional operator for union is the symbol \(\cup.\) We write \(S_1 \cup S_2\) and say “S sub 1 union S sub 2.” More formally, we can define the union of two sets with the statement of the rule

\[x \text{ is in } S_1 \cup S_2 \text{ if either x is in } S_1 \text{ or x is in } S_2.\]

Without indexes, let us call the first set \(A\) and the second set \(B.\) Each set is represented in the Venn diagram below with a canonical circle inside a rectangle that illustrates the super-set collection of all possible elements. The union of sets \(A\) and \(B\) is the combined collection of the elements in the shaded regions. The elements of the sets (counted only once) collected together, creating one new collection we denote \(A \cup B.\)

The union of the sets $$A$$ and $$B$$, denoted $$A \cup B,$$ is the set containing all elements of the set $$A$$, or set $$B$$, or both the sets.
The union of the sets \(A\) and \(B\), denoted \(A \cup B,\) is the set containing all elements of the set \(A\), or set \(B\), or both the sets.

Example 1: Let E = \(\{0, 2, 4\}\) and O = \(\{1, 3, 5\}\). Then \(E \cup O = \{0,1, 2, 3, 4, 5\}\)

The guidelines we gave for a set specified that the elements of a set are unique, no repeats. This means that when we union two sets together that share a common element, that element is only represented in the set one time.

Example 2: Let \(S_1 = \{a, e, i, o, u\}\) and \(S_2 = \{b, i, n, g, o\}.\) Then \(S_1 \cup S_2 = \{a, e, i, o, u, b, n, g\}\).

The following example demonstrates one of the relationships that exist between the set of positive integers \(Z^+\) and the set of natural numbers \(N.\)

Example 3: Let \(A = {0}\) and \(Z^+\) be the set of all positive integers. Then \(A \cup Z^+ = {0, 1, 2, 4, \ldots} = N,\) the set of natural numbers.

Example 4: Let \(A = { } = \emptyset\) and \(Z^+\) be the set of all positive integers. Then \(\emptyset \cup Z^+ = Z^+.\)

The statement in Example 4 is referred to as the identity property with respect to set union in that: if \(A\) is a set, \(A \cup \emptyset = A = \emptyset \cup A.\)

In evaluating an algebraic expression like 2 + 4 + 5, most would simply say the value of the expression is 11 without a second thought about the fact that addition is a binary operation. The importance is in the details. Addition is a binary operator, so when defining addition, the input taken in consists only of two real numbers. Using a left to right approach, one would find the sum of 2 and 4, 6. Then use 6 as the first term in the new addition problem to find 6 + 5.

Set union for sets is exactly the same as addition among elements of the set \(R.\) Only two sets are unioned at one time. Additionally, set union can be extended to an infinite number of terms. When adding many terms, the standard is to use a capital sigma to indicate summation.

\[\Sigma_{i = 1}^5 i = 1 + 2 + 3 + 4 + 5 = 15\]

The above sum is actually:

\[(((1 + 2) + 3) + 4) + 5\]

In the same way, set union can be extended to expressions involving more than two sets. In fact, set union can be extented to an infinite number of sets as we see in the next few examples. As you look through the examples, also pay attention to the role that the Empty set and the Universal set play.

Example 5: Let

\(S_1\) = {0,1}, \(S_2\) = {0,1,2}, and \(S_3\) = {0,1,2,3}. Then, \(\cup_{i = 1}^3 S_i = (S_1 \cup S_2) \cup S_3\) = {0, 2, 3}.

There are some key properties about set union that should be noted: For sets \(A,\) \(B\) and \(C,\) the complement set of \(A\) is \(A^{c}\) and \(U\) is the Universal set.

Set union is:

  1. commutative: \(A \cup B\) is the same set as \(A \cup B\)

  2. associative: \((A \cup B) \cup C\) is the same set as \(A \cup (B \cup C)\)

Set union has an identity:

\[A \cup \emptyset = A\]

The union of a set with its complement is the Universal set:

\[A \cup A^{c} = U\]

If there is a Universal set, \(U\), then:

\[A \cup U = U.\]

A visual representation for a set intersection can be helpful when studying the derived set. A Venn diagram is one way to depict the intersection of sets. In the following image, the sets \(A\) and \(B\) are drawn as circles and the intersection of A and B, \(A \cap B,\) is indicated by the shaded area.

An example of the union of sets from the “real-world” is a web query search for relative information. Let’s say a user is interested in information available on the web about US presidents. Before we begin, the Universal set is the set of all webpages that could be returned to the user through their webb browser. The Empty set would be the result set when there are no relevant webpages indexed for US presidents. Without going into a lot of detail, a simple approach for the server is to find the set of all webpages where “US” is mentioned along with the set of all webpages containing the term “president” then return the union of these two sets.

As a set, the webpages would not have a ordering nor would duplicate pages be included. The results would contain many pages that are relevant to the US but not to US presidents and also sites that mention presidents that are not US presidents. The union of the sets contains elements that are in unique to each set as well as the elements that are in both sets.

Since a set cannot contain duplicate elements, when we find the union of two sets it is important to complete the operation and remove from the union any elements that are common to both sets. Specifically:

If \(A = \{ 1, 3, 5, 7\}\) and \(B = \{1, 5, 9\}\) then we would construct the union of \(A\) and \(B\) by following the steps:

Create an empty set called A U B
For all x in A
	add x into A U B
For all x in B
    if x is not in A U B
		add x into A U B

Following the above set of instructions takes us a total of 8 steps = number of elements in set \(A\) + number of elements in set \(B\) plus 1 to create the emptyset (excluding the check to see if \(x\) is not already in \(A \cup B.\) The value of \(A \cup B\) moves through the following values:

\(A \cup B =\) \(\{ \} \rightarrow \{1\} \rightarrow \{1, 3\} \rightarrow \{1, 3, 5\} \xrightarrow[]{3} \{1, 3, 5, 7\} \rightarrow \{1, 3, 5, 7, 9\}\)

The resulting value of the set is \(A \cup B = \{1, 3, 5, 7, 9\}\)


Back to course home