# Fuzzy sets and fuzzy logic

In mathematics, fuzzy sets (aka uncertain sets) are somewhat like sets whose elements have degrees of membership. In classical set theory, the membership of elements in a set is assessed in binary terms according to a bivalent condition — an element either belongs or does not belong to the set. By contrast, fuzzy set theory permits the gradual assessment of the membership of elements in a set; this is described with the aid of a membership function valued in the real unit interval <0, 1>. Fuzzy sets generalize classical sets, since the indicator functions (aka characteristic functions) of classical sets are special cases of the membership functions of fuzzy sets, if the latter only take values 0 or 1. In fuzzy set theory, classical bivalent sets are usually called crisp sets. The fuzzy set theory can be used in a wide range of domains in which information is incomplete or imprecise, such as bioinformatics.

To demonstrate this problem, we will try to solve the standard tip problem in a restaurant. To give a tip we will try to limit our input and input space system into a boundaries with a maximum tip value equal to the 25% of the food cost, and since we are “good” people, we will set the lover limit to 5% tip. To evaluate our tip, we will use simple “rate” scale for a food ad service ranging from 1-10.

To solve this problem, we can simply make linear the tip value for our inputs, or in advanced for we can do interval solutions.

*Linear solution of tipping problem*

*Interval solution in linear form*

However to solve this problem in fuzzy set, we will first have to make a fuzzification of our inputs and create set of rules, and later fuzzify the output value.

And therefore, we will use the specified set of rules: for example:

- If service is bad or food is bad, then tip is small.
- If service is medium or food is bad, then tip is medium.
- If Service is good or food is good, then tip is high.

*Fuzzy solution*