# The Rigor of Fuzzy Sets

Perhaps “fuzzy set theory”, “fuzzy arithmetic”, and “fuzzy rules” could have been named something a bit less mock-worthy. The word “fuzzy” has English synonyms “blurred”, “unfocused”, and the worst “ill-defined”. However, fuzzy set theory is anything but fuzzy. Maybe cuddly and fun, but certainly not ill-defined. We’ll take a look in this post at what exactly fuzzy sets are. Fuzzy set theory is an extension of classical set theory, so we’ll first take a look at the basics of a classical set.

## Classical sets

A classical set is one we all deal with explicitly on a daily basis, even if we don’t use that terminology. An item or element is either a member of a classical set, or it is not. Examples are

- Even numbers, denoted 2\mathbb{Z}
- A list of members of a particular country club
- Wavelengths that are classified as UV light
- The set of perfect squares S = \{ k^2 : k \in \mathbb{N}\}

If we take an element in the relevant universe for each example, we are faced with the binary decision of whether or not it is a member of the set. 3 is not a member of 2\mathbb{Z}; 4 is. I am not a member of any country club, so given a particular one, I do not fall in that set. The electromagnetic spectrum is a continuum, but the cutoffs are strict. A wavelength between 10nm and 400 nm is ultraviolent. Any wavelength less than 10nm or greater than 400 nm is not. Finally, a the square of a rational number cannot be a perfect square, because a rational number is not a natural number. 3 is a natural number, but there is no natural number whose square gives 3.

For all of these sets, we can define a *characteristic function *of a set* * A (denoted \chi_{A}(x)) that takes an input and returns a 1 if the input is an element of the set A and 0 if it is not. Mathematically, we write

That is, if A = 2\mathbb{Z}, then \chi_{A}(3) = 0, and \chi_{A}(4) = 1.

Now, what if we relax the requirement that you either be in or out? Here or there? Yes or no? What if I allow “shades of grey” to use a colloquialism? Then we extend classical sets to *fuzzy sets*.

## Partial Membership is well-defined

Many things we encounter daily aren’t strict or *crisp* as is used in mathematics. Someone might tell you that you can either be in or out of a room, but what if you stand with one foot on either side of the threshold? It doesn’t make sense to then say you are neither in nor out, because part of you is certainly inside the room. You can’t “pick one”, because the whole you is not wholly in either place all at once.

Fuzzy sets allow for *partial membership* in a set. That is, you can be “a little bit” in the room (perhaps a toe is sticking in), “halfway” in the room (straddling the threshold), “most of the way” in the room (only a foot sticking out of the room), and everything in between. We formally define this notion by extending the characteristic function \chi_{A}(x) to include the possibility of fractional membership.

The *membership function* of a fuzzy set A (denoted \mu_{A}(x)) takes an element x in a universe X and maps it somewhere in the interval [0,1] according to the level of membership it has in the set A. That is,

**Example (Defining a bacon lover)**

Let x \in \mathbb{Q} be the number of slices of bacon a person eats per day. (We will allow for partial consumption of bacon slices.) Suppose for simplicity that no one would ever eat more than 5 slices per day. Then a possible membership function for classifying someone as a “bacon-lover” could be

