Definition
Is 30 °C hot? For someone in Shimla, yes; for someone in Chennai, not really. Is it a bit hot? Fairly hot? Ordinary logic must answer only yes or no. Fuzzy logic allows "partly true".
Fuzzy logic is a form of reasoning in which statements can be partly true, with a degree of truth between 0 and 1. A fuzzy set, such as "hot temperatures", gives each value a degree of membership through a membership function. Fuzzy systems combine rules written in everyday terms, such as "if the room is hot, run the fan fast", by fuzzifying inputs, applying the rules and defuzzifying the result into a precise output.
In simple words
Instead of a light switch that is only on or off, fuzzy logic is like a dimmer. A room at 27 °C might be "warm" to degree 0.6 and "hot" to degree 0.2. The fan's speed is then set smoothly, not jumping suddenly at one exact temperature.
Overview
- Fuzzy logic, introduced by Lotfi Zadeh in 1965, allows degrees of truth between 0 and 1.
- A fuzzy set gives each element a membership degree, such as 30°C being 0.7 "hot".
- Fuzzy rules use words: IF temperature is hot AND humidity is high THEN fan speed is fast.
- A fuzzy controller fuzzifies inputs, applies rules, combines results and defuzzifies to a crisp output.
- Fuzziness is about vagueness, not randomness; it is different from probability.
- Washing machines, air conditioners, cameras and Japan's Sendai subway (1987) have used fuzzy control.
Why it matters
Many controls and decisions involve vague categories that people handle easily. Fuzzy logic lets engineers turn expert rules of thumb into smooth, robust controllers, and it is used in appliances, cars and industrial systems.
Key terms
- Degree of truth
- A number from 0 (false) to 1 (true) saying how true a statement is.
- Fuzzy set
- A set whose members belong to it to a degree, such as "tall people".
- Membership function
- A curve giving each value its degree of membership in a fuzzy set.
- Linguistic variable
- A variable described by words, such as temperature being cold, warm or hot.
- Fuzzification and defuzzification
- Turning precise inputs into degrees, and turning fuzzy results back into one precise output.
- Fuzzy rule
- An if-then rule using linguistic terms, such as "if dirt is high then wash longer".
Types
Fuzzy systems are built from several types of component. These are the types you need to design one.
1. Membership functions
Curves that say how strongly a value belongs to a fuzzy set.
- How it works: Common shapes are triangular, trapezoidal and Gaussian; overlapping sets such as cold, warm and hot cover the input range.
- Example: "Warm" rises from 0 at 20°C to 1 at 27°C and falls to 0 at 34°C; 30°C is then about 0.57 warm.
- When to use it: Use them to turn measurements into the words experts naturally use.
2. Fuzzy operators
Fuzzy versions of AND, OR and NOT.
- How it works: AND is usually the minimum of the degrees, OR the maximum, and NOT is 1 minus the degree.
- Example: If hot = 0.7 and humid = 0.4, then "hot AND humid" = 0.4 and "hot OR humid" = 0.7.
- When to use it: Use them to combine conditions in fuzzy rules.
3. Mamdani fuzzy inference
A rule system whose outputs are fuzzy sets, introduced by Ebrahim Mamdani in 1975.
- How it works: Each rule clips its output set by its firing strength; the clipped sets are combined and then defuzzified.
- Example: An air-conditioner controller with rules about temperature and humidity setting fan speed.
- When to use it: Use it when rules should be readable by people, since every output is described in words.
4. Sugeno (Takagi-Sugeno) fuzzy inference
A rule system whose outputs are numbers or linear functions of the inputs.
- How it works: The final output is a weighted average of each rule's output, so no separate defuzzification is needed and computation is fast.
- Example: Controlling a car's automatic gearbox smoothly from speed and throttle.
- When to use it: Use it in control systems and when combining fuzzy logic with learning, as in ANFIS neuro-fuzzy models.
5. Defuzzification methods
Ways to turn a fuzzy output set into one crisp number.
- How it works: The centroid method takes the centre of gravity of the output shape; others take the mean or the largest of the maximum values.
- Example: A combined fan-speed set whose centroid is 1,150 rpm.
- When to use it: Use the centroid as the default; it gives smooth, stable control outputs.
Explained in detail
Crisp versus fuzzy
In ordinary, crisp logic, "hot" might be defined as 30 °C or above. Then 29.9 °C is not hot at all and 30.0 °C is fully hot, a sudden jump that does not match how people think. Fuzzy logic, introduced by the mathematician Lotfi Zadeh at the University of California, Berkeley, in 1965, replaces the sharp boundary with a gradual one. A membership function for "hot" might be 0 below 25 °C, rise steadily to 1 at 35 °C, and stay 1 above. Then 30 °C is hot to degree 0.5. A value can belong to several sets at once: 28 °C might be "warm" to degree 0.4 and "hot" to degree 0.3.
How a fuzzy controller works
| Step | What happens | Fan example at 28 °C |
|---|---|---|
| Fuzzify | Measure degrees of membership | cool 0.0, warm 0.8, hot 0.14 |
| Apply rules | Each rule fires to the degree its condition is true | "warm → medium speed" at 0.8; "hot → high speed" at 0.14 |
| Combine | Merge the outputs of all rules | A blend of medium and high |
| Defuzzify | Turn the blend into one number, often a weighted average | Fan speed about 57 per cent |
Where fuzzy logic is used
- Washing machines that adjust water, wash time and spin to the load size and how dirty the water is.
- Air conditioners and rice cookers that hold temperatures smoothly.
- The Sendai subway in Japan, opened in 1987, used a fuzzy controller for smoother acceleration and braking.
- Camera autofocus, car automatic transmissions and anti-lock brakes.
- Decision support that combines vague criteria such as "fairly risky" and "very urgent".
Fuzzy logic versus probability
They are often confused but answer different questions. Probability describes uncertainty about whether something is true: "there is a 70 per cent chance it will rain". Fuzzy logic describes vagueness about how true something is: "the room is 0.7 hot" means it is fairly hot, not that it might be hot. A glass that is 70 per cent full is 0.7 full with certainty; there is nothing uncertain about it. Many real systems need both, and the two can be combined.
How it works
- Choose input and output variables and their linguistic terms.
- Draw a membership function for each term.
- Write rules in everyday language with experts.
- Fuzzify inputs, fire rules and combine their outputs.
- Defuzzify into a precise output and tune the functions by testing.
In code
def ramp_up(x, a, b): # 0 below a, rising to 1 at b
return max(0.0, min(1.0, (x - a) / (b - a)))
def ramp_down(x, a, b): # 1 below a, falling to 0 at b
return 1.0 - ramp_up(x, a, b)
def triangle(x, a, peak, c):
return max(0.0, min((x - a) / (peak - a), (c - x) / (c - peak)))
def fan_speed(temp):
cool = ramp_down(temp, 20, 26)
warm = triangle(temp, 22, 27, 32)
hot = ramp_up(temp, 27, 34)
# rules: cool -> 10% speed, warm -> 50%, hot -> 95%; defuzzify by weighted average
weights = [(cool, 10), (warm, 50), (hot, 95)]
total = sum(w for w, _ in weights)
speed = sum(w * s for w, s in weights) / total if total else 0
return cool, warm, hot, speed
print(" temp cool warm hot fan%")
for t in [20, 24, 26, 28, 30, 33, 36]:
cool, warm, hot, speed = fan_speed(t)
print(f"{t:>4}C {cool:.2f} {warm:.2f} {hot:.2f} {speed:5.1f}")Output
temp cool warm hot fan% 20C 1.00 0.00 0.00 10.0 24C 0.33 0.40 0.00 31.8 26C 0.00 0.80 0.00 50.0 28C 0.00 0.80 0.14 56.8 30C 0.00 0.40 0.43 73.3 33C 0.00 0.00 0.86 95.0 36C 0.00 0.00 1.00 95.0
Try it yourself
The smooth fan
Two fans control themselves from room temperature.
Fuzziness or probability?
Match each statement to what it describes.
- The tea is fairly hot (0.7)
- 70 per cent chance of rain tomorrow
- The glass is 0.7 full
- The coin will probably land heads
Common mistakes
- Confusing degrees of truth with probabilities.
- Using sharp thresholds where gradual behaviour is wanted.
- Designing membership functions without testing them on real cases.
Check yourself
Summary
- Fuzzy logic allows degrees of truth between 0 and 1.
- Fuzzy controllers fuzzify inputs, apply word-based rules and defuzzify to a precise output.
- Fuzziness describes vagueness; probability describes uncertainty.
Read it. Now try it yourself.
Open the interactive activityFinished reading?
Sources: Lotfi Zadeh, "Fuzzy Sets", Information and Control (1965) · Russell and Norvig, Artificial Intelligence: A Modern Approach (4th edition)