Search

Search papers and lessons

Fuzzy Set

Level 2 · 10 min read

A fuzzy set gives each element a degree of membership between 0 and 1 instead of a yes or no, so vague words such as tall can be described by numbers.

On this page

  • Colour = topic mix
  • Discrete math
  • ReadReady to readNot yet

TL;DR

In an ordinary set, an element is either in the set or not. A fuzzy set allows partial membership: each element gets a number from 0 (not a member) to 1 (fully a member), and the number is its degree of membership. This lets a description of a vague word such as "tall" or "warm" be written down without pretending that a sharp cut-off exists.

Builds on: Set Operations · Leads to: Fuzzy Simplicial Set, UMAP

Where it's used

Control systems. Air conditioners, washing machines and cameras in the 1980s and 1990s used fuzzy rules such as "if the room is warm and the air is humid, run the fan fast". Such rules are a many-valued version of if-then logic. Each input is given a degree of membership in words like warm and humid, and the rules combine those degrees into a smooth output. The approach was popular in Japanese consumer electronics.

Fuzzy clustering. In fuzzy clustering, each data point belongs to every cluster to some degree, rather than to exactly one. Hard methods such as k-means assign each point to a single cluster. A point between two groups can be half in one and half in the other, which is more honest than forcing a choice.

Manifold learning. The UMAP method for drawing high-dimensional data in two dimensions builds a fuzzy graph from each point's nearest neighbours. Each pair of points gets a membership strength between 0 and 1 that says how strongly the points are connected, and the layout tries to keep strongly connected points close. The underlying object is a graph whose edges carry degrees instead of yes-or-no.

How it works

Take the set "tall people", with heights in centimetres. There is no exact height where tall begins. We describe it with a membership function that gives each height a degree.

  1. Choose the universe. The universe is the set of heights we care about, here from 160 cm to 200 cm. Check: every person we consider has a height in this range.
  2. Choose the membership rule. Below 170 cm the degree of "tall" is 0. Above 190 cm it is 1. Between them the degree rises in a straight line: μ(h)=(h−170)/20\mu(h) = (h - 170)/20. Check: at 170 the value is 0, and at 190 it is 1.
  3. Read the degree for a person of 180 cm. μ(180)=(180−170)/20=0.5\mu(180) = (180 - 170)/20 = 0.5. The person is tall to degree 0.5, which is halfway. Check: the value is between 0 and 1.
  4. Take the complement. The degree of "not tall" is 1−0.5=0.51 - 0.5 = 0.5. The complement flips the degree around 1, so a person who is fully tall gets 0 for "not tall". Check: the two degrees sum to 1 for this person.
  5. Combine with a second fuzzy set. Suppose the degree of "heavy" for this person is 0.8. For "tall and heavy", take the smaller degree, min⁡(0.5,0.8)=0.5\min(0.5, 0.8) = 0.5. For "tall or heavy", take the larger, max⁡(0.5,0.8)=0.8\max(0.5, 0.8) = 0.8. Check: the "and" answer is never larger than either input.
  6. Read the answers. The person is 0.5 tall, 0.5 "tall and heavy", and 0.8 "tall or heavy". Each number is a degree, not a probability, and no step required a sharp line.
flowchart LR
  H["Height in cm"] --> M["Membership rule"]
  M --> D["Degree between 0 and 1"]
  D --> C["Complement: 1 minus degree"]
  D --> I["And: smaller degree"]
  D --> U["Or: larger degree"]

The plot shows the rule for "tall" as a curve. Every height gets one degree, and the curve rises smoothly between 170 and 190.

16016517017518018519019520000.20.40.60.81height (cm)degree of membership
  • tall
A fuzzy set for tall: 0 below 170 cm, 1 above 190 cm, and 0.5 at 180 cm.

The math

Definition: Fuzzy set

A fuzzy set AA on a universe UU is given by a membership function μA:U→[0,1]\mu_A : U \to [0, 1]. For each element xx, the number μA(x)\mu_A(x) is the degree to which xx belongs to AA. An ordinary set is the special case where every degree is 0 or 1.

Step 2 in symbols: the membership function

The rule in the walkthrough is μtall(h)=min⁡(1,max⁡(0,(h−170)/20))\mu_{\text{tall}}(h) = \min\bigl(1, \max(0, (h - 170)/20)\bigr). The inner max⁡\max keeps the value at 0 or above, and the outer min⁡\min keeps it at 1 or below. Written this way, the function is defined for every height and always returns a number in [0,1][0, 1].

