VOOZH about

URL: https://www.geeksforgeeks.org/python/common-operations-on-fuzzy-set-with-example-and-code/

⇱ Common Operations on Fuzzy Set with Example and Code - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Common Operations on Fuzzy Set with Example and Code

Last Updated : 9 Jan, 2026

A Fuzzy Set is a set where each element has a value between 0 and 1 showing how much it belongs to the set. It is usually written with a tilde (~) on top of the set.

Operations on Fuzzy Set

1. Union

Let A and B be two fuzzy sets.The Union of A and B is denoted by A ∪ B and is defined as:

μA∪B​(x)= max(μA​(x), μB​(x))


Output
Fuzzy Set Union: {'a': 0.9, 'b': 0.9, 'c': 0.6, 'd': 0.6}

2. Intersection

The Intersection of fuzzy sets A and B is denoted by A ∩ B and defined as:

μA∩B​(x)=min(μA​(x),μB​(x))


Output
Fuzzy Set Intersection: {'a': 0.2, 'b': 0.3, 'c': 0.4, 'd': 0.5}

3. Complement

The Complement of a fuzzy set A is denoted by Ā and defined as:

μAˉ​(x)=1−μA​(x)


Output
Fuzzy Set Complement: {'a': 0.8, 'b': 0.7, 'c': 0.4, 'd': 0.4}

4. Difference 

The Difference of fuzzy sets A and B (A − B) is defined as:

μA−B​(x)=min(μA​(x),1−μB​(x))


Output
Fuzzy Set Difference A - B: {'a': 0.09999999999999998, 'b': 0.09999999999999998, 'c': 0.6, 'd': 0.5}

5. Class Implementation (Optional)

A class-based approach helps make fuzzy set operations reusable and modular.


Output
Union: {'a': 0.9, 'b': 0.9, 'c': 0.6, 'd': 0.6}
Intersection: {'a': 0.2, 'b': 0.3, 'c': 0.4, 'd': 0.5}
Complement of A: {'a': 0.8, 'b': 0.7, 'c': 0.4, 'd': 0.4}
Difference A - B: {'a': 0.1, 'b': 0.1, ...

Related Articles:

Comment
Article Tags:
Article Tags: