Conditional Statements: If-Then, Converse, Inverse, and Contrapositive | Free Discrete Mathematics Lesson (4 College Credits) | UPI Study

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

← Logical Connectives: AND, OR, NOT, and MoreNext lesson: Laws of Logic and Logical Equivalence →

Earn 4 college credits for Discrete MathematicsRecommended for credit by NCCRS · Math 230 · self-paced · one payment, lifetime access

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.

Why take it here

Why students take Discrete Mathematics with UPI Study

The math behind computer scienceDiscrete Mathematics is the mathematics of computer science: logic, proofs, sets, counting, probability and graphs underpin algorithms, data structures, cryptography and databases. Completing it now lets you qualify for those courses at your university.
Credit at a fraction of the priceThe same 4 credits can cost $750 or more at a US college. Here it is one payment, self-paced, with lifetime access.
Finish your degree soonerTransfer credits reduce the courses you still owe, so you can graduate earlier or lighten a heavy semester.
Strengthen an applicationA completed college-level course on an official transcript shows admissions and scholarship committees you can do the work.
Study on your own scheduleNo start dates, no deadlines. Watch the lessons, practice, and take the final when you are ready.
130,000+students helped with college creditsACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities.

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.

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?
A conditional p \to q is false in exactly one case: when p is true and q is false. In every other case it is true. When p is false, the statement is vacuously true because the promise is never tested. For example, "if a token has expired, the gateway returns 401" is not contradicted by an unexpired token.
How do you write the converse, inverse, and contrapositive of "if p then q"?
Starting from p \to q, the converse swaps the parts: q \to p. The inverse negates both: \neg p \to \neg q. The contrapositive does both: \neg q \to \neg p. Only the contrapositive is guaranteed to have the same truth value as the original. The converse and inverse can differ from it, though they always match each other.
What does "if and only if" mean, and when is a biconditional true?
The biconditional p \leftrightarrow q is true exactly when p and q have the same truth value, both true or both false. Equivalently, it holds when both p \to q and its converse q \to p are true. A true conditional alone is not enough. "An integer is even iff it is divisible by 2" works because both directions hold.
What is the difference between a necessary and a sufficient condition?
For p \to q, p is sufficient for q because p alone guarantees q, and q is necessary for p because q must hold whenever p does. These are two views of one conditional. A valid token is necessary for a protected endpoint but not sufficient, since the right permission scope is also required. If a condition is both necessary and sufficient, the relationship is a biconditional.

About the Discrete Mathematics course

How many college credits is Discrete Mathematics?
Discrete Mathematics (Math 230) carries a NCCRS credit recommendation for 4 semester credits. ACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities.
How much does Discrete Mathematics cost and what is included?
$250, paid once, with lifetime access: all 87 video lessons, a practice quiz after each, the graded work and final exam, and an official transcript when you finish. Students who want several courses choose UPI Study PRO instead.
Which universities accept UPI Study credits?
UPI Study has signed partner agreements with universities such as Thomas Edison State University, University of the People and Charter Oak State College, and works with universities such as Penn State, SNHU and SUNY. ACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities. Use "Find my college" on this page to check yours.
How long does Discrete Mathematics take?
It is self-paced with no deadlines. The 87 lessons total about 13 hours of video; most students add reading and practice time and finish in a few weeks to a few months, on their own schedule.
How are the exams done?
Quizzes and assignments are online in the course. The final exam is taken online with proctoring; a person on the UPI Study team checks assignments, usually within two days.
How do my credits reach my college?
When the course shows 100% complete, request the official transcript from your dashboard. It is sent to the college you name, and you can send it to more than one. Check your college first with "Find my college" on this page, or ask Athena.

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.

Discrete Mathematics
4 credits · NCCRS
Enroll →