$$\newcommand{\id}{\mathrm{id}}$$ $$\newcommand{\Span}{\mathrm{span}}$$ $$\newcommand{\kernel}{\mathrm{null}\,}$$ $$\newcommand{\range}{\mathrm{range}\,}$$ $$\newcommand{\RealPart}{\mathrm{Re}}$$ $$\newcommand{\ImaginaryPart}{\mathrm{Im}}$$ $$\newcommand{\Argument}{\mathrm{Arg}}$$ $$\newcommand{\norm}{\| #1 \|}$$ $$\newcommand{\inner}{\langle #1, #2 \rangle}$$ $$\newcommand{\Span}{\mathrm{span}}$$

# 13.6: Boolean Expressions

$$\newcommand{\vecs}{\overset { \rightharpoonup} {\mathbf{#1}} }$$ $$\newcommand{\vecd}{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}}$$$$\newcommand{\id}{\mathrm{id}}$$ $$\newcommand{\Span}{\mathrm{span}}$$ $$\newcommand{\kernel}{\mathrm{null}\,}$$ $$\newcommand{\range}{\mathrm{range}\,}$$ $$\newcommand{\RealPart}{\mathrm{Re}}$$ $$\newcommand{\ImaginaryPart}{\mathrm{Im}}$$ $$\newcommand{\Argument}{\mathrm{Arg}}$$ $$\newcommand{\norm}{\| #1 \|}$$ $$\newcommand{\inner}{\langle #1, #2 \rangle}$$ $$\newcommand{\Span}{\mathrm{span}}$$ $$\newcommand{\id}{\mathrm{id}}$$ $$\newcommand{\Span}{\mathrm{span}}$$ $$\newcommand{\kernel}{\mathrm{null}\,}$$ $$\newcommand{\range}{\mathrm{range}\,}$$ $$\newcommand{\RealPart}{\mathrm{Re}}$$ $$\newcommand{\ImaginaryPart}{\mathrm{Im}}$$ $$\newcommand{\Argument}{\mathrm{Arg}}$$ $$\newcommand{\norm}{\| #1 \|}$$ $$\newcommand{\inner}{\langle #1, #2 \rangle}$$ $$\newcommand{\Span}{\mathrm{span}}$$

In this section, we will use our background from the previous sections and set theory to develop a procedure for simplifying Boolean expressions. This procedure has considerable application to the simplification of circuits in switching theory or logical design.

Definition $$\PageIndex{1}$$: Boolean Expression

Let $$[B; \lor , \land, - ]$$ be any Boolean algebra, and let $$x_1, x_2, \ldots , x_k$$ be variables in $$B\text{;}$$ that is, variables that can assume values from $$B\text{.}$$ A Boolean expression generated by $$x_1, x_2, \ldots , x_k$$ is any valid combination of the $$x_i$$ and the elements of $$B$$ with the operations of meet, join, and complementation.

This definition is the analog of the definition of a proposition generated by a set of propositions, presented in Section 3.2.

Each Boolean expression generated by $$k$$ variables, $$e\left(x_1, \ldots , x_k\right)\text{,}$$ defines a function $$f: B^k \to B$$ where $$f\left(a_1,\ldots , a_k\right)=e\left(a_1, \ldots , a_k\right)\text{.}$$ If $$B$$ is a finite Boolean algebra, then there are a finite number of functions from $$B^k$$ into $$B\text{.}$$ Those functions that are defined in terms of Boolean expressions are called Boolean functions. As we will see, there is an infinite number of Boolean expressions that define each Boolean function. Naturally, the “shortest” of these expressions will be preferred. Since electronic circuits can be described as Boolean functions with $$B=B_2\text{,}$$ this economization is quite useful.

In what follows, we make use of Exercise 7.1.5 in Section 7.1 for counting number of functions.

Example $$\PageIndex{1}$$: Two Variables Over $$B_{2}$$

Consider any Boolean algebra of order 2, $$[B; \lor, \land, - ]\text{.}$$ How many functions $$f:B^2\to B$$ are there? First, all Boolean algebras of order 2 are isomorphic to $$\left[B_2; \lor , \land, - \right]$$ so we want to determine the number of functions $$f:B_2^2\to B_2\text{.}$$ If we consider a Boolean function of two variables, $$x_1$$ and $$x_2\text{,}$$ we note that each variable has two possible values 0 and 1, so there are $$2^2$$ ways of assigning these two values to the $$k=2$$ variables. Hence, the table below has $$2^2=4$$ rows. So far we have a table such as this one:

\begin{equation*} \begin{array}{cc|c} x_1 & x_2 & f\left(x_1,x_2\right) \\ \hline 0 & 0 & ?\\ 0 & 1 & ?\\ 1 & 0 & ?\\ 1 & 1 & ?\\ \end{array} \end{equation*}

How many possible different functions can there be? To list a few:$$f_1\left(x_1, x_2\right)=x_1\text{,}$$ $$f_2\left(x_1, x_2\right)=x_2\text{,}$$ $$f_3\left(x_1, x_2\right)=x_1\lor x_2\text{,}$$ $$f_4\left(x_1, x_2\right)=\left(x_1\land \overline{x_2}\right)\lor x_2\text{,}$$ $$f_5\left(x_1, x_2\right)= x_1\land x_2\lor \overline{x_2}\text{,}$$ etc. Each of these will fill in the question marks in the table above. The tables for $$f_1\textrm{ }$$ and $$f_3$$ are

\begin{equation*} \begin{array}{lr} \begin{array}{cc|c} x_1 & x_2 & f_1\left(x_1,x_2\right) \\ \hline 0 & 0 & 0\\ 0 & 1 & 0\\ 1 & 0 & 1\\ 1 & 1 & 1\\ \end{array} & \begin{array}{cc|c} x_1 & x_2 & f_3\left(x_1,x_2\right) \\ \hline 0 & 0 & 0\\ 0 & 1 & 1\\ 1 & 0 & 1\\ 1 & 1 & 1\\ \end{array}\\ \end{array} \end{equation*}

Two functions are different if and only if their tables are different for at least one row. Of course by using the basic laws of Boolean algebra we can see that $$f_3=f_4\text{.}$$ Why? So if we simply list by brute force all “combinations” of $$x_1 \textrm{ and } x_2$$ we will obtain unnecessary duplication. However, we note that for any combination of the variables $$x_1\text{,}$$ and $$x_2$$ there are only two possible values for $$f\left(x_1, x_2\right)\text{,}$$ namely 0 or 1. Thus, we could write $$2^4=16$$ different functions on 2 variables.

Now, let's count the number of different Boolean functions in a more general setting. We will consider two cases: first, when $$B=B_2$$, and second, when $$B$$ is any finite Boolean algebra with $$2^n$$ elements.

Let $$B=B_2\text{.}$$ Each function $$f:B^k\to B$$ is defined in terms of a table having $$2^k$$ rows. Therefore, since there are two possible images for each element of $$B^k\text{,}$$ there are 2 raised to the $$2^k\text{,}$$ or $$2^{2^k}$$ different functions. We will show that every one of these functions is a Boolean function.

Now suppose that $$\lvert B\rvert =2^n>2\text{.}$$ A function from $$B^k$$ into $$B$$ can still be defined in terms of a table. There are $$\lvert B\rvert^k$$ rows to each table and $$\lvert B\rvert$$ possible images for each row. Therefore, there are $$2^n$$ raised to the power $$2^{nk}$$ different functions. We will show that if $$n>1\text{,}$$ not every one of these functions is a Boolean function.

Since all Boolean algebras are isomorphic to a Boolean algebra of sets, the analogues of statements in sets are useful in Boolean algebras.

Definition $$\PageIndex{2}$$: Minterm

A Boolean expression generated by $$x_1, x_2, \ldots , x_k$$ that has the form

\begin{equation*} \underset{i=1}{\overset{k}{\land }}y_i, \end{equation*}

where each $$y_i$$ may be either $$x_i$$ or $$\overline{x_i}$$ is called a minterm generated by $$x_1, x_2, \ldots , x_k\text{.}$$ We use the notation $$M_{\delta_1 \delta_2 \cdots \delta_k}$$ for the minterm generated by $$x_1, x_2, \ldots , x_k\text{,}$$ where $$y_i=x_i$$ if $$\delta_i = 1$$ and $$y_i=\bar{x_i}$$ if $$\delta_i = 0$$

An example of the notation is that $$M_{110} = x_1 \land x_2 \land \bar{x_3}\text{.}$$

By a direct application of the Rule of Products we see that there are $$2^k$$ different minterms generated by $$x_1, \ldots , x_k\text{.}$$

Definition $$\PageIndex{3}$$: Minterm Normal Form

A Boolean expression generated by $$x_1, \ldots , x_k$$ is in minterm normal form if it is the join of expressions of the form $$a \land m\text{,}$$ where $$a\in B$$ and $$m$$ is a minterm generated by $$x_1, \ldots , x_k\text{.}$$ That is, it is of the form

$\label{eq:1} \underset{j=1}{\overset{p}{\lor }}\left(a_j\land m_j\right)$

where $$p=2^k\text{,}$$ and $$m_1,m_2, \ldots , m_p$$ are the minterms generated by $$x_1, \ldots, x_k\text{.}$$

Note $$\PageIndex{1}$$

• We seem to require every minterm generated by $$x_1, \ldots, x_k\text{,}$$ in $$\eqref{eq:1}$$, and we really do. However, some of the values of $$a_j$$ can be $$\pmb{0}\text{,}$$ which effectively makes the corresponding minterm disappear.
• If $$B=B_2\text{,}$$ then each $$a_j$$ in a minterm normal form is either 0 or 1. Therefore, $$a_j\land m_j$$ is either 0 or $$m_j\text{.}$$

Theorem $$\PageIndex{1}$$: Uniqueness of Minterm Normal Form

Let $$e\left(x_1,\ldots , x_k\right)$$ be a Boolean expression over B. There exists a unique minterm normal form $$M\left(x_1, \ldots , x_k\right)$$ that is equivalent to $$e\left(x_1, \ldots , x_k\right)$$ in the sense that e and M define the same function from $$B^k$$ into $$B\text{.}$$

The uniqueness in this theorem does not include the possible ordering of the minterms in $$M$$ (commonly referred to as “uniqueness up to the order of minterms”). The proof of this theorem would be quite lengthy, and not very instructive, so we will leave it to the interested reader to attempt. The implications of the theorem are very interesting, however.

If $$\lvert B\rvert =2^n\text{,}$$ then there are $$2^n$$ raised to the $$2^k$$ different minterm normal forms. Since each different minterm normal form defines a different function, there are a like number of Boolean functions from $$B^k$$ into $$B\text{.}$$ If $$B=B_2\text{,}$$ there are as many Boolean functions (2 raised to the $$2^k$$) as there are functions from $$B^k$$ into $$B\text{,}$$ since there are $$2$$ raised to the $$2^{n}$$ functions from $$B^k$$ into $$B\text{.}$$ The significance of this result is that any desired function can be realized using electronic circuits having 0 or 1 (off or on, positive or negative) values.

More complex, multivalued circuits corresponding to boolean algebras with more than two values would not have this flexibility because of the number of minterm normal forms, and hence the number of boolean functions, is strictly less than the number of functions.

We will close this section by examining minterm normal forms for expressions over $$B_2$$ , since they are a starting point for circuit economization.

Example $$\PageIndex{2}$$

Consider the Boolean expression $$f\left(x_1, x_2\right) =x_1 \lor \overline{x_2} \text{.}$$ One method of determining the minterm normal form of $$f$$ is to think in terms of sets. Consider the diagram with the usual translation of notation in Figure $$\PageIndex{1}$$. Then

\begin{equation*} \begin{split} f\left(x_1, x_2\right)&=\left(\overline{x_1}\land \overline{x_2}\right)\lor \left(x_1\land \overline{x_2}\right)\lor \left(x_1\land x_2\right)\\ & = M_{00} \lor M_{10} \lor M_{11} \end{split} \end{equation*} Figure $$\PageIndex{1}$$: Visualization of minterms for $$x_1\lor\bar{x_2}$$

Table $$\PageIndex{1}$$: Definition of the boolean function $$g$$

$$x_1$$ $$x_2$$ $$x_3$$ $$g(x_1,x_2,x_3)$$
$$0$$ $$0$$ $$0$$ $$1$$
$$0$$ $$0$$ $$1$$ $$0$$
$$0$$ $$1$$ $$0$$ $$0$$
$$0$$ $$1$$ $$1$$ $$1$$
$$1$$ $$0$$ $$0$$ $$0$$
$$1$$ $$0$$ $$1$$ $$0$$
$$1$$ $$1$$ $$0$$ $$1$$
$$1$$ $$1$$ $$1$$ $$0$$

Example $$\PageIndex{3}$$

Consider the function $$g:B_2^3 \to B_2$$ defined by Table $$\PageIndex{1}$$.

The minterm normal form for $$g$$ can be obtained by taking the join of minterms that correspond to rows that have an image value of 1. If $$g\left(a_1, a_2, a_3\right)=1\text{,}$$ then include the minterm $$y_1\land y_2\land y_3$$ where

\begin{equation*} y_j=\begin{cases} x_j & \textrm{ if } a_j=1 \\ \bar{x_j} & \textrm{ if } a_j=0\\ \end{cases} \end{equation*}

Or, to use alternate notation, include $$M_{a_1a_2a_3}$$ in the expression if and only if $$g\left(a_1, a_2, a_3\right)=1$$

Therefore,

\begin{equation*} g\left(x_1, x_2, x_3\right)=\left(\overline{x_1}\land \overline{x_2}\land \overline{x_3}\right)\lor \left(\overline{x_1}\land x_2\land x_3\right)\lor \left(x_1\land x_2\land \overline{x_3}\right). \end{equation*}

The minterm normal form is a first step in obtaining an economical way of expressing a given Boolean function. For functions of more than three variables, the above set theory approach tends to be awkward. Other procedures are used to write the normal form. The most convenient is the Karnaugh map, a discussion of which can be found in any logical design/switching theory text (see, for example, ), on Wikipedia.

## Exercises

Exercise $$\PageIndex{1}$$

1. Write the 16 possible functions of Example $$\PageIndex{1}$$.
2. Write out the tables of several of the above Boolean functions to show that they are indeed different.
3. Determine the minterm normal forms of
1. $$\displaystyle g_1\left(x_1, x_2\right)=x_1\lor x_2,$$
2. $$\displaystyle g_2\left(x_1, x_2\right)=\overline{x_1}\lor \overline{x_2}$$
3. $$\displaystyle g_3\left(x_1, x_2\right)=\overline{x_1 \land x_2}$$
4. $$\displaystyle g_4\left(x_1, x_2\right)=1$$
1. $$\displaystyle \begin{array}{l} f_1\left(x_1,x_2\right)=0 \\ f_2\left(x_1,x_2\right)=\left(\overline{x_1}\land \overline{x_2}\right) \\ f_3\left(x_1,x_2\right)=\left(\overline{x_1}\land x_2\right) \\ f_4\left(x_1,x_2\right)=\left(x_1\land \overline{x_2}\right) \\ f_5\left(x_1,x_2\right)=\left(x_1\land x_2\right) \\ f_6\left(x_1,x_2\right)=\left(\left(\overline{x_1}\land \overline{x_2}\right)\lor \left(\overline{x_1}\land x_2\right)\right)=\overline{x_1} \\ f_7\left(x_1,x_2\right)=\left(\left(\overline{x_1}\land \overline{x_2}\right)\lor \left(x_1\land \overline{x_2}\right)\right)=\overline{x_2} \\ f_8\left(x_1,x_2\right)=\left(\left(\overline{x_1}\land \overline{x_2}\right)\lor \left(x_1\land x_2\right)\right)=\left(\left(x_1\land x_2\right)\lor \left(\overline{x_1}\land \overline{x_2}\right)\right) \\ f_9\left(x_1,x_2\right)=\left(\left(\overline{x_1}\land x_2\right)\lor \left(x_1\land \overline{x_2}\right)\right)=\left(\left(x_1\land \overline{x_2}\right)\lor \left(\overline{x_1}\land x_2\right)\right) \\ f_{10}\left(x_1,x_2\right)=\left(\left(\overline{x_1}\land x_2\right)\lor \left(x_1\land x_2\right)\right)=x_2 \\ f_{11}\left(x_1,x_2\right)=\left(\left(x_1\land \overline{x_2}\right)\lor \left(x_1\land x_2\right)\right)=x_1 \\ f_{12}\left(x_1,x_2\right)=\left(\left(\overline{x_1}\land \overline{x_2}\right)\lor \left(\overline{x_1}\land x_2\right)\lor \left(x_1\land \overline{x_2}\right)\right)=\left(\overline{x_1}\lor \overline{x_2}\right) \\ f_{13}\left(x_1,x_2\right)=\left(\left(\overline{x_1}\land \overline{x_2}\right)\lor \left(\overline{x_1}\land x_2\right)\lor \left(x_1\land x_2\right)\right)=\left(\overline{x_1}\lor x_2\right) \\ f_{14}\left(x_1,x_2\right)=\left(\left(\overline{x_1}\land \overline{x_2}\right)\lor \left(x_1\land \overline{x_2}\right)\lor \left(x_1\land x_2\right)\right)=\left(x_1\lor \overline{x_2}\right) \\ f_{15}\left(x_1,x_2\right)=\left(\left(\overline{x_1}\land x_2\right)\lor \left(x_1\land \overline{x_2}\right)\lor \left(x_1\land x_2\right)\right)=\left(x_1\lor x_2\right) \\ f_{16}\left(x_1,x_2\right)=\left(\left(\overline{x_1}\land \overline{x_2}\right)\lor \left(\overline{x_1}\land x_2\right)\lor \left(x_1\land \overline{x_2}\right)\lor \left(x_1\land x_2\right)\right)=1 \\ \end{array}$$
2. The truth table for the functions in part (a) are
\begin{equation*} \begin{array}{llllllllll} x_1 & x_2 & f_1 & f_2 & f_3 & f_4 & f_5 & f_6 & f_7 & f_8\\ 0 & 0 & 0 & 1 & 0 & 0 & 0 & 1 & 1 & 1 \\ 0 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 0 & 0\\ 1 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 1 & 0 \\ 1 & 1 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 1 \\ \end{array} \end{equation*}
\begin{equation*} \begin{array}{llllllllll} x_1 & x_2 & f_9 & f_{10} & f_{11} & f_{12} & f_{13} & f_{14} & f_{15} & f_{16} \\ 0 & 0 & 0 & 0 & 0 & 1 & 1 & 1 & 0 & 1 \\ 0 & 1 & 1 & 1 & 0 & 1 & 1 & 0 & 1 & 1 \\ 1 & 0 & 1 & 0 & 1 & 1 & 0 & 1 & 1 & 1 \\ 1 & 1 & 0 & 1 & 1 & 0 & 1 & 1 & 1 & 1 \\ \end{array} \end{equation*}
3.
1. $$\displaystyle g_1\left(x_1,x_2\right)=f_{15}\left(x_1,x_2\right)$$
2. $$\displaystyle g_2\left(x_1,x_2\right)=f_{12}\left(x_1,x_2\right)$$
3. $$\displaystyle g_3\left(x_1,x_2\right)=f_{12}\left(x_1,x_2\right)$$
4. $$\displaystyle g_4\left(x_1,x_2\right)=f_{16}\left(x_1,x_2\right)$$

Exercise $$\PageIndex{2}$$

Consider the Boolean expression $$f\left(x_1, x_2, x_3\right)=\left(\overline{x_3}\land x_2\right)\lor\left(\overline{x_1}\land x_3\right)\lor \left(x_2\land x_3\right)$$ on $$\left[B_2^3; \lor, \land, - \right].$$

1. Simplify this expression using basic Boolean algebra laws.
2. Write this expression in minterm normal form.
3. Write out the table for the given function defined by $$f$$ and compare it to the tables of the functions in parts a and b.
4. How many possible different functions in three variables on $$\left[B_2; \lor, \land, - \right]$$ are there?

Exercise $$\PageIndex{3}$$

Let $$[B; \lor , \land, - ]$$ be a Boolean algebra of order 4, and let $$f$$ be a Boolean function of two variables on $$B\text{.}$$

1. How many elements are there in the domain of f?
2. How many different Boolean functions are there of two, variables? Three variables?
3. Determine the minterm normal form of $$f\left(x_1, x_2\right)=x_1\lor x_2\text{.}$$
4. If $$B=\{0, a, b, 1\}\text{,}$$ define a function from $$B^2$$ into $$B$$ that is not a Boolean function.
1. The number of elements in the domain of $$f$$ is $$16=4^{2}=|B|^{2}$$
2. With two variables, there are $$4^{3}=256$$ different Boolean functions. With three variables, there are $$4^{8}=65536$$ different Boolean functions.
3. $$f(x_{1},\:x_{2})=(1∧\overline{x_1}∧\overline{x_2})∨(1∧\overline{x_1}∧\overline{x_2})∨(1∧x1∧\overline{x_2})∨(0∧x1∧x2)$$
4. Consider $$f:B^{2}→B$$, defined by $$f(0,0)=0$$, $$f(0,1)=1$$, $$f(1,0)=a$$, $$f(1,1)=a$$, and $$f(0,a)=b$$, with the images of all other pairs in $$B^{2}$$ defined arbitrarily. This function is not a Boolean function. If we assume that it is Boolean function then $$f$$ can be computed with a Boolean expression $$M(x_1,x_2)$$. This expression can be put into minterm normal form:
$M(x_1,x_2)=(c_1∧\overline{x_1}∧\overline{x_2})∨(c_2∧\overline{x_1}∧x_2)∨(c_3∧x_1∧\overline{x_2})∨(c_4∧x_1∧x_2)\nonumber$
\begin{aligned}f(0,0)&=0⇒M(0,0)=0⇒c_1=0 \\ f(0,1)&=1⇒M(0,0)=1⇒c_2=1 \\ f(1,0)&=a⇒M(0,0)=a⇒c_3=a \\ f(1,1)&=a⇒M(0,0)=a⇒c_4=a\end{aligned}
Therefore, $$M(x_1,x_2)=(\overline{x_1}∧x_2)∨(a∧x_1∧\overline{x_2})∨(a∧x_1∧x_2)$$ and so, using this formula, $$M(0,a)=(\overline{0}∧a)∨(a∧0∧\overline{a})∨(a∧0∧a)=a$$ This contradicts $$f(0,a)=b$$, and so $$f$$ is not a Boolean function.