In: Computer Science
Prove that the following is true for all positive integers n: n is odd if and only if n2 is odd.
The contrapositive of an If-Then
Statement
If p, then q is If ~q, then ~p
The conditional statement is logically equivalent to its contrapositive.
So,
p→q ≡ ~q→ ~p which means if the conditional stamement is true, its contrapositive is also true.
The even number can be expressed as the product of 2 and an integer, that is, 2k for some integer k.
Example,
10= 2(5)
12= 2(6)
The contrapositive of the theorem that we want to prove. If the contrapositive is proven true, the original statement must be also true.
If n^2 is odd, then n is odd is If n is even, then n^2 is even.
Assume that n is even that means we can express it as n = 2k.
So,
n2=(2k)2=4k2
Now factor out 2 from RHS,
n2=2(2k2) (If k is an integer 2k2is also an integer)
So, we can write it as, where t is an integer and 2t is clearly the algebraic form of an even number.
n2=2t
The contrapositive to be true makes the original conditional statement true. So, we have that if n2 is odd, then n is odd.