Proof by contradiction with example

Proof by contradiction is a common method in mathematics to prove a statement by assuming the opposite and showing that it leads to a contradiction. Here is an example of a proof by contradiction:

Statement to prove: There are infinitely many prime numbers.

Proof: Assume for the sake of contradiction that there are only finitely many prime numbers, say p1, p2, ..., pn. Let N = p1 * p2 * ... * pn + 1. N is a positive integer and is not divisible by any of the primes p1, p2, ..., pn, since N leaves a remainder of 1 when divided by any of them.

Now, either N is a prime number or it is not. If N is a prime number, then it is a prime number that is not among p1, p2, ..., pn, which contradicts the assumption that p1, p2, ..., pn are all the prime numbers.

On the other hand, if N is not a prime number, then it must have a prime factor. But this prime factor cannot be any of p1, p2, ..., pn, since we assumed that those are all the prime numbers. Therefore, N must have a prime factor that is different from p1, p2, ..., pn, which again contradicts the assumption that p1, p2, ..., pn are all the prime numbers.

In either case, we have arrived at a contradiction, and so the assumption that there are only finitely many prime numbers must be false. Therefore, there are infinitely many prime numbers.