Step 4 in symbols: complement

The complement of a fuzzy set has degree μAc(x)=1−μA(x)\mu_{A^c}(x) = 1 - \mu_A(x). An element that is fully in AA (degree 1) is fully out of AcA^c (degree 0). In the example, μnot tall(180)=1−0.5=0.5\mu_{\text{not tall}}(180) = 1 - 0.5 = 0.5.

Step 5 in symbols: intersection and union

The standard choices for fuzzy operations are

μA∩B(x)=min⁡(μA(x),μB(x)),μA∪B(x)=max⁡(μA(x),μB(x)).\mu_{A \cap B}(x) = \min\bigl(\mu_A(x), \mu_B(x)\bigr), \qquad \mu_{A \cup B}(x) = \max\bigl(\mu_A(x), \mu_B(x)\bigr).

These match the ordinary set operations on degrees 0 and 1: when both degrees are 0 or 1, the minimum is the "and" and the maximum is the "or". Other operations, such as the product, are also used, and they give different answers for values strictly between 0 and 1.

Worked examples

Example
1. Four elements (tiny)

The universe is U={1,2,3,4}U = \{1, 2, 3, 4\}. Set AA has degrees 0,0.3,0.7,10, 0.3, 0.7, 1 for the four elements. Set BB has degrees 0.5,0.2,0.9,10.5, 0.2, 0.9, 1.

  1. Complement of AA: subtract each degree from 1. The values are 1,0.7,0.3,01, 0.7, 0.3, 0.
  2. Intersection: take the minimum of each pair. For element 1 the pair is (0,0.5)(0, 0.5) and the minimum is 0. For element 2 it is (0.3,0.2)(0.3, 0.2), minimum 0.2. For element 3 it is (0.7,0.9)(0.7, 0.9), minimum 0.7. For element 4 it is (1,1)(1, 1), minimum 1. The values are 0,0.2,0.7,10, 0.2, 0.7, 1.
  3. Union: take the maximum of each pair. The values are 0.5,0.3,0.9,10.5, 0.3, 0.9, 1.
  4. Check: every intersection value is at most the matching value of AA and of BB, and every union value is at least both.

Answer: the complement is 1,0.7,0.3,01, 0.7, 0.3, 0, the intersection is 0,0.2,0.7,10, 0.2, 0.7, 1, and the union is 0.5,0.3,0.9,10.5, 0.3, 0.9, 1.

Example
2. Tall and heavy (standard)

Two people are described by their degrees for "tall" and "heavy".

  • Person P: tall 0.5, heavy 0.8.
  • Person Q: tall 0.9, heavy 0.4.
  1. For P, the "and" degree is min⁡(0.5,0.8)=0.5\min(0.5, 0.8) = 0.5. The "or" degree is max⁡(0.5,0.8)=0.8\max(0.5, 0.8) = 0.8.
  2. For Q, the "and" degree is min⁡(0.9,0.4)=0.4\min(0.9, 0.4) = 0.4. The "or" degree is max⁡(0.9,0.4)=0.9\max(0.9, 0.4) = 0.9.
  3. Compare the people on "tall and heavy": Q has 0.4 and P has 0.5, so P is the better fit for the stricter description.
  4. Compare on "tall or heavy": Q has 0.9 and P has 0.8, so Q is the better fit for the looser description.
  5. The ranking changes with the operator, which is why the choice of "and" and "or" is part of the model.

Answer: P scores 0.5 and Q scores 0.4 for "tall and heavy", and P scores 0.8 and Q scores 0.9 for "tall or heavy".

Example
3. A thermostat rule (realistic)

A fan controller uses the fuzzy set "warm", with membership μwarm(t)=min⁡(1,max⁡(0,(t−18)/8))\mu_{\text{warm}}(t) = \min\bigl(1, \max(0, (t - 18)/8)\bigr) for a temperature tt in degrees Celsius. The rule is "if warm and humid, the fan is high". Humidity has a degree of "high humid" of 0.8 at the current reading.

  1. At t=22t = 22, the warm degree is (22−18)/8=0.5(22 - 18)/8 = 0.5.
  2. The rule uses "and", so the strength of the rule is min⁡(0.5,0.8)=0.5\min(0.5, 0.8) = 0.5.
  3. At t=26t = 26 the warm degree is (26−18)/8=1(26 - 18)/8 = 1, so with humidity 0.8 the rule strength is min⁡(1,0.8)=0.8\min(1, 0.8) = 0.8.
  4. The controller turns the rule strengths into a fan speed. A stronger rule pushes the speed further toward high.

