# Simplify binary expression

Specify a minterm or maxterm by number:. Enable Javascript to interact with content and submit forms on Wolfram Alpha websites.

Analyze a Boolean expression: P and not Q. Compute a truth table for a Boolean function: Visualize the logic circuit of an arbitrary Boolean expression. Compute a logic circuit for a Boolean function: Calculate various normal forms of a Boolean expression.

Convert a Boolean expression to disjunctive normal form: Convert a Boolean expression to conjunctive normal form: Inverter gates don't count as a separate level. Motivation In essence the method we are about to discuss is a pictorial way to apply the distributive law to factor out common subexpressions. Intuitively, if you can find two terms that are equivalent except that one variable is the complement of the matching variable in the other term you can factor out this variable.

The second example above shows that it works for multiple variable subsets--as long as they are powers of two. The two examples above make it look easy to remove subexpressions with Boolean algebra. For small examples it is easy. For larger expressions with 3 and more variables it because much harder. In this lecture we will study a method called Karnaugh maps you can use to quickly find the minimum standard form of a Boolean function of 4 or fewer variables. Later we will study an algorithmic method that works for functions of any number of variables.

The karnaugh, or k-map, method is fast and best carried out by a human. The algorithm we will study later is tedious for humans but is easy to program using any high-level programming language. A K-map shows the value of a function for every combination of input values just like a truth table, but a K-map spatially arranges the values so it is easy to find common terms that can be factored out. The image below shows the form of a 2,3 and 4 variable K-map. Notice how the columns are numbered on the 3 variable K-map and how both the rows and columns are numbered on the 4 variable K-map 00 01 11 This numbering guarantees that adjacent terms differ by only one term.

For example, in the 3 variable K-map above the square with a 2 in it represents the minterm A'BC' and the square with a 6 in it represents the minterm ABC'. If both of these terms appear as minterms in an expression we could factor out the A: Also notice that entries at the ends of the K-map differ by only one element with entries on the other side of the K-map. Since this is a function of 3 variables we first draw the outline for a 3-variable K-map.

Since the function is given in terms of minterms we write the minterm number inside the box that represents that minterm.

Next we put a 1 in each square where the function has the value 1. Finally, we circle groups of 1's so that all 1's are circled. We circle only groups that are powers of 2 and try to create circles as large as possible. The example above gives the general idea. What follows is a more formal description of how to proceed. The first step to understanding the formal procedure is understanding some terms.

Implicant - a single minterm or group of minterms that can be combined together on the K-map. Prime Implicant - Implicant that can not be combined with another one to remove a literal. Each product term in the minimum sum of products expression is a prime implicant.