TN 12th MathsLearn · Visualize · Practice

Chapter 12

Discrete Mathematics

Binary operations and mathematical logic.

1. What discrete mathematics studies

Continuous mathematics deals with the real line, where between any two numbers there are uncountably many more. Discrete mathematics instead works with sets whose elements are separated — finite sets, or countably infinite ones like N={1,2,3,}\mathbb{N} = \{1, 2, 3, \dots\}. Its elements can be listed as a sequence with gaps between them, which is exactly why it underpins computer science and logic.

This chapter covers two pillars of discrete mathematics: binary operations (the abstract study of "combining two things to get a third") and mathematical logic (the abstract study of true/false reasoning).

2. Binary operations and closure

Addition, subtraction and multiplication all share a common shape: you feed in two elements of a set and get back a single element. Discrete mathematics makes this idea precise with the notion of a binary operation.

DefinitionBinary operation (Definition 12.1)

A binary operation * on a non-empty set SS is a rule :S×SS* : S \times S \to S that assigns to every ordered pair (a,b)(a, b) with a,bSa, b \in S exactly one element aba * b, and crucially that result again lies in SS.

The requirement that aba * b stays inside SS is called closure. It is built into the definition — if the output ever escapes SS, then * is simply not a binary operation on SS. So the very first thing to check is always: does the output land back in the set?

Which usual operations are binary on which sets
  • ++ and ×\times are binary on N,Z,Q,R,C\mathbb{N}, \mathbb{Z}, \mathbb{Q}, \mathbb{R}, \mathbb{C} — sums and products never leave these sets.
  • - is binary on Z,Q,R\mathbb{Z}, \mathbb{Q}, \mathbb{R} but NOT on N\mathbb{N}: 25=3N2 - 5 = -3 \notin \mathbb{N}.
  • ÷\div is NOT binary on Z\mathbb{Z} (e.g. 1÷2=12Z1 \div 2 = \tfrac12 \notin \mathbb{Z}); it is binary on Q{0}\mathbb{Q}\setminus\{0\}, since dividing by 00 is undefined.
  • Matrix addition and multiplication are binary on the set of all 2×22 \times 2 real matrices.
Watch out: To prove something is NOT a binary operation, you only need ONE counterexample where the output leaves the set. To prove it IS, you must argue the output stays in the set for every pair.
ExampleClosure on the integers
Is ab=a+baba * b = a + b - ab a binary operation on Z\mathbb{Z}?
ExampleA quotient operation — watch the denominator
Is ab=a1b1a * b = \dfrac{a-1}{b-1} a binary operation on Q\mathbb{Q}?
ExampleExponentiation on the naturals
Is ab=aba * b = a^{b} a binary operation on N\mathbb{N}?

3. Commutative and associative properties

Once * is a binary operation on SS, we ask what algebraic laws it obeys. The first two are about the order and grouping of the inputs.

DefinitionCommutative property

* is commutative if ab=baa * b = b * a for all a,bSa, b \in S — the order of the two inputs does not matter.

DefinitionAssociative property

* is associative if (ab)c=a(bc)(a * b) * c = a * (b * c) for all a,b,cSa, b, c \in S — when combining three elements, how you bracket them does not matter.

Note: These are separate questions. Subtraction on $\mathbb{Z}$ is neither: $3 - 5 \ne 5 - 3$, and $(8 - 3) - 2 = 3$ while $8 - (3 - 2) = 7$. One counterexample is enough to kill either property.
ExampleTesting commutativity
On R\mathbb{R} define ab=a+baba * b = a + b - ab. Is * commutative?
ExampleTesting associativity
On R\mathbb{R} define ab=a+b+aba * b = a + b + ab. Is * associative?
ExampleA quick disproof by counterexample
Show that ab=aba * b = a^{b} on N\mathbb{N} is neither commutative nor associative.

4. Identity and inverse elements

The next two properties are about special elements — one that does nothing, and, for each element, one that undoes it.

DefinitionIdentity element

An element eSe \in S is an identity for * if ae=ea=aa * e = e * a = a for every aSa \in S. For example 00 is the identity for ++ and 11 is the identity for ×\times.

DefinitionInverse element

