Skip to content
Tutorials Center
My learning

Topics

Lesson 1 of 36 ยท Getting Started

What Is Fuzzy Logic?

Learn what fuzzy logic is, why degrees of truth model human reasoning better than yes/no answers, and where fuzzy systems and expert systems are used today.

Ask ten people whether 27 ยฐC is "hot" and you will not get ten identical answers. Some will say yes, some no, and many will say "well, kind of". Ordinary computer logic cannot express "kind of": a condition is either true or false. Fuzzy logic is a way of reasoning that allows exactly that middle ground. Instead of asking "is it hot?", it asks "how hot is it?" and answers with a number between 0 (not at all) and 1 (completely).

This track teaches fuzzy logic and the closely related field of expert systems: programs that capture the know-how of a human specialist as readable rules. You will build everything yourself in Python with plain NumPy, so nothing is a black box. In this first lesson you get the big picture: what the idea is, why it was invented, and what it is good for.

About the examples. Every runnable example in this track runs in your browser with Python and NumPy. We write the fuzzy-logic code from scratch because it is short and teaches the ideas. Real projects often use a library such as scikit-fuzzy, which follows the same concepts you will learn here.

The core idea: degrees of truth

Classical (Boolean) logic has two truth values. A statement such as "the water is warm" must be True or False. Fuzzy logic keeps the two extremes but adds everything in between. The truth of a statement becomes a number in the interval [0, 1]:

  • 0.0 means completely false,
  • 1.0 means completely true,
  • 0.7 means "mostly true".

This number is called the degree of membership (or degree of truth). It tells you how strongly something belongs to a vague category such as "warm", "tall", "fast" or "risky".

Python Crisp versus fuzzy hot

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Look at 29.9 and 30. The crisp function jumps from 0 to 1 across a tenth of a degree, which feels absurd: nobody perceives such a difference. The fuzzy function changes smoothly, so a tiny change in the input causes a tiny change in the output. That smoothness is one of the main reasons fuzzy logic works so well for control systems.

Where the idea came from

Fuzzy sets were introduced in 1965 by the mathematician Lotfi Zadeh. He observed that the classes people use in everyday life ("tall people", "large numbers", "cheap restaurants") have no sharp boundaries, yet humans reason with them effectively. His proposal was to extend set theory so that an element can belong to a set partially.

In the 1970s, engineers used the idea to build the first fuzzy controllers for steam engines and cement kilns. In the 1980s Japanese companies put fuzzy controllers into subway trains, washing machines, rice cookers and camera autofocus systems, and the field took off. Today fuzzy logic sits quietly inside many products: air conditioners, anti-lock brakes, medical devices, industrial plants and decision-support software.

Linguistic reasoning with numbers

The practical strength of fuzzy logic is that it lets you write rules in almost natural language and still compute precise numeric answers. Consider how a person might describe heating a room:

TEXT
IF the room is cold   THEN heating is high
IF the room is mild   THEN heating is medium
IF the room is warm   THEN heating is low

Words like cold, mild and warm are modelled as fuzzy sets, and the rules are evaluated with fuzzy operations. The result is a single smooth number: the heater power. Here is a very small preview. It blends three rule outputs using their strengths, which is the heart of every fuzzy system you will meet later.

Python A first fuzzy thermostat

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The heater power falls smoothly as the room warms up. There are no sudden steps, and the whole controller is three rules and a few lines of code. You will learn to build and understand every piece in the next chapters.

What fuzzy logic is not

A few misunderstandings are worth clearing up early.

  • It is not "fuzzy" in the sense of sloppy. A fuzzy system is fully precise and deterministic: the same input always gives the same output. Only the concepts it reasons about are gradual.
  • It is not probability. "The water is 0.7 warm" does not mean there is a 70 % chance that the water is warm. It says the water is warm to a degree of 0.7. Fuzzy Logic vs Probability explains the difference carefully.
  • It is not machine learning. Fuzzy rules are normally written by people, or tuned by data afterwards. The system is transparent: you can read the rules and see why it made a decision.

Where fuzzy systems and expert systems are used

flowchart LR
    A["Human expertise<br/>(vague, verbal)"] --> B["Fuzzy rules<br/>and expert-system rules"]
    B --> C["Control<br/>appliances, vehicles, plants"]
    B --> D["Decision support<br/>medicine, finance, risk"]
    B --> E["Classification<br/>images, signals, diagnosis"]

Expert knowledge, written as rules, feeds three big families of applications.

An expert system is a program that stores knowledge as facts and rules and uses an inference engine to draw conclusions, much like a human specialist would explain a diagnosis. Fuzzy logic and expert systems fit together well, because real expert knowledge is full of vague terms ("slightly elevated pressure", "very likely infection"). This track covers both: fuzzy sets, membership functions and fuzzy inference first, then controllers, knowledge representation, rule-based expert systems and applications.

Fuzzy logic in one minute

Vague words Hot, tall, fast
Degrees Truth from 0 to 1
Rules IF cold THEN heat
Output One smooth number

Words in, rules in the middle, numbers out.

1 / 2

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What does a membership degree of 0.7 in the fuzzy set "warm" mean?

    A membership degree measures how strongly something belongs to a vague category. It is not a probability and not a measurement.
  2. 2. Who introduced fuzzy sets, and in which decade?

    Lotfi Zadeh published the first paper on fuzzy sets in 1965.
  3. 3. Which statement about a fuzzy system is true?

    Fuzzy systems are precise and deterministic, and their rules are readable. Only the concepts they use are gradual.
  4. 4. Why does a fuzzy ramp feel more natural than a crisp threshold at 30 degrees?

    A crisp threshold jumps from 0 to 1 at one point. A fuzzy ramp changes gradually, matching human perception.

Summary

  • Fuzzy logic replaces true/false with a degree of truth between 0 and 1.
  • It was introduced by Lotfi Zadeh in 1965 to model vague, human concepts.
  • Vague words such as "hot" become fuzzy sets; rules combine them into precise numeric outputs.
  • Fuzzy systems are deterministic and readable, and they are not the same thing as probability or machine learning.
  • Expert systems store specialist knowledge as rules; fuzzy logic lets those rules use vague terms.

Next: Crisp Sets vs Fuzzy Thinking