Logic & Sets

Truth Tables for the Five Logical Connectives

A truth table lists every possible combination of true (T) and false (F) for the simple statements in a compound statement, then shows the compound statement’s value in each row. With nn simple statements the table has 2n2^n rows.

rows=2n\text{rows} = 2^{n}

Try it with your numbers

Show every step

Five connectives do almost all the work: NOT (¬\lnot), AND (∧\land), OR (∨\lor), IF THEN (→\to) and IF AND ONLY IF (↔\leftrightarrow). Four of them match everyday speech closely. One, the conditional, has a row that surprises nearly everyone, and the reason behind it is worth understanding rather than memorizing.

What is a truth table and how many rows does it need?

A truth table is an exhaustive case check. Each row is one possible state of the world, and each column below a statement records whether that statement holds in that state. Because there is no sampling and no guessing, a truth table can prove things: that a statement is always true, never true, or that two statements always agree.

The row count comes from doubling. One statement has two states. Add a second statement and every existing state splits into two, giving 4. Each new statement doubles the total again.

rows=2n\text{rows} = 2^n

Run it backward and you get a quick check on a table you have already drawn: a table with 64 rows must involve log⁡264=6\log_2 64 = 6 statements, which is a small use of the logarithm rules. Four statements give 16 rows, and ten give 1024, which is why nobody builds those by hand.

The trap is row order. Students who list combinations by feel often repeat one and miss another. A fixed pattern prevents it:

  • The first column is all T for the top half of the rows, then all F.
  • The second column alternates in blocks half as long (TT, FF, TT, FF for three statements).
  • The last column alternates every row: T, F, T, F.

This pattern is just binary counting with T as 1 and F as 0, written from the largest number down. Every combination appears exactly once.

Quick check

A truth table has 64 rows. How many simple statements does it contain?

Truth tables for NOT, AND and OR

NOT flips a value. If pp is true, ¬p\lnot p is false, and the reverse. AND (p∧qp \land q) is true only when both parts are true. OR (p∨qp \lor q) is true when at least one part is true, and that includes the case where both are.

pq¬pp∧qp∨qTTFTTTFFFTFTTFTFFTFF\begin{array}{|c|c|c|c|c|}\hline p & q & \lnot p & p \land q & p \lor q \\ \hline T & T & F & T & T \\ T & F & F & F & T \\ F & T & T & F & T \\ F & F & T & F & F \\ \hline \end{array}

The everyday word “or” is the classic trap. “Soup or salad” usually means one but not both. Logic uses the inclusive or, so p∨qp \lor q is still true in the top row. If a problem needs “one or the other but not both”, that is a different connective (exclusive or), covered below.

The same two connectives power set operations. An element is in the intersection A∩BA \cap B when it is in AA and in BB, and in the union A∪BA \cup B when it is in AA or in BB. If you are comfortable with union and intersection of sets, you already know the AND and OR columns.

Count the Ts

With two statements, AND is true in 1 of 4 rows and OR is true in 3 of 4. A column with the wrong count of Ts is an instant sign of an error.

Why is a conditional true when the hypothesis is false?

Two test values show a false hypothesis must make a conditional true in truth tables
For the true theorem if x > 3 then x² > 9, the values x = 1 and x = -4 both fail the hypothesis, so FF and FT must give T.

The conditional p→qp \to q reads “if pp, then qq”. It is false in exactly one row: pp true and qq false. In every other row it is true.

pqp→qTTTTFFFTTFFT\begin{array}{|c|c|c|}\hline p & q & p \to q \\ \hline T & T & T \\ T & F & F \\ F & T & T \\ F & F & T \\ \hline \end{array}

Think of it as a promise: “If you finish the test, you get a sticker.” The promise is broken only if you finish and get no sticker. If you never finish, nobody lied, whatever happens with the sticker. Logicians say the conditional is then true by default, or vacuously true.

A sharper reason comes from algebra. The statement “if x>3x > 3, then x2>9x^2 > 9” is true for every real number. Test x=1x = 1: the hypothesis is false and the conclusion (1>91 > 9) is false. Test x=−4x = -4: the hypothesis is false but the conclusion (16>916 > 9) is true. The statement must survive both, so the table has to give T for FF and for FT. Any other choice would make a true theorem fail.

The same idea explains a geometry fact. “If an angle is obtuse, then its measure is greater than 90∘90^\circ” is not contradicted by a 30∘30^\circ angle, because that angle is acute and the hypothesis never applies. See types of angles for the definitions. Swapping the parts gives different statements with different tables, which is the whole point of the converse, inverse and contrapositive: only the contrapositive ¬q→¬p\lnot q \to \lnot p matches the original in every row.

