maths.free › Discrete Math & Logic › Direct proof, contrapositive and contradiction
Direct proof, contrapositive and contradiction
The three basic ways to prove an implication, when to reach for each, and how to write the proof.
Most theorems have the shape "if \( P \) then \( Q \)". A direct proof assumes \( P \) and reasons forward, one justified step at a time, until it reaches \( Q \). To show that the sum of two odd integers is even, write them as \( 2a + 1 \) and \( 2b + 1 \): their sum is \( 2(a + b + 1) \), which is even. Unpacking definitions into algebra like this is where most direct proofs start.
A proof by contrapositive proves \( \lnot Q \Rightarrow \lnot P \) instead. The two statements are logically equivalent, as the example's truth table shows, so proving one proves the other. It helps when \( \lnot Q \) gives you something concrete to work with. To prove "if \( n^2 \) is even then \( n \) is even", the direct route starts from \( n^2 = 2k \) and gets stuck taking a square root. The contrapositive starts from \( n = 2k + 1 \) and computes \( n^2 = 2(2k^2 + 2k) + 1 \), which is odd. Do not confuse the contrapositive with the converse \( Q \Rightarrow P \), which is a different statement and may be false.
A proof by contradiction assumes the statement is false and derives something impossible. To show \( \sqrt 2 \) is irrational, suppose \( \sqrt 2 = a/b \) in lowest terms. Then \( a^2 = 2b^2 \), so \( a^2 \) is even, so \( a \) is even (the contrapositive result above), say \( a = 2c \). Then \( 4c^2 = 2b^2 \) gives \( b^2 = 2c^2 \), so \( b \) is even too, and \( a/b \) was not in lowest terms after all. Euclid's proof that there are infinitely many primes has the same shape: given any finite list of primes, their product plus one has a prime factor that is not on the list.
Picture it: a direct proof is a road from \( P \) to \( Q \). The contrapositive is the same road driven backwards from "not \( Q \)" to "not \( P \)". A contradiction proof is a map of every road leaving "not the theorem", showing that each one ends at a cliff.
Think it: try direct proof first. Use the contrapositive when the conclusion is a negative or an "is not" statement, or when its negation is easier to write down. Use contradiction for statements like irrationality or infinitude, whose natural negation hands you a finite list or a fraction to work with. And state clearly at the start which method you are using, so a reader knows what is being assumed.
Worked example · truth table of (p -> q) iff (not q -> not p)
Truth table of (p -> q) iff (not q -> not p)
Step by step
- \left(p \Rightarrow q\right) \Leftrightarrow \left(\neg q \Rightarrow \neg p\right)
2 variable(s) → 4 rows. Fill in every combination.
- \
A tautology (always true).
Reveal the answer
Now you Pick a problem, or type or draw your own. Every step, a picture, the answer hidden until you ask.
Symbols used here
Tap any symbol for the full definition, a picture, and what every letter in it means.
How to: Direct proof, contrapositive and contradiction
- Write the statement as "if P then Q" and identify P and Q exactly.
- Unpack every definition in P and Q into algebra (even means 2k, divides means a multiple).
- Try a direct chain from P to Q; if it stalls, write the contrapositive and try that.
- For contradiction, assume P and not Q together and aim for a statement and its negation.
- Finish by saying what has been proved and by which method.
Questions people ask
Is every proof by contrapositive also a proof by contradiction?
It can be rephrased as one (assume P and not Q, derive not P, contradiction), but the contrapositive is cleaner: it has a definite goal, not P, rather than any contradiction at all.
Can an example prove a "for all" statement?
No. Examples can suggest a pattern and a single counterexample can disprove a universal statement, but proving it needs an argument that covers every case.
What makes mathematics "discrete"?
It deals with separate, countable objects (integers, graphs, statements) rather than continuous quantities. No limits, no infinitesimals; instead induction, counting and logic.
How does a proof by induction work?
Show the statement for the first case, then show that whenever it holds for n it holds for n + 1. Like dominoes: the first falls, and each knocks over the next.
What order should I take these lessons in?
Logic and proof first, because every later lesson proves things. Then induction, sets, relations and functions, counting, recurrences, graphs, Boolean algebra and automata, and finally algorithms and complexity, which use nearly everything before them.
Is discrete mathematics the same as the maths of computer science?
Largely. Data structures are graphs and trees, correctness arguments are induction, running times are recurrences and sums, circuits are Boolean algebra, and what a computer can do efficiently is the subject of the last lessons. It is also ordinary mathematics in its own right.
Do I need calculus for this course?
No. School algebra is enough. A little familiarity with limits helps when comparing growth rates, and the lesson on asymptotic analysis explains the one limit fact it uses.
More in Discrete Math & Logic
Truth tablesSums and inductionProof by inductionAlgorithms and growth of functionsPredicate logic and quantifiersStrong induction and the well-ordering principleRelations: equivalence relations and partial ordersFunctions and cardinalityCounting: rules, choices and bijectionsThe pigeonhole principleSolving linear recurrence relationsGraphs: degrees, paths and connectivityTrees and spanning treesEuler and Hamilton paths