UPI Study › Courses › Discrete Mathematics › Free lessons › Lesson 1.5 Free with a free account
Conditional Statements: If-Then, Converse, Inverse, and Contrapositive
Discrete Mathematics · Chapter 1: Logic and Mathematical ProofSection 1.5 · lesson 5 of 878 min · free with a free account
Free preview
Create a free account to keep watching
It takes a minute and costs nothing. Your free account unlocks all of Chapter 1 and 3 more lessons of Discrete Mathematics.
Lesson complete
Earn the 4 college credits for Discrete Mathematics
Enrolling adds a quiz after each lesson, the graded work and the official transcript. Recommended for credit by NCCRS.
Next lesson: Laws of Logic and Logical Equivalence →← Logical Connectives: AND, OR, NOT, and MoreNext lesson: Laws of Logic and Logical Equivalence →
In this lesson
If-then, converse, inverse, contrapositive - and which ones you can trust.
- Evaluate a conditional statement, including its vacuous cases
- Form the converse, inverse, and contrapositive
- Explain when a biconditional holds
- Distinguish necessary from sufficient conditions
Transcript
Everything said in the video, section by section (1,156 words). Read along, or search it.
Logic and Mathematical Proof
Conditional Statements
This section is about conditional statements, the if-then statements behind almost every rule in software and in mathematics. We'll see exactly when a conditional is true, including a case that surprises most people. Then we'll form three related statements, the converse, inverse, and contrapositive, and find out which one can be trusted. And we'll finish with if and only if, and with necessary and sufficient conditions.
The Opening Problem
An API Gateway Rule
Every request to a platform's API gateway passes an authentication check. The team encodes the rule as a single conditional. If a user's session token has expired, then the gateway returns a four-oh-one unauthorized response. Let p stand for the token has expired, and q for the gateway returns four-oh-one. The rule is p implies q. It looks simple. But a conditional of this shape quietly implies three related statements, its converse, its inverse, and its contrapositive. Only one of the three is guaranteed to agree with the original. So a dashboard that reads every four-oh-one as proof of an expired token is relying on a relationship the rule never promised. This section builds the vocabulary to tell precisely which relationships can be trusted.
Definition
The Conditional Statement
For statements p and q, the conditional p implies q, read if p then q, asserts that whenever p is true, q is also true. p is called the hypothesis, or antecedent. q is called the conclusion, or consequent. And here's the key fact. A conditional is false in exactly one case, when p is true and q is false. In every other case, it's true.
The 4 Cases
Only One Row Breaks the Promise
Let's check all four cases against what the gateway rule actually promises. An expired token is always followed by a four-oh-one, and nothing is promised about anything else. Token expired, four-oh-one returned. That's exactly what the rule guarantees, so the conditional is true. Token expired, but no four-oh-one. That breaks the promise directly. This is the only row where the conditional is false. Token not expired, but a four-oh-one returned anyway, say because the token was missing entirely. The rule never claimed a four-oh-one could only come from expiry. So nothing contradicts it. The conditional is true there, if a little counterintuitively. This is called vacuously true. The hypothesis is false, so the promise is trivially unbroken. And token not expired, no four-oh-one. Again, nothing contradicts the rule, so the conditional is true.
Converse, Inverse, Contrapositive
Swap, Negate, or Both
Three more statements can be formed from p implies q, by swapping the parts, negating both, or doing both. The converse swaps them. q implies p. If the gateway returns four-oh-one, then a token has expired. That's not guaranteed at all. A four-oh-one can also come from a missing token, a malformed signature, or a blocked IP address. The inverse negates both, in the same order. Not p implies not q. If a token hasn't expired, the gateway doesn't return four-oh-one. That fails for the same kind of reason. A valid, unexpired token can still trigger a four-oh-one if it lacks the required permission scope. The contrapositive negates and swaps. Not q implies not p. If the gateway doesn't return four-oh-one, then the token hasn't expired. This one is guaranteed whenever the original holds. An expired token always produces a four-oh-one, so the absence of one rules expiry out.
Table 1.5.1
The Original and Its 3 Relatives
This table checks all four statements, row by row. Compare each column with the original. The contrapositive matches it in every single row. The converse and inverse don't. They differ from the original in rows two and three. But notice something else. The converse and inverse always match each other. So of the three relatives, only the contrapositive can be trusted to share the original's truth value.
Figure 1.5.1
4 Statements From One Conditional
This figure shows the four statements formed from one conditional. Swapping the hypothesis and conclusion gives the converse. Negating both gives the inverse. Doing both at once gives the contrapositive. Only the contrapositive, reached by combining both transformations, always shares the original's truth value. That match isn't a coincidence of this one example. It holds for any conditional. Here, though, it's a fact confirmed by inspecting the table. The general framework of equivalence laws, and its notation, comes in section one point six.
The Biconditional
If and Only If
The biconditional, p if and only if q, often abbreviated iff, is true exactly when p and q have the same truth value. Both true, or both false. Equivalently, it's true precisely when p implies q and its converse, q implies p, are both true. In the table, it's true only in the two rows where p and q agree. The gateway rule shows why not every true conditional gives a true biconditional. Its converse is false, so token expired if and only if four-oh-one is false, even though the one-way rule is true. A different rule does support a genuine iff. Suppose the platform is designed so an account is verified exactly when its email address is confirmed. Verified accounts always have a confirmed email, and a confirmed email always means verified. Both directions hold, so the biconditional is true.
Why Definitions Use Iff
One Sentence, 2 Conditionals
If and only if is the standard way mathematics states a definition, because a definition is meant to hold in both directions. An integer a is even if and only if a is divisible by two. That asserts that every even integer is divisible by two. And it asserts that every integer divisible by two is even. It's a single sentence doing the work of two conditionals at once.
Necessary and Sufficient
One Relationship, Named From Each Side
For a conditional p implies q, p is called a sufficient condition for q. p being true is enough, by itself, to guarantee q. And q is called a necessary condition for p. q must hold whenever p does, though q on its own doesn't guarantee p. These are two descriptions of the same relationship, named from each side. The gateway separates the roles cleanly. A valid, unexpired token is necessary for a protected endpoint. Without it, access is refused. But it isn't sufficient, because the request also needs the correct authorization scope. A valid token with too little scope is still rejected. In the other direction, a valid administrator credential is sufficient to reach the admin panel. But it's not necessary, because a logged, time-boxed break-glass token also gets in. When a condition is both necessary and sufficient for another, the relationship is exactly a biconditional.
Takeaways
Which Relationships Can Be Trusted
To summarize. p implies q is false only when p is true and q is false. Every other combination makes it true, including the vacuous cases where p is false. The converse and inverse aren't guaranteed to share the original's truth value. The contrapositive always does. The biconditional holds exactly when a conditional and its converse are both true. And sufficient and necessary describe the same conditional from two directions. Here's something to think about. A security policy says encrypting data at rest is necessary for regulatory compliance. Does encryption guarantee compliance? What does the statement promise, and what else would need to be true for the combination to be sufficient?
About Discrete Mathematics at UPI Study
Discrete Mathematics (Math 230) is a self-paced online course of 87 video lessons in 13 chapters, from logic and proof to counting, probability, graph theory and trees. It carries a NCCRS credit recommendation for 4 semester credits.
Every lesson transcript is free on pages like this one, and the videos are free with a free UPI Study account. Enrolling adds a practice quiz after each lesson, the graded work and final exam that earn the credit, lifetime access, and an official transcript on completion. UPI Study has helped over 130,000 students with college credits. ACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities.
Enroll now → Course details Download the syllabus Every course with PRO →
Why take it here
Why students take Discrete Mathematics with UPI Study
Where the credit goes
Universities that work with NCCRS
Discrete Mathematics carries a NCCRS credit recommendation. These universities work with NCCRS; some are UPI Study's signed partners. ACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities.
Thomas Edison State UniversitySigned partner
University of the PeopleSigned partner
Charter Oak State CollegeSigned partner
Strayer UniversitySigned partner
Columbia Southern UniversitySigned partner
Indiana TechSigned partner
Penn StateWorks with NCCRS
Southern New Hampshire UniversityWorks with NCCRS
SUNYWorks with NCCRS
+many more cooperating universitiesFind my college →Find my college → Not listed? Ask Athena in the corner of this page, or book a 15-minute call.
FAQ
Questions students ask us
About Conditional Statements: If-Then, Converse, Inverse, and Contrapositive
When is a conditional statement p \to q true or false?
How do you write the converse, inverse, and contrapositive of "if p then q"?
What does "if and only if" mean, and when is a biconditional true?
What is the difference between a necessary and a sufficient condition?
About the Discrete Mathematics course
How many college credits is Discrete Mathematics?
How much does Discrete Mathematics cost and what is included?
Which universities accept UPI Study credits?
How long does Discrete Mathematics take?
How are the exams done?
How do my credits reach my college?
Ready for the full course? Earn 4 credits in Discrete Mathematics.
87 video lessons, a quiz after each one, and the graded work that earns the credit. Recommended for credit by NCCRS.
4 credits · NCCRSEnroll →