As an example of minimization, the majority function will be minimized ``by hand'', before covering a more formal method, Karnaugh maps. The majority function takes in three or more inputs and returns the value which is most common among them. For three boolean inputs, it returns which ever value (true or false) which occurs at least twice. The majority function will later be used to generate the carry bit in addition circuits.
| Majority | |||
| T | T | T | T |
| T | T | F | T |
| T | F | T | T |
| T | F | F | F |
| F | T | T | T |
| F | T | F | F |
| F | F | T | F |
| F | F | F | F |
The DNF formula generated from this truth is
One might note that some pairs of the sub-terms are identical except for whether some variable is negated or not. An interpretation of this is that given the rest of the assignment from that pair, this variable does not matter. We can use the following identities to minimize the majority function.
All of these identities may be derived from the laws of boolean algebra above. Together with the associativity and commutativity laws, one can prove that the majority function is
Intuitively this makes sense - once two variables are set to true, the majority function will output true regardless of the third variables value.