What Is A Conditional Statement?
In mathematics, we define statement as a declarative statement which may either be true or may be false. Often sentences that are mathematical in nature may not be a statement because we might not know what the variable represents. For example, 2x + 2 = 5. Now here we do not know what x represents thus if we substitute the value of x (let us consider that x = 3) i.e., 2 × 3 = 6. Therefore, it is a false statement. So, what is a conditional statement? In simple words, when through a statement we put a condition on something in return of something, we call it a conditional statement. For example, Mohan tells his friend that “if you do my homework, then I will pay you 50 dollars”. So what is happening here? Mohan is paying his friend 50 dollars but places a condition that if only he’s work will be completed by his friend. A conditional statement is made up of two parts. First, there is a hypothesis that is placed after “if” and before the comma and second is a conclusion that is placed after “then”. Here, the hypothesis will be “you do my homework” and the conclusion will be “I will pay you 50 dollars”. Now, this statement can either be true or may be false. We don’t know.
Hypothesis
A hypothesis is a part that is used after the 'if' and before the comma. This composes the first part of a conditional statement. For example, the statement, 'I help you get an A+ in math,' is a hypothesis because this phrase is coming in between the 'if' and the comma. So, now I hope you can spot the hypothesis in other examples of a conditional statement. Of course, you can. Here is a statement: 'If Miley gets a car, then Allie's dog will be trained,' the hypothesis here is, 'Miley gets a car.' For the statement, 'If Tom eats chocolate ice cream, then Luke eats double chocolate ice cream,' the hypothesis here is, 'Tom eats chocolate ice cream. Now it is time for you to try and locate the hypothesis for the statement, 'If the square is a rectangle, then the rectangle is a quadrilateral'?
Conclusion
A conclusion is a part that is used after “then”. This composes the second part of a conditional statement. For example, for the statement, “I help you get an A+ in math”, the conclusion will be “you will give me 50 dollars”. The next statement was “If Miley gets a car, then Allie's dog will be trained”, the conclusion here is Allie's dog will be trained. It is the same with the next statement and for every other conditional statement.
How Do We Know If A Statement Is True or False?
In mathematics, the best way we can know if a statement is true or false is by writing a mathematical proof. Before writing a proof, the mathematician must find if the statement is true or false that can be done with the help of exploration and then by finding the counterexample. Once the proof is discovered, the mathematician must communicate this discovery to those who speak the language of maths.
Converse, Inverse, contrapositive, And Bi-conditional Statement
We usually use the term “converse” as a verb for talking and chatting and as a noun we use it to represent a brand of footwear. But in mathematics, we use it differently. Converse and inverse are the two terms that are a connected concept in the making of a conditional statement.
If we want to create the converse of a conditional statement, we just have to switch the hypothesis and the conclusion. To create the inverse of a conditional statement, we have to turn both the hypothesis and the conclusion to the negative. A contrapositive statement can be made if we first interchange the hypothesis and conclusion then make them both negative. In a bi-conditional statement, we use “if and only if” which means that the hypothesis is true only if the condition is true. For example,
If you eat junk food, then you will gain weight is a conditional statement.
If you gained weight, then you ate junk food is a converse of a conditional statement.
If you do not eat junk food, then you will not gain weight is an inverse of a conditional statement.
If yesterday was not Monday, then today is not Tuesday is a contrapositive statement.
Today is Tuesday if and only if yesterday was Monday is a bi-conventional statement.
Image will be uploaded soon
A Conditional Statement Truth Table
In the table above, p→q will be false only if the hypothesis(p) will be true and the conclusion(q) will be false, or else p→q will be true.
Conditional Statement Examples
Below, you can see some of the conditional statement examples.
Example 1) Given, P = I do my work; Q = I get the allowance
What does p→q represent?
Solution 1) In the sentence above, the hypothesis is “I do my work” and the conclusion is “I get the allowance”. Therefore, the condition p→q represents the conditional statement, “If I do my work, then I get the allowance”.
Example 2) Given, a = The sun is a ball of gas; b = 5 is a prime number. Write a→b in a sentence.
Solution 2) The conditional statement a→b here is “if the sun is a ball of gas, then 5 is a prime number”.
FAQs on Conditional Statement
1. How many types of conditional statements are there?
There are basically 5 types of conditional statements.
If statement, if-else statement, nested if-else statement, if-else-if ladder, and switch statement are the basic types of conditional statements. If a function displays a statement or performs a function on the condition if the statement is true. If-else statement executes a block of code if the condition is true but if the condition is false, a new block of code is placed. The switch statement is a selection control mechanism that allows the value of a variable to change the control flow of a program.
2. How are a conditional statement and a loop different from each other?
A conditional statement is sometimes used by a loop but a loop is of no use to a conditional statement. A conditional statement is basically a “yes” or a “no” i.e., if yes, then take the first path else take the second one. A loop is more like a cyclic chain starting from the start point i.e., if yes, then take path a, if no, take path b and it comes back to the start point.
Conditional statement executes a statement based on a condition without causing any repetition.
A loop executes a statement repeatedly. There are two loop variables i.e., for loop and while loop.