Menu
Log in

Computer Engineering Concepts

3.3 Truth tables

Once a mathematical or language proposition is represented using symbols (e.g., p+q) then we can determine the truth value for the expression under different conditions. These truth values are usually represented in a tabular form called a truth table. Truth tables are useful for analyzing complex propositions, as they quickly show the truth value of the complex proposition under different logical conditions. Truth tables are also useful in simplifying complex logical expressions to simpler forms that produce the same result.

In the following example, the NOT operator is applied to the results of the AND operator to obtain the truth table for the NAND operator.

Example I:        Find the truth table of the NAND operator (NOT (AND))

Solution:

p

q

(p)AND(q)

NOT[(p)AND(q)]

1

1

1

0

0

1

0

1

1

0

0

1

0

0

0

1

An English sentence that uses the NAND operator would be: “A student cannot take chemistry and physics during the same period.”

Take Chemistry

Take Physics

Cannot take chemistry and physics

True

True

False

False

True

True

True

False

True

False

False

True


The XOR operator is defined as a logical operator that connects two propositions together, and is false when both statements are true and when both statements are false. This definition of the XOR operator can be expressed in a truth table as follows.

      Table 3.5 The XOR logical operation.

An example of a sentence construction that has the same truth pattern of the XOR operator would be; “you can have the pencil or the pen but not both”

Truth tables are very useful tools for determining logical relationships within statements. In the following example, truth tables are used to show logical equivalence of two different logical constructions. In this example it should also be noted that it is possible to have different logical construction for a given pattern.

Example II:       Using truth tables show that (p) NAND (q) is the same as (NOT(p))OR(Not(q))

Solution:

p

q

(p)AND(q)

(p)NAND(q)

1

1

1

0

0

1

0

1

1

0

0

1

0

0

0

1

p

q

NOT(p)

NOT(q)

[NOT(p)]OR[NOT(q)]

1

1

0

0

0

0

1

1

0

1

1

0

0

1

1

0

0

1

1

1

By comparing the two truth tables it can be seen that both logical constructions produce the same end result.


By comparing the two truth tables it can be seen that both logical constructions produce the same end result.


Multiple Propositions

In the previous section the logic operators acted on one or two propositions. The idea of operators acting on propositions can be expanded to handle more than two propositions. For example, consider a case of a security system that produces a green light when the door is closed, the window is closed, and when the correct password is entered. In this case there are three propositions.

p: The door is closed

q: The window is closed

r: The password is entered

From the nature of the example it is seen that the green light is on only when all three propositions are true. Since each proposition can be either true (T) or false (F), there are 8 possible outcomes to consider. The number of possible outcomes to consider is directly related to the number of propositions, and this relationship can be written mathematically as 2number of propositions. In the case of a single proposition, the number or possible outcome is 2, and in the case of two propositions the number of possible outcomes is 4, as seen earlier. Similarly when there are 3 propositions, as in this case, there are 23 possible outcomes. The situation outlined in the example could be written in symbolic form as a composite proposition using logical operators, [(p AND q) AND r]. The green light will turn on only if all three propositions are true. From the truth table it is evident that the use of the AND operators in this manner will produce the desired result.

Table 3.6 A triple proposition truth table.

The idea of logical operators could be extended to act on any number of propositions. The number of propositions in a logical statement does not change the process used to analyze it. It just makes it longer because an increase in the number of propositions will increase the number of possible outcomes that need to be considered.


3.3 Practice Questions 

1.     Create truth tables for the following complex propositions.

        a. [pANDq]ORq        b. [pORq]ANDq   c. [NOTq]AND

        d. pp’                          e. (p+q)­q’               f. (pq)+(p+q)

2.     Using truth tables show that the following logical relationships are equivalent.

        a. (pq)’ = (p’+q’)                            b. (p+q)’ =p’ q’

        c. p q = (p’q)+(pq’)                  d. pq =p(p’+ q)          

3.     What are the advantages of using a truth table?

4.     Create a logical expression that is equivalent to each of the following logical expressions.

        a. (p’+q)’                 b. p’ + q’             c. p q’           d. pq’   

5.     Create truth tables for the following three variable complex propositions.

        a. (pq)+r                                       b. (p+r)q

        c. q’(p+q)                                     d. (pr)p’

        e. (p+r)(r+q)                                f. (p+r)(rp)

6.     Create a logic expression that is equivalent to the following expressions.

        a. (pq)+q                                       b. (p q)r

        c. (rq) p                                    d. pr’




GlobalEduTech Solutions

Powered by Wild Apricot Membership Software