Sitemap
pranamya

pranamya

Fuzzy Logic

8 min readNov 17, 2025

--

Classical Sets (Crisp Sets) — Boolean Logic

An object is either a member of the set or not (binary — 0 or 1). There is no partial membership. In the universe of discourse X, any object x can be defined as given in fig 1, where x is a member of set A or not.

Fig 1 : Crisp Set

Fuzzy Logic

Fuzzy logic is a superset of boolean logic that is multi-valued (any real number between 0 and 1) and handles degrees of truth and degrees of membership. This makes it well suited for handling vague or imprecise concepts.

Example: In boolean logic, temperature is represented as being hot or cold but in fuzzy logic, temperature can be represented on a range between hot to cold.

Membership Function

If X is the universe of discourse, ie. a collection of objects denoted generically by x, then the fuzzy set A in X is defines as a set of ordered pairs denoted by fig 2, where μA(x) is called the membership function, which maps each element of X to a membership grade between 0 and 1.

Fig 2 : Fuzzy set A

Example: Let the universe of discourse X = {10°C, 20°C, 30°C, 40°C} which represent different temperature readings.

For fuzzy set A representing “Cold”, A = {(10,1), (20,0.4), (30,0), (40,0)}

For fuzzy set B representing “Warm”, B = {(10,0), (20, 0.6), (30,0.7), (40,0)}

For fuzzy set C representing “Hot”, C = {(10,0), (20,0.1), (30,0.8), (40,1)}

Membership functions can be of many types — triangular, trapezoidal, gaussian etc as given in fig 3. The x axis denotes the universe of discourse while the y axis denotes the membership value of the fuzzy set.

Fig 3 : Membership function graphs (Source — https://www.researchgate.net/figure/Types-of-membership-functions_fig1_221787834)

Fuzzy Operations

In fuzzy logic, all properties and operations are performed on membership function.

  1. Complement: μ¬A​(x) = 1−μA​(x)
  2. Intersection (AND): μA∩B​(x) = min(μA​(x),μB​(x))
  3. Union (OR): μA∪B​(x) = max(μA​,μB​)
  4. Sum:μA+B​(x) = μA​+μB​−μA​μB​
  5. Difference: μA−B​(x) = μA∩¬B​(x) = min(μA​(x),1−μB​(x))
  6. Disjunctive Sum: μA⊕B(x) = (Ā ∩ B) ∪ (A ∩ B̄) = max(min(1-μA​(x), μB​(x)),min(μA​(x), 1-μB​(x)))
  7. Bounded Sum: μA(x)⊕B(x) = min(1, μA(x) + μB(x))
  8. Bounded difference: μA(x)−B(x) = max(0, μA(x)+μB(x)-1)
  9. Algebraic Product/ Vector Product: μ=μA​(x)⋅μB​(x)
  10. Scalar Product: μ=α.μA​(x)
  11. Equality: μA​(x) = μB​(x)
  12. Power: μAⁿ(x) = ( μA(x) )ⁿ , where n < 1 is called dilation and n > 1 is called concentration.

Properties of Fuzzy Sets

  1. Commutativity: A ∪ B = B ∪ A and A ∩ B = B ∩ A
  2. Associativity: (A ∪ B) ∪ C = A ∪ (B ∪ C) and (A ∩ B) ∩ C = A ∩ (B ∩ C)
  3. Distributivity: A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C) and A ∪ (B ∩ C) = (A ∪ B) ∩ (A ∪ C)
  4. Idempotence: A ∪ A = A, A ∩ A = A, A ∪ ∅= A and A ∩ ∅= ∅
  5. Transitivity: If A ⊆ B; B ⊆ C then A ⊆ C. Subset in fuzzy set means that, for A ⊆ B, A is a subset of B if the membership grade of every element in A is less than or equal to its membership in B, ie. μA​(x) ≤ μB​(x) for all x.
  6. Involution: (Ā)̄ = A
  7. De Morgon’s law: (A ∪ B)̄ = Ā ∩ B̄ and (A ∩ B)̄ = Ā ∪ B̄

(A ∪ B)̄ can be written using membership function as 1-max(μA(x),μB(x)). Ā ∩ B ̄can be written as min(1-μA(x),1-μB(x)).

Linguistic Variable

Linguistic variable is a variable whose values are words or phrases used to describe vague or imprecise concepts in natural language. These values used are called linguistic terms. Each linguistic term is represented by a fuzzy set.

Example : Temperature → Cold, warm, hot.

Press enter or click to view image in full size
Fig 4 : Membership function for temperature

In the above example, temperature is the linguistic variable and cold, warm and hot are the lingusitic terms. 3 fuzzy sets are used to represent the 3 linguistic terms.

Fuzzy Inference Systems

Fuzzy inference system is a decision making framework that takes crsip inputs, uses fuzzy logic and rules (fuzzy if-then rules, linguistic variables, membership functions) and produces a crisp output. It is represented in fig 5.

Fig 5 : Fuzzy Inference Systems