Answer: at 22 degrees the rule has strength 0.5, and at 26 degrees it has strength 0.8, so the fan runs faster as the room gets warmer.

Try it: at t=25t = 25 with humidity degree 0.3, what is the strength of the rule? Answer: the warm degree is (25−18)/8=0.875(25 - 18)/8 = 0.875, and min⁡(0.875,0.3)=0.3\min(0.875, 0.3) = 0.3.

Common mistakes and tradeoffs

It is tempting to think a degree of 0.7 means a 70 percent chance. In fact membership describes how well an element fits a vague word, not how likely an event is. A person who is 0.7 tall is not "tall with probability 0.7". Probability is the right tool for uncertainty about a fact, and fuzzy membership for a category without sharp edges.

It is tempting to think that a set and its complement cannot overlap. In an ordinary set, AA and AcA^c never share an element. In a fuzzy set, the rule min⁡(μA,1−μA)\min(\mu_A, 1 - \mu_A) gives 0.5 when μA=0.5\mu_A = 0.5, so the element is partly in both. The law that "A and not A is empty" fails for fuzzy sets.

It is tempting to think the min and max rules are the only correct ones. They are a standard choice, not a law. The product rule μA⋅μB\mu_A \cdot \mu_B for "and" gives smaller values and is common in some control systems, so results depend on the operators chosen.

Use fuzzy sets when the categories are vague and a smooth degree is more useful than a cut-off, as in control rules and clustering. Do not use them to describe uncertain facts, where probability is the standard model. Alternatives include sharp thresholds (simple but brittle at the boundary) and probabilistic models that treat the category as a latent variable.

History

Before 1965, most mathematics treated a set as having a sharp boundary. In 1965 Lotfi Zadeh published "Fuzzy sets" in the journal Information and Control, which introduced membership degrees between 0 and 1 and the min and max operations used here. The idea was controversial, because critics argued that vague descriptions should be handled by probability or by careful definitions.

In 1975 Ebrahim Mamdani and Sedrak Assilian used fuzzy rules to control a laboratory steam engine, which showed that the approach could drive a physical system. Through the 1980s, engineers applied fuzzy controllers in consumer products, especially in Japan, and the method became a standard tool in control engineering. Its use in data science, such as fuzzy clustering and fuzzy graphs, came later.

Recap

  • A fuzzy set gives each element a degree of membership between 0 and 1.
  • A membership function turns a measured value, such as a height, into a degree.
  • The complement is 11 minus the degree, the intersection is the minimum, and the union is the maximum.
  • The degrees are not probabilities, and the choice of operators changes the results.

Read next: Fuzzy Simplicial Set for fuzzy graphs, and UMAP for a method that uses them to draw data.

Check yourself

QuestionAn element has membership degree 0.2 in a fuzzy set A. What is its degree in the complement of A?Show answer

The complement's degree is 1−0.2=0.81 - 0.2 = 0.8.

QuestionSet A has degree 0.6 for an element and set B has degree 0.9. What are the degrees of the element in A and B, and in the intersection and union?Show answer

The degrees in A and B are 0.6 and 0.9. The intersection takes the minimum, min⁡(0.6,0.9)=0.6\min(0.6, 0.9) = 0.6, and the union takes the maximum, max⁡(0.6,0.9)=0.9\max(0.6, 0.9) = 0.9.

QuestionWhy can a fuzzy set and its complement both contain the same element, and why is that not a contradiction?Show answer

If the degree is 0.5, then the complement's degree is also 0.5, so the element is partly in both. This is not a contradiction, because membership is a matter of degree. The rule that an ordinary set and its complement share no elements does not carry over to fuzzy sets.

QuestionA thermostat uses a membership function for warm that rises from 0 at 18 degrees to 1 at 26 degrees. What is the warm degree at 22 degrees, and why is it not a probability?Show answer

The warm degree at 22 degrees is (22−18)/8=0.5(22 - 18)/8 = 0.5. It is not a probability because it describes how well 22 degrees fits the vague word warm, not the chance of an event.

Sources