truth table
What is a truth table?
A truth table is a breakdown of all the possible truth values returned by a logical expression. A truth value is typically either true or false, or 1 or 0. In some cases, the value might be based on another binary system, such as on and off or open and closed, but these are not as common. Truth tables are used in Boolean algebra and in other areas of mathematics and science that rely on Boolean logic to show the possible outcomes of an expression or operation in terms of its truth or falseness.
A logical expression includes one or more Boolean functions that determine the logic used in calculating the expression's truth or falseness. The most common Boolean functions are AND, OR and NOT, which are described in the table.
Function

Type  Logic  Symbols used to represent the function in calculations 
AND 
Logical conjunction 
Evaluates to true if both statements are true 
· Ascending wedge (∧) · Asterisk (*) · Dot (⋅) 
OR 
Logical inclusive disjunction 
Evaluates to true if one or both statements are true 
· Descending wedge (∨) · Plus sign (+) · Vertical bar () 
NOT 
Logical negation 
Evaluates to true when the statement is false, and evaluates to false when the statement is true 
· Dash with tail preceding statement (¬x) · Tilde preceding statement (~x) · Exclamation mark preceding statement (!x) · Single quote following statement (x') · Overline above statement (x̅) 
Boolean functions can be used in any combination to define an expression's intended logic. The functions follow their own rules of precedence. The NOT function takes precedence over the other functions, which means it is evaluated first. The AND function takes precedence over the OR function. Parentheses can be used to override the rules of precedence to better control the expression's logic. As calculations within the parentheses are evaluated first.
In addition to Boolean functions, a logical expression includes variables that represent possible truth values. The functions are applied directly to the variables to define the expression's logic. For example, given the variables A and B, you can deduce the following logic:
 A ∧ B = false, except when A = true and B = true
 A ∧ B = true if A = true and B = true
 A ∨ B = true, except when A = false and B = false
 A ∨ B = false if A = false and B = false
 If A = false, then ¬A = true
 If A = true, then ¬A = false
A truth table provides a method for mapping out the possible truth values in an expression and to determine their outcomes. The table includes a column for each variable in the expression and a row for each possible combination of truth values. It also includes a column that shows the outcome of each set of values.
Consider the expression A ∧ B. The expression uses the AND Boolean function to connect the variables A and B. The possible outcomes from this expression can be mapped out in a truth table. The truth table would include a column for each variable, a column for the outcome, and a row for each possible value combination. In the following truth table, the letter T represents true (or 1) and the letter F represents false (or 0). See truth table 1:
A 
B 
A ∧ B 
T 
T 
T 
T 
F 
F 
F 
T 
F 
F 
F 
F 
The expression has four possible truth value combinations. The first row of values (after the heading) shows a value of true for each variable. The final column (highlighted in blue) also shows a true value. This means that the expression returns true when both variables are true. However, the subsequent rows indicate that the expression returns false for all other value combinations. In other words, if only one variable is true or neither of them is true, the expression evaluates to false. This is because the expression includes the AND operator, which states that both statements must be true for the expression to evaluate to true.
Not surprisingly, changing the expression's Boolean function affects the results. For example, the expression A ∨ B uses the OR function to connect the two variables. Although there are still only four possible value combinations, the results are much different, as shown in the following truth table. Now the expression evaluates to false only if both A and B are false. See truth table 2:
A 
B 
A ∨ B 
T 
T 
T 
T 
F 
T 
F 
T 
T 
F 
F 
F 
You can also use truth tables when working with the NOT operator. For example, the expression ¬A specifies the logical negation of A. Because there is only one variable, the truth table requires only one column for that variable, along with the outcome column. See truth table 3:
A 
¬A 
T 
F 
F 
T 
The table requires only two value rows because there are only two possible values: true and false. Because the NOT operator is used, the expression returns false if A is true and returns true if A is false.
Truth tables can also be used for expressions that include Boolean functions other than OR, AND or NOT. For example, an expression might contain a function such as the conditional (→), biconditional (↔) or XOR exclusive disjunction (⊻ or ⊕). In addition, truth tables are often used to map out possible combinations of logic gate input and their expected output. Logic gates carry out logical operations in electronic circuits by processing binary input and producing a single output.
Working with compound logical expressions
A truth table can be especially useful when working with more complex expressions that include multiple variables and Boolean functions. Consider the expression ¬(A ∨ B) ∧ (¬C ∨ D). It includes the variables A, B, C and D, as well as the functions AND, OR and NOT. To create a truth table for this expression, you should first create a column for each variable, a column for the final output and a row for each possible value combination (along with the header row). See truth table 4:
A 
B 
C 
D 
¬(A ∨ B) ∧ (¬C ∨ D) 
















































































You can calculate the number of value rows needed by using the formula 2^{n}, where n is the number of variables in the expression. In this case, there are four variables so there are 16 value rows (2^{4} = 16). After you create your initial shell, you can then fill in the possible value combinations for each row, based on the four variables. See truth table 5:
A 
B 
C 
D 
¬(A ∨ B) ∧ (¬C ∨ D) 
T 
T 
T 
T 

T 
T 
T 
F 

T 
T 
F 
T 

T 
T 
F 
F 

T 
F 
T 
T 

T 
F 
T 
F 

T 
F 
F 
T 

T 
F 
F 
F 

F 
T 
T 
T 

F 
T 
T 
F 

F 
T 
F 
T 

F 
T 
F 
F 

F 
F 
T 
T 

F 
F 
T 
F 

F 
F 
F 
T 

F 
F 
F 
F 

See truth table 6:
A 
B 
C 
D 
¬(A ∨ B) ∧ (¬C ∨ D) 
T 
T 
T 
T 
F 
T 
T 
T 
F 
F 
T 
T 
F 
T 
F 
T 
T 
F 
F 
F 
T 
F 
T 
T 
F 
T 
F 
T 
F 
F 
T 
F 
F 
T 
F 
T 
F 
F 
F 
F 
F 
T 
T 
T 
F 
F 
T 
T 
F 
F 
F 
T 
F 
T 
F 
F 
T 
F 
F 
F 
F 
F 
T 
T 
T 
F 
F 
T 
F 
F 
F 
F 
F 
T 
T 
F 
F 
F 
F 
T 
From the truth table results, you can see that the expression returns a value of true only under three conditions:
 A = false, B = false, C = true, D = true
 A = false, B = false, C = false, D = true
 A = false, B = false, C = false, D = false
Creating the initial truth table shell is typically a straightforward process. Most of the real work comes when calculating the expression for each value row. For this reason, it can sometimes be useful to extend the truth table to include a breakdown of the expression's individual calculations, such as those included in parentheses or negated with a NOT function. For example, the following truth table adds four columns to the table, one for each of the expression's individual calculations. See truth table 7:
A 
B 
C 
D 
A ∨ B 
¬(A ∨ B) 
¬C 
(¬C ∨ D) 
¬(A ∨ B) ∧ (¬C ∨ D) 
T 
T 
T 
T 
T 
F 
F 
T 
F 
T 
T 
T 
F 
T 
F 
F 
F 
F 
T 
T 
F 
T 
T 
F 
T 
T 
F 
T 
T 
F 
F 
T 
F 
T 
T 
F 
T 
F 
T 
T 
T 
F 
F 
T 
F 
T 
F 
T 
F 
T 
F 
F 
F 
F 
T 
F 
F 
T 
T 
F 
T 
T 
F 
T 
F 
F 
F 
T 
F 
T 
T 
F 
F 
T 
T 
T 
T 
F 
F 
T 
F 
F 
T 
T 
F 
T 
F 
F 
F 
F 
F 
T 
F 
T 
T 
F 
T 
T 
F 
F 
T 
F 
F 
T 
F 
T 
T 
F 
F 
F 
T 
T 
F 
T 
F 
T 
T 
F 
F 
T 
F 
F 
T 
F 
F 
F 
F 
F 
F 
T 
F 
T 
T 
T 
T 
F 
F 
F 
F 
F 
T 
T 
T 
T 
The new columns are outlined in a heavier border. Each of these columns shows the output for that calculation, based on the possible value combinations. For example, the A ∨ B column for the first row shows a value of true when both A and B are true, but the ¬(A ∨ B) column (the first column highlighted in yellow) shows a value of false because the calculation adds the NOT function.
The calculation represented by ¬C column also uses the NOT function, so the value of the C variable is negated. (True evaluates to false, and false evaluates to true.) This output is used in the calculation represented by the (¬C ∨ D) column (the second column highlighted in yellow).
The two columns highlighted in yellow represent the two main parenthetical calculations in the outer expression. You can use these columns to calculate your final expression. You do not have to highlight the columns in this way, but such an approach can make it easier to calculate the value of the final expression. Because the expression connects these two calculations with an AND function, both columns must show a value of true for the expression as a whole to evaluate to true.
See also: logical negation symbol, logical implication, Karnaugh map, binarycoded decimal, absolute truth and table in computer programming.