If an identity ee exists, then bSb \in S is an inverse of aa when ab=ba=ea * b = b * a = e, written b=a1b = a^{-1}. Under ++ the inverse of aa is a-a; under ×\times the inverse of a0a \ne 0 is 1a\tfrac{1}{a}.

Note: Two useful theorems: in any algebraic structure the identity element, if it exists, is unique; and the inverse of an element, if it exists, is unique. Read $a^{-1}$ as "the inverse of $a$", NOT as $\tfrac{1}{a}$ — the meaning depends on the operation.
ExampleFinding identity and inverse
On Z\mathbb{Z} define mn=m+nmnm * n = m + n - mn. Find the identity, then the inverse of a general element.
ExampleThe five-property checklist for a familiar operation
Verify closure, commutativity, associativity, identity and inverse for ++ on Z\mathbb{Z}.

5. Operation tables and modular arithmetic

When a set is finite, a binary operation can be displayed completely as a Cayley table (operation table): the entry in row aa, column bb is aba * b. The table lets us read off every property by eye.

DefinitionModular arithmetic

Fix a modulus n>1n > 1. We write ab (mod n)a \equiv b \ (\text{mod } n) when aba - b is a multiple of nn; here bb is the remainder when aa is divided by nn. On Zn={0,1,,n1}\mathbb{Z}_n = \{0, 1, \dots, n-1\} define a+nba +_n b as the remainder of a+ba + b on division by nn.

For example, 254 (mod 7)25 \equiv 4 \ (\text{mod } 7) and 150 (mod 5)15 \equiv 0 \ (\text{mod } 5). Here is the full Cayley table for +5+_5 on Z5={0,1,2,3,4}\mathbb{Z}_5 = \{0, 1, 2, 3, 4\}:

+₅01234
001234
112340
223401
334012
440123
ExampleReading properties off the table
Using the +5+_5 table, verify closure, commutativity, identity, and find the inverse of 22.
ExampleMultiplication modulo n
Compute 4×1154 \times_{11} 5 and 9×1139 \times_{11} 3 under multiplication modulo 1111.

6. Mathematical logic: statements

Logic studies reasoning through symbols. Its atoms are statements (also called propositions).

DefinitionStatement (proposition)

A statement is a declarative sentence that is either true or false, but not both. Its truth value is TT (true) or FF (false).

Statement or not?
  • "2+3=52 + 3 = 5" is a statement (true). "77 is even" is a statement (false).
  • "Chennai is in Tamil Nadu" is a statement (true). "Peacock is our national bird" is a statement (true).
  • "Close the door." (a command), "What time is it?" (a question) and "x+1=4x + 1 = 4" (depends on xx) are NOT statements.

A statement built from a single idea is a simple statement; combining simple statements with connectives gives a compound statement. We name simple statements with propositional variables p,q,r,p, q, r, \dots

7. Logical connectives and their truth tables

Connectives let us build every compound statement, and each is defined completely by a truth table listing the output for every combination of inputs. A formula with nn variables needs 2n2^n rows.

  • Negation ¬p\neg p ("not pp") — reverses the truth value.
  • Conjunction pqp \wedge q ("pp and qq") — true only when both are true.
  • Disjunction pqp \vee q ("pp or qq") — false only when both are false (inclusive or).
  • Conditional pqp \to q ("if pp then qq") — false only when pp is true and qq is false.
  • Biconditional pqp \leftrightarrow q ("pp if and only if qq") — true exactly when pp and qq have the same truth value.
  • Exclusive or pqp \veebar q — true when exactly one of p,qp, q is true (not both).
Watch out: The conditional $p \to q$ trips students up: whenever the hypothesis $p$ is false, the whole statement is automatically true ("vacuously true"). Only a true $p$ with a false $q$ makes $p \to q$ false. Also, $p \to q$ does NOT require $p$ and $q$ to be related in meaning.
Key idea: Open the Visualize tab to build these truth tables yourself — pick any compound expression and watch the result column fill in row by row, and compare two expressions side by side to test equivalence.

8. Constructing truth tables for compound statements

To evaluate a compound statement, add one column per sub-expression, working outward from the innermost pieces, and fill each column using the connective definitions.

ExampleA three-column build
Construct the truth table for (pq)(p¬q)(p \vee q) \wedge (p \vee \neg q) and classify it.
ExampleCounting the rows first
How many rows does the truth table of (pq)(¬r¬s)(¬tv)(p \wedge q) \vee (\neg r \vee \neg s) \wedge (\neg t \wedge v) need?