One more fact to keep: p→qp \to q has the same table as ¬p∨q\lnot p \lor q. Read it as “either pp fails, or qq holds.”

Biconditional truth table and all five connectives

The biconditional p↔qp \leftrightarrow q reads ”pp if and only if qq”. It is true when pp and qq have the same truth value, and false when they differ. That means it is true in the bottom row, where both are false, which catches students who expect “if and only if” to need real truth. It is the conditional running in both directions: p↔qp \leftrightarrow q has the same table as (p→q)∧(q→p)(p \to q) \land (q \to p). Definitions in geometry work this way, as covered in biconditional statements.

Here are all five connectives side by side.

pp qq ¬p\lnot p p∧qp \land q p∨qp \lor q p→qp \to q p↔qp \leftrightarrow q
T T F T T T T
T F F F T F F
F T T F T T F
F F T F F T T

Exclusive or, the “soup or salad” meaning, is just the biconditional negated: p⊕qp \oplus q has the table of ¬(p↔q)\lnot(p \leftrightarrow q), true exactly when the values differ. Reading the biconditional column upside down gives you XOR for free.

Quick check

In which rows of the table for pp and qq is p↔qp \leftrightarrow q true?

How do you build a truth table for a compound statement?

Work column by column, from the inside out, never in one jump.

  1. List the simple statements and write the 2n2^n rows in the fixed order.
  2. Add a column for each piece inside the innermost parentheses, or each negation.
  3. Combine those columns, one connective per column.
  4. The last column is the answer.

Negation binds tightest, so ¬p∧q\lnot p \land q means (¬p)∧q(\lnot p) \land q, not ¬(p∧q)\lnot(p \land q). Conventions beyond that vary between textbooks, so add parentheses whenever there is doubt.

Example 1. Build the table for (p∨q)∧¬p(p \lor q) \land \lnot p.

pqp∨q¬p(p∨q)∧¬pTTTFFTFTFFFTTTTFFFTF\begin{array}{|c|c|c|c|c|}\hline p & q & p \lor q & \lnot p & (p \lor q) \land \lnot p \\ \hline T & T & T & F & F \\ T & F & T & F & F \\ F & T & T & T & T \\ F & F & F & T & F \\ \hline \end{array}

The statement is true only when pp is false and qq is true. That makes sense: ¬p\lnot p forces pp to be false, and then p∨qp \lor q needs qq.

Try this: Build the table for p→(q→p)p \to (q \to p). Fill the q→pq \to p column first, then the final column. If every entry in the last column is T, you have found a statement that is true no matter what.

Example 2. Build the table for (p∧q)→r(p \land q) \to r. Three statements mean 23=82^3 = 8 rows.

pqrp∧q(p∧q)→rTTTTTTTFTFTFTFTTFFFTFTTFTFTFFTFFTFTFFFFT\begin{array}{|c|c|c|c|c|}\hline p & q & r & p \land q & (p \land q) \to r \\ \hline T & T & T & T & T \\ T & T & F & T & F \\ 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 & T \\ \hline \end{array}

Only row 2 is false: pp and qq true, rr false. Whenever p∧qp \land q is false, the hypothesis fails and the conditional is automatically true.

Truth tables for tautologies and logical equivalence

Read the final column and classify the statement. All T means a tautology, such as p∨¬pp \lor \lnot p. All F means a contradiction, such as p∧¬pp \land \lnot p. A mix is called contingent: it depends on the facts. Two statements are logically equivalent when their final columns are identical, written A≡BA \equiv B.

Example 3. Show that ¬(p∧q)≡¬p∨¬q\lnot(p \land q) \equiv \lnot p \lor \lnot q (De Morgan’s law).

pqp∧q¬(p∧q)¬p¬q¬p∨¬qTTTFFFFTFFTFTTFTFTTFTFFFTTTT\begin{array}{|c|c|c|c|c|c|c|}\hline p & q & p \land q & \lnot(p \land q) & \lnot p & \lnot q & \lnot p \lor \lnot q \\ \hline T & T & T & F & F & F & F \\ T & F & F & T & F & T & T \\ F & T & F & T & T & F & T \\ F & F & F & T & T & T & T \\ \hline \end{array}

The fourth and seventh columns both read F, T, T, T, so the two statements are equivalent. In words: “not both” means “at least one is missing”.

Equivalence is one tautology

A≡BA \equiv B exactly when A↔BA \leftrightarrow B is a tautology. Instead of comparing two columns, build the biconditional and check that its column is all T.

