Mathematical proof is an argument we give logically to validate a mathematical statement. In order to validate a statement, we consider two things: A **statement** and **Logical operators**.

A statement is either true or false but not both. Logical operators are AND, OR, NOT, If then, and If and only if. Coupled with quantifiers like for all and there exists. We apply operators on the statement to check the correctness of it.

**Types of mathematical proofs:**

**Proof by cases –**

In this method, we evaluate every case of the statement to conclude its truthiness.**Example:**For every integer x, the integer x(x + 1) is even

**Proof:**If x is even, hence, x = 2k for some number k. now the statement becomes:

2k(2k + 1)

which is divisible by 2, hence it is even.

If x is odd, hence x = 2k + 1 for some number k, now the statement becomes:

(2k+1)(2k+1+1) = (2k + 1) 2(k + 1)

which is again divisible by 2 and hence in both cases we proved that x(x+1) is even.

**Proof by contradiction –**

We assume the negation of the given statement and then proceed to conclude the poof.**Example:**Prove that sqrt(2) is irrational

Suppose sqrt(2) is rational.sqrt(2) = a/b

for some integers a and b with b != 0.

Let us choose integers a and b with sqrt(2) = a/b, such that b is positive and as small as possible. (Well-Ordering Principle)a^2 = 2b^2

Since a^2 is even, it follows that a is even.

a = 2k for some integer k, so a^2 = 4k^2

b^2 = 2k^2. Since b^2 is even, it follows that b is even.

Since a and b are both even, a/2 and b/2 are integers with b/2 > 0, and sqrt(2) = (a/2)/(b/2), because (a/2)/(b/2) = a/b.

But it contradicts our assumption b is as small as possible. Therefore sqrt(2) cannot be rational.**Proof by induction –**

The Principle of Mathematical Induction (PMI). Let P(n) be a statement about the positive integer n. If the following are true:

1. P(1), 2. (for all n there exists Z+) P(n) implies P(n + 1), then (for all n there exists Z+) P(n).

**Example:**For every positive integer n,1 + 2 +···+ n = n(n + 1)/ 2

**Proof:**

Base case: If n = 1,1 + ··· + n = 1

And

n(n + 1)/2 = 11

**Inductive step:**

Suppose that for a given n there exists Z+,1 + 2 +···+ n = n(n + 1)/ 2 ---- (i) (inductive hypothesis)

Our goal is to show that:

1 + 2 +···+ n + (n + 1) = [n + 1]([n + 1] + 1)/ 2 i.e. 1 + 2 +···+ n + (n + 1) = (n + 1)(n + 2) /2

Add n + 1 both sides to equation (i), we get,

1 + 2 +···+ n + (n + 1) = n(n + 1)/ 2 + (n + 1) = n(n + 1) /2 + 2(n + 1) /2 = (n + 2)(n + 1) /2

**Direct Proof –**

when we want to prove a conditional statement p implies q, we assume that p is true, and follow implications to get to show that q is then true.

It is Mostly an application of hypothetical syllogism, [(p → r) ∧ (r → q)] → (p → q)]

We just have to find the propositions that lead us to q.**Theorem:**If m is even and n is odd, then their sum is odd

**Proof:**

Since m is even, there is an integer j such that m = 2j.

Since n is odd, there is an integer k such that n = 2k+1. Then,m+n = (2j)+(2k+1) = 2(j+k)+1

Since j+k is an integer, we see that m+n is odd.

Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the **CS Theory Course** at a student-friendly price and become industry ready.