It is applied in fields like automatic control, data classification, decision analysis, expert systems and computer vision.

I) FUZZIFIER

Fuzzification —converts crisp input to linguistic variable using the membership functions stored in the fuzzy knowledge base.

Step1: Identify the input variable, say temperature = 28° C.

Step 2: Identify the linguistic variable, say temperature.

Get pranamya’s stories in your inbox

Join Medium for free to get updates from this writer.

Step 3: Define the linguistic terms or fuzzy categories, say cold, warm and hot.

Step 4: Assign membership function, which maps any crisp input to a value between 0 and 1. With respect to fig 3, membership functions can be defined as givem in fig 4.

Fig 4a — Membership function for cold
Fig 4b — Membership function for warm
Fig 4c — Membership function for hot

Step 5 : Compute membership values

μcold(28) = 0 (from fig 4a)

μwarm(28)= 0.7 (from fig 4b)

μhot(28) = 0 (from fig 4c)

Step 6: Output the fuzzy value. At 28° C, the temperature is 70% warm, and not cold or hot.

II) FUZZY KNOWLEDGE BASE

Rule base — The rule base contains fuzzy if-then rules. They define how the input variables relate to output variables using linguistic terms. They are usually set by human experts with domain knowledge or learned/optimized from data in modern systems.

Example : IF temperatue is Hot AND Humidity is High THEN Fan Speed is High

Database — The database contains definations of fuzzy sets used in the rules. It specifies the membership function for each fuzzy variable.

Example: The linguistic variale temperature has linguistic terms cold, warm and hot. Each of these terms has a membership function.

III) FUZZY INFERENCE ENGINE

The inference engine converts the fuzzy inputs into fuzzy outputs using the if-then type fuzzy rules.

Main parts of the if-then statement

a) Antecedent (condition part) — The “IF” part of the rule that uses the fuzzy variables and membership functions to evaluate how true the condition is. Logical operators like AND, OR and NOT can be used.

Example: IF temperatue is Hot AND Humidity is High

b) Consequent (action part) — The “THEN”part of the rule that uses fuzzy sets to describe the output/action to take if the antecedent is true(to a degree).

Example: THEN Fan Speed is High

For the example, IF temperatue is Hot AND Humidity is High THEN Fan Speed is High, if μ(hot) = 0.8 and μ(high) = 0.6, AND operation gives min(0.8, 0.6) = 0.6. This means the fan speed will be activated to 60%. This is the implication step which involves shaping the fuzzy output.

IV) DEFUZZIFICATION

Aggregation of all outputs — Aggregation is the step where we combine the output from all fuzzy rules into one single fuzzy set per output variable. This set represents the combined effect of all the rules, and it is now ready to be defuzzified (crisp output).

Deffuzification — coverts the fuzzy output if the inference engine to crisp using membership function analogous to the one used by the fuzzifier.

Defuzzification Methods

1.Max Membership Method — crisp value is the value of the variable at which the membership function reaches maximum value.

x* = argmax ( μ(x) )

Pick any x where μ(x) is maximum. This method is undesirable in cases where there are multiple x values with the same maximum membership degree and it is unclear to pick one as the crisp value. It is only applicable to peaked output functions.

2. Centroid Method / Center of Gravity / Center of Area — It computes the balance point(center of mass) of the aggregated fuzzy output.

x* = ∫ x μ(x) dx / ∫ μ(x) dx

where numerator is the moment of area and the denominator is the total area.

3. Weighted Average Method — Instead of considering the full shape of the membership functions (centroid), it considers the centers (peaks) of the fuzzy set and their heights (weights). This method is restricted to symmetrical output membership functions — triangle, trapezoidal.

x* = Σ (wi zi) / Σ wi

where wi is the weight(membership value/height) and zi is the center of the membership function.

4. Mean-Max Membership — applicable to membership functions which have a plateau of maximum membership.

x* = average( x | μ(x) = μmax ) or (a+b)/2

where a and b are the start and the end points of the plateau.

5. Center of sums — treats each individual fuzzy set separately, then computes the centroid of each fuzzy set and takes a weighted average of those centroids, with weights being the area of each fuzzy sets after truncation.

x* = Σ zi.Ai dx / Σ Aidx

where zi is the centroid of the truncated fuzzy set Ai and Ai is the area of the truncated membership function for set i.

6. Center of maximums

x* = centroid of { x | μi(x) = μi,max }

7. Bisector of Area (BOA) — Finds a vertical line that divides the area into two equal halves.

∫ from a to x* μ(x) dx = ∫ from x* to b μ(x) dx

8. Smallest of Maximum (SOM) / First of Maxima (FOM)

x* = min( x | μ(x) = μmax )

9. Largest of Maximum (LOM) / Last of Maxima (LOM)

x* = max( x | μ(x) = μmax )

10. Weighted Sum Method

x* = Σ (wi zi)

I wrote this article while summarizing my learnings for an examination. Hope this helps!

--

--