Fuzzy Logic

Exploring the concepts of fuzzy logic in real-world applications.

Introduction

What do you think as a tech guy is the easiest way to learn the fuzzy logic? Just Goooooooooooooogle it! So that's what I did!

Meaning Of Fuzzy

Meaning Of Fuzzy

Meaning Of Logic

Meaning Of Logic

But both of these do not represent the meaning, so I then searched for Fuzzy Logic as:

Meaning Of Fuzzy Logic

Meaning Of Fuzzy Logic

So, basically, fuzzy logic means something that makes the computer behave like a human brain.

But how? Right!

So, let's understand that with the help of an example of Instagram.

How many of you use Instagram?

I think a lot! Right!

One day I was scrolling Instagram like you, and my IG Algo knows that:

  1. Rahul likes 90% cat videos.
  2. Rahul likes 70% memes.
  3. Rahul likes 80% food videos.

And based upon that, I get videos like:

Cat Video

Meme Video

Food Video

Now, when IG wants to push a new video, a pic, or a reel in my feed, of course, it will have to think about what is engaging and interesting to me and show that on the feed, right?

And to solve this problem, here comes our hero: FUZZY LOGIC!

Hero Fuzzy Logic

And based upon the percentage, it shows me the reel like a cat video having food and a meme as:

A Cat Video Having Food and A Meme

*Disclaimer: The videos displayed are not mine and are the property of their respective copyright holders.

But now the new question that comes to my mind is how we got the %age right?

Working of Instagram

Working of Instagram

And to do that again our HERO comes and based upon the various factors like watch time on the app, my likes, my comments, my followings and all that combine which are called as knowledge base which includes fuzzy rule base and and database and based upon the Algo decide and creates a fuzzy values for the content to be served and this loop goes on.

Now, our next topic is :

Fuzzy Set

Before understanding the fuzzy set, lets understand the topic of crisp set, which is nothing but a nornal set as:

A = ❴ 1,2,3,4,5,6......... ❵
Set of Numbers

And, it is part of the Universe of Discourse of Numbers as:

Universe of discourse of Numbers

Universe of discourse of Numbers

Likewise, We can have the Universe of Discourse of Cats:

Universe of Discourse of Cats

Universe of Discourse of Cats

Okay! Let us see the fuzzy sets: so fuzzy sets are similar crisp ones but they have values between 0 and 1 and these are generated from the crisp set with the help of membership function.

μA❨x❩
Crisp to Fuzzy Set

Crisp to Fuzzy Set

Fuzzy value tell us how much an element/ notation belongs to a set or not!

Crisp vs Fuzzy Set

Crisp vs Fuzzy Set

Now, Lets us talk about the operations on the Fuzzy Set as:

Operations on Fuzzy set

OperationFormula (Membership Function μ_A(x))
Union (A ∪ B)μA ∪ B(x) = max(μA(x), μB(x))
Intersection (A ∩ B)μA ∩ B(x) = min(μA(x), μB(x))
Complement (¬A)μ¬A(x) = 1 - μA(x)

So, the above operations can be done on the website as :

Fuzzy Set Operations

Let's us talk about the membership functions:

Membership Functions

Membership functions are the one which make the find the fuzziness of a value and define the fuzzy set. The values represented by the membership functions are between 0 and 1 (including both 0 and 1)

we can represent a fuzzy set as, the ordered pair of the element and its membership value:

A = {( x , μA(x) ) | x ∈ X }
Membership Function

Membership Function

Values of Crisp Membership vs Fuzzy Membership

Values of Crisp Membership vs Fuzzy Membership

Now, our last topic is Composition:

Composition of Fuzzy Relations

Composition refers to a mathematical operation that combines two fuzzy relations to form a new relation. It essentially captures how the relations interact with each other, enabling us to analyze multi-step relationships.

Composition of Fuzzy Relations

Composition of Fuzzy Relations

Let's understand with the help of an example:

Suppose we have to go to from Chandigarh to Delhi via Karnal and we will decide the route based upon the road quality and for that we will assign each path a fuzzy value.

Chandigarh To Delhi Via Karnal

Chandigarh To Delhi Via Karnal

Now we have different options of going from the Chandigarh as A to Delhi as C

Route from A to C

Route from A to C

And if we represent this in the form of Relational Matric we can represent it as:

BDE
A0.80.60.5

From A to Diff. Routes

BDE
C0.70.50.4

From Diff. Routes to C

Max-Min Composition

RouteFirst LinkSecond LinkMinimum
A → B → C0.80.70.7
A → D → C0.60.50.5
A → E → C0.50.40.4

Maximum value of all minimums: 0.7. Best route: A → B → C.

Max-Product Composition

RouteFirst LinkSecond LinkProduct
A → B → C0.80.70.56
A → D → C0.60.50.3
A → E → C0.50.40.2

Best route: A → B → C, with a fuzzy value of 0.56.

The composition result tells us the overall quality of the route from City A to City C, considering intermediate cities. This can help decide which route to take when there are multiple options, ensuring the smoothest journey.

The above calculations can be done using the values as well as below:

Fuzzy Matrix Composition

Matrix A Size

Matrix B Size

Thanks for reading the article. If you want to contribute you can connect me here

Design & Developed by Rahul Kumar Pahwa
© 2026. All rights reserved.