9. Conditional: converse, inverse, contrapositive

From a conditional pqp \to q we derive three related statements. Only one of them is always logically equivalent to the original.

  • Converse: qpq \to p (swap hypothesis and conclusion).
  • Inverse: ¬p¬q\neg p \to \neg q (negate both).
  • Contrapositive: ¬q¬p\neg q \to \neg p (swap AND negate) — this one is equivalent to pqp \to q.
pq    ¬q¬pbutpq  ≢  qpp \to q \;\equiv\; \neg q \to \neg p \qquad\text{but}\qquad p \to q \;\not\equiv\; q \to p
ExampleWriting all three
For "If x=yx = y, then x2=y2x^2 = y^2", write the converse, inverse and contrapositive.

10. Tautology, contradiction, contingency

Look at the final column of a compound statement's truth table. Exactly three cases can occur.

DefinitionTautology

True for every assignment of truth values — the whole final column is TT. Denoted T\mathbb{T}. Example: p¬pp \vee \neg p.

DefinitionContradiction

False for every assignment — the whole final column is FF. Denoted F\mathbb{F}. Example: p¬pp \wedge \neg p.

DefinitionContingency

Neither a tautology nor a contradiction — the final column mixes TT and FF. Example: pqp \wedge q.

Note: The negation of a tautology is a contradiction and vice versa. For any statement $p$: $p \vee \neg p$ is a tautology (law of the excluded middle) and $p \wedge \neg p$ is a contradiction.
ExampleIdentifying a tautology
Show that p¬pp \vee \neg p is a tautology.
ExampleClassifying without guessing
Is (pq)¬(pq)(p \wedge q) \wedge \neg(p \vee q) a tautology, contradiction or contingency?

11. Logical equivalences and De Morgan's laws

DefinitionLogically equivalent

Two statements are logically equivalent, written \equiv, when their truth-table columns are identical in every row. Equivalently, ABA \equiv B means ABA \leftrightarrow B is a tautology.

The equivalences worth memorising:

De Morgan's laws
¬(pq)¬p¬q,¬(pq)¬p¬q\neg(p \wedge q) \equiv \neg p \vee \neg q, \qquad \neg(p \vee q) \equiv \neg p \wedge \neg q
Conditional as disjunction
pq¬pqp \to q \equiv \neg p \vee q
Distributive laws
p(qr)(pq)(pr),p(qr)(pq)(pr)p \vee (q \wedge r) \equiv (p \vee q) \wedge (p \vee r), \quad p \wedge (q \vee r) \equiv (p \wedge q) \vee (p \wedge r)
Double negation
¬(¬p)p\neg(\neg p) \equiv p
Note: De Morgan's laws say "not (both)" is the same as "at least one not", and "not (either)" is the same as "neither". They turn the negation of a compound statement into a compound of negations.
ExampleVerifying a De Morgan law by truth table
Verify ¬(pq)¬p¬q\neg(p \wedge q) \equiv \neg p \vee \neg q.
ExampleProving p → q ≡ ¬p ∨ q
Show the conditional equals a disjunction: pq¬pqp \to q \equiv \neg p \vee q.

12. The duality principle

Many logical equivalences come in mirror-image pairs. The duality principle explains why.

DefinitionDual of a statement (Definition 12.19)

The dual of a compound statement is obtained by interchanging \wedge with \vee, and T\mathbb{T} with F\mathbb{F}, while leaving negations ¬\neg and the variables unchanged.

Principle: if two statements are logically equivalent, then so are their duals. This is exactly why De Morgan's two laws, and the two distributive laws, always appear together — each is the dual of the other. Also, the dual of a dual returns the original statement.

Dual pairs
  • The dual of p(qr)p \wedge (q \vee r) is p(qr)p \vee (q \wedge r).
  • The dual of pFpp \vee \mathbb{F} \equiv p is pTpp \wedge \mathbb{T} \equiv p.
  • The dual of ¬(pq)[p(p¬r)]\neg(p \vee q) \vee [p \vee (p \wedge \neg r)] is ¬(pq)[p(p¬r)]\neg(p \wedge q) \wedge [p \wedge (p \vee \neg r)] — note ¬\neg is untouched.