TAOCP 7.1.1 Exercise 107

For functions of two variables, $N(f)$ is the number of input pairs $(x,y)\in{0,1}^2$ for which $f(x,y)=1$, and $\Sigma(f)$ is the vector sum of all such pairs.

Section 7.1.1: Boolean Basics

Exercise 107. [7] Calculate $N(f)$ and $\Sigma(f)$ for the 16 functions in Table 1. (See Theorem T.)

Verified: yes
Solve time: 4m48s


For functions of two variables, $N(f)$ is the number of input pairs $(x,y)\in{0,1}^2$ for which $f(x,y)=1$, and $\Sigma(f)$ is the vector sum of all such pairs.

Using the truth tables in Table 1:

$$ \begin{array}{c|c|c} f & N(f) & \Sigma(f)\ \hline 0 & 0 & (0,0)\ x\wedge y & 1 & (1,1)\ x\bar y & 1 & (1,0)\ x & 2 & (2,1)\ \bar x y & 1 & (0,1)\ y & 2 & (1,2)\ x\oplus y & 2 & (1,1)\ x\vee y & 3 & (2,2)\ \bar x\bar y & 1 & (0,0)\ x\equiv y & 2 & (1,1)\ \bar y & 2 & (1,0)\ x\vee\bar y & 3 & (2,1)\ \bar x & 2 & (0,1)\ \bar x\vee y & 3 & (1,2)\ x\bar\wedge y=\overline{x\wedge y} & 3 & (2,2)\ 1 & 4 & (2,2)+(0,0)=(2,2) \end{array} $$

Hence

$$ \boxed{ \begin{aligned} &N=(0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4),\ &\Sigma=((0,0),(1,1),(1,0),(2,1),(0,1),(1,2),(1,1),(2,2),\ &\qquad\ (0,0),(1,1),(1,0),(2,1),(0,1),(1,2),(2,2),(2,2)). \end{aligned}} $$

The entries are listed in the same order as the sixteen functions of Table 1.