\mu_{A}(x) = \left\{\begin{array}{lr}\frac{x-1}{2}, &1\leq x \leq 3 \\ 1, &3 \leq x\leq 5\\0, & \text{ otherwise}\end{array}\right.

So given the number of bacon slices you eat per day, we can use the membership function \mu_{A}(x) to determine your level of commitment to bacon. If you eat 2 slices of bacon per day, \mu_{A}(2) = 0.5, so you are a “halfway” bacon-lover.

### Level sets

We can also look at fuzzy sets in terms of their *level sets*, as a way to “backsolve” to determine what values of x are at least an \alpha level of membership in the set, where 0\leq \alpha\leq 1. Denoted A_{\alpha}, we define the \alpha-level set as

**Example**

For the bacon set, we can use the graph above.

- A_{1} = [3,5]
- A_{1/2} = [2, 5]
- A_{3/4} = [2.5,5]

In general, we can find the \alpha-level set by inverting the membership function. In this case, the right endpoint is always 5, and the left endpoint is given by 2\alpha + 1.

So, A_{1/8} = \left[ 2\cdot \frac{1}{8} + 1, 5\right] = [1.25 , 5]

Some special level sets are the A_{1}, called the *core*, and A_{0}, called the *support. *The core tells us the interval that represents full membership, and the support tells us how “wide” the entire fuzzy set actually is.

Now that we understand what fuzzy sets are, let’s look at doing some things with them.

## Fuzzy set operations are identical to classical set operations

We’re going to dive a little further into fuzzy set theory and discuss operations on fuzzy sets such as union, intersection, and complementation. Since the fuzzy set is a nice extension of the classical set, the definitions of union, intersection, and complementation actually remain the same for fuzzy sets as for classical sets. The only difference is that the result is a fuzzy set rather than a classical set.^{1} We’ll discuss each one in turn.

### Union

The union is represented by the phrase “or”– that is, given two sets A and B, an element is a member of the *union* of A and B if it is in either A or B.^{2}

In classical set theory, the characteristic function of the union of two sets A and B is given by

\chi_{A \cup B}(x) = \text{max}\left(\chi_{A}(x),\chi_{B}(x)\right)Let’s look at classical sets again, and let A be the set of prime numbers, and B be the set of odd numbers.

- \chi_{A \cup B}(3) = \text{max}(A(3), B(3)) = \text{max}(1,1) = 1 so 3 is in A \cup B
- \chi_{A \cup B}(2) = \text{max}(A(2), B(2)) = \text{max}(1,0) = 1 so 2 is in A \cup B
- \chi_{A \cup B}(4) = \text{max}(A(4), B(4)) = \text{max}(0,0) = 0 so 4 is not in A \cup B

For fuzzy sets, the formula for the membership function of the union of two fuzzy sets A \vee B^{3} remains exactly the same as for the characteristic function of the union of two classical sets.

Let’s keep our bacon set A and define B as the fuzzy set that classifies a “cheese-aficionado” with membership function

\mu_{B}(x) = \left\{\begin{array}{lr}\frac{x}{5}, &0\leq x\leq5\\0, &\text{otherwise}\end{array}\right.

We can now find \mu_{A \vee B}(x) = \max(\mu_{A}(x),\mu_{B}(x)). For unions, the left endpoint of the support will be the smaller of the two left endpoints of the supports of A and B, and the right endpoint of the union will be the larger of the two right endpoints of the supports of A and B. The support of “bacon-lover” union “cheese aficionado” will then be [0,5], which you can see from the graph.

The membership function is given by

\mu_{A \vee B}(x) = \left\{\begin{array}{lr}\frac{x}{5}, & 0\leq x \leq \frac{5}{3}\\\frac{x-1}{2}, & \frac{5}{3}\leq x \leq 3\\ 1, & 3\leq x \leq 5\end{array}\right.

### Intersection

The intersection of two sets denoted A \cap B is represented in language by the word “and”– an element must be a member of both sets simultaneously to be in the intersection of two sets. For the classical set example, we’ll look again at A as the set of prime numbers, and B as the set of odd numbers. The membership function of the intersection of two classical sets, denoted \chi_{A \cap B} is given by

\chi_{A \cap B} = \min\left(\chi_{A}(x), \chi_{B}(x)\right)- \chi_{A \cap B}(3) = \min(A(3), B(3)) = \min(1,1) = 1 so 3 is in A \cap B
- \chi_{A \cap B}(2) = \min(A(2), B(2)) = \min(1,0) = 0 so 2 is not in A \cap B
- \chi_{A \cap B}(4) = \min(A(4), B(4)) = \min(0,0) = 0 so 4 is not in A \cap B

Just like for the union, the membership function of the intersection of two fuzzy sets (denoted A \wedge B) has the same formula as that for the classical counterpart.

\mu_{A \wedge B} = \min\left(\mu_{A}(x), \mu_{B}(x)\right)The intersection of our fuzzy bacon set and our fuzzy cheese set then is given by

\mu_{A \wedge B} = \left\{\begin{array}{lr}0, & 0\leq x \leq 1\\\frac{x-1}{2}, & 1\leq x \leq \frac{5}{3}\\\frac{x}{5}, & \frac{5}{3}\leq x \leq 5\end{array}\right.

### Complement

The complement of a set (denoted A^{c} \text{ or } \overline{A}) is represented by the English word “not”, and indicates negation. Everything outside a given set is the complement of a set. The membership function for the complement of a fuzzy set is identical to the characteristic function of the complement of a classical set:

\mu_{A^{c}}(x) = 1-A(x)The complement of a “bacon-lover”, (a bacon-hater?) is then

\mu_{A^{c}}(x) = \left\{\begin{array}{lr}\frac{3-x}{2}, & 1\leq x \leq 3 \\ 0, & 3\leq x \leq 5\end{array}\right.

## Conclusion

Fuzzy sets are simply an extension, or generalization of the classical sets we all implicitly knew already. A good definition, especially one that intends to extend a concept should contain the original concept as a special case. Fuzzy sets do indeed contain classical sets inside their definition. Moreover, operations on fuzzy sets should not need wholly new definitions. We saw that union, intersection, and complementation still hold for fuzzy sets just as they did before, so the theory of fuzzy sets is well defined and represents a consistent extension of classical set theory. The next post will extend the concept of fuzzy sets to fuzzy numbers, and then investigate how arithmetic works for fuzzy numbers.

#### Footnotes

- A classical set is really a special case of a fuzzy set.
- “Or” should not be confused with “Xor” (exclusive or). 5 is in the union of odd numbers and prime numbers, and it is both an odd number and a prime number. That is, an element that is a member of both sets is also in the union.
- We changed the notation here to show that we are not looking at classical sets anymore

## 2 thoughts on “The Rigor of Fuzzy Sets”

Well done and easily understood. In order to implement fuzzy numbers in algorithms, it will be necessary to define standard arithmetic (e.g., addition) operations. How is that done? Is it in terms of set operations?

Great article, very clear and easy for a person without a math degree to completely understand.