The same law appears in sets. The complement of A∩BA \cap B equals Ac∪BcA^c \cup B^c, and you can see it by shading regions in Venn diagrams. The notation for complements and the other symbols is collected in set notation. Logic and sets are the same structure in two outfits: AND matches intersection, OR matches union, NOT matches complement.

Is there a faster way than filling every row?

Yes: try to break the statement instead of checking every case. To test whether a statement is always true, hunt for one row that makes it false. If you can prove none exists, it is a tautology.

The conditional makes this efficient because it fails in only one way. For (p∧q)→r(p \land q) \to r, falsity needs the hypothesis true and the conclusion false. A true p∧qp \land q forces p=Tp = T and q=Tq = T, and a false conclusion forces r=Fr = F. That is a single row, which matches Example 2, and you found it without drawing eight rows. With ten variables, this saves hundreds of rows.

The shortcut has limits. When a statement can fail in many different ways, the search gets messy, and a full table is cleaner and safer. Truth tables also stop at statements about fixed true or false facts. Claims such as “for every real xx” range over infinitely many cases, so no finite table can cover them, and proof takes over.

One count to keep for perspective: two statements give 4 rows, and each row can be filled with T or F in a column, so there are 24=162^4 = 16 possible two-input connectives. AND, OR, the conditional, the biconditional and XOR are only a handful of these 16.

Quick check

In which rows is (p∨q)→(p∧q)(p \lor q) \to (p \land q) false?

Where do truth tables show up in algebra and real life?

An equation like x2−5x+6=0x^2 - 5x + 6 = 0 is not true or false until xx gets a value. At x=2x = 2 it reads 4−10+6=04 - 10 + 6 = 0, which is true. The solution statement ”x=2x = 2 or x=3x = 3” is an OR, and the quadratic formula practice problems show how to find both. Compound inequalities follow the same logic: 1<x1 < x AND x<5x < 5 is an intersection of solution sets, while x<1x < 1 OR x>5x > 5 is a union.

Systems of equations are ANDs. A point lies on both lines only if it makes both equations true. When both are written in slope-intercept form, the point must satisfy y=m1x+b1y = m_1 x + b_1 and y=m2x+b2y = m_2 x + b_2 at once, and a false conjunction means the lines do not meet there.

Outside the classroom, every digital circuit is a physical truth table, with AND, OR and NOT gates. Programming conditions such as if (a && b) use the same tables. A search filter with “red AND shirt” narrows results, while “red OR blue” widens them, and a spreadsheet IF formula is a conditional with an answer attached. Contracts and rules are also conditionals: a clause only bites in the row where its condition is true.

Practice problems

0 of 5 solved

  1. If pp is true and qq is false, what is the truth value of ¬p∨q\lnot p \lor q?

  2. How many rows does a truth table need for a statement built from 5 different simple statements?

  3. Let pp be "x=3x = 3" and qq be "x2=9x^2 = 9". Is p→qp \to q true or false when x=−3x = -3?

  4. Build the truth table for ¬p→q\lnot p \to q. In how many of the 4 rows is it true?

  5. Are (p→q)∧(p→¬q)(p \to q) \land (p \to \lnot q) and ¬p\lnot p logically equivalent?

Common questions

What is a truth table in simple terms?

A truth table is a grid that lists every possible combination of true and false for some simple statements and shows whether a compound statement built from them is true or false in each case. Each row is one scenario, and the last column is the verdict.

How many rows are in a truth table?

A statement with nn different simple statements needs 2n2^n rows: 2 for one statement, 4 for two, 8 for three, 16 for four. The header row is not counted.

Why is p→qp \to q true when pp is false?

A conditional only makes a promise about what happens when pp is true, so it cannot be broken when pp is false. It is also needed for statements like "if x>3x > 3 then x2>9x^2 > 9" to be true for every xx, including x=1x = 1 and x=−4x = -4.

What is the difference between inclusive and exclusive or?

Inclusive or (∨\lor) is true when at least one statement is true, including both. Exclusive or is true when exactly one is true, and it equals ¬(p↔q)\lnot(p \leftrightarrow q).

How do you know if two statements are logically equivalent?

Build one table with a column for each statement. If the two final columns match in every row, the statements are equivalent. Equivalently, their biconditional is a tautology.

What are the five logical connectives?

They are negation (NOT, ¬\lnot), conjunction (AND, ∧\land), disjunction (OR, ∨\lor), the conditional (IF THEN, →\to) and the biconditional (IF AND ONLY IF, ↔\leftrightarrow).

Up next