Mathematical induction
Mathematical induction is a method of mathematical proof typically used to establish that a given statement is true of all natural numbers.  It is done by proving that the first statement in the infinite sequence of statements is true, and then proving that if any one statement in the infinite sequence of statements is true, then so is the next one.
The method can be extended to prove statements about more general well-founded structures, such as trees; this generalization, known as structural induction, is used in mathematical logic and computer science.
Mathematical induction should not be misconstrued as a form of inductive reasoning, which is considered non-rigorous in mathematics (see Problem of induction for more information). In fact, mathematical induction is a form of deductive reasoning and is fully rigorous.

# History
The earliest implicit traces of mathematical induction can be found in Euclid's proof that the number of primes is infinite and in Bhaskara's "cyclic method".
The earliest implicit proof by mathematical induction for arithmetic sequences was introduced in the al-Fakhri written by al-Karaji around 1000 AD, who used it to prove the binomial theorem, Pascal's triangle, and the sum formula for integral cubes.
His proof was the first to make use of the two basic components of an inductive proof, "namely the truth of the statement for n = 1 (1 = 13) and the deriving of the truth for n = k from that of n = k  1. Of course, this second component is not explicit since, in some sense, al-Karaji's argument is in reverse; this is, he starts from n = 10 and goes down to 1 rather than proceeding upward." Shortly afterwards, Ibn al-Haytham (Alhazen) used the inductive method to prove the sum of fourth powers, and by extension, the sum of any integral powers. He only stated it for particular integers, but his proof for those integers was by induction and generalizable. Ibn Yahya al-Maghribi al-Samaw'al came closest to a modern proof by mathematical induction in pre-modern times, which he used to extend the proof of the binomial theorem and Pascal's triangle previously given by al-Karaji. Al-Samaw'al's inductive argument was only a short step from the full inductive proof of the general binomial theorem.
None of these ancient mathematicians, however, explicitly stated the inductive hypothesis. The first rigorous explicit exposition of the principle of induction was given by Francesco Maurolico, in his Arithmeticorum libri duo (1575), who used the technique to prove that the sum of the first n odd integers is n2. The inductive hypothesis was also discovered independently by the Swiss Jakob Bernoulli, and the Frenchmen Pascal and Fermat.

# Description
The simplest and most common form of mathematical induction proves that a statement involving a natural number n holds for all values of n. The proof consists of two steps:
- The basis (base case): showing that the statement holds when n = 0.
- The inductive step: showing that if the statement holds for some n, then the statement also holds when n + 1 is substituted for n.
The assumption in the inductive step that the statement holds for some n is called the induction hypothesis (or inductive hypothesis). To perform the inductive step, one assumes the induction hypothesis and then uses this assumption to prove the statement for n + 1.
The description above of the basis applies when 0 is considered a natural number, as is common in the fields of combinatorics and mathematical logic. If, on the other hand, 1 is taken to be the first natural number, then the base case is given by n = 1.
This method works by first proving the statement is true for a starting value, and then proving that the process used to go from one value to the next is valid. If these are both proven, then any value can be obtained by performing the process repeatedly. It may be helpful to think of the domino effect; if one is presented with a long row of dominoes standing on end, one can be sure that:
- The first domino will fall
- Whenever a domino falls, its next neighbor will also fall,
so it is concluded that all of the dominoes will fall, and that this fact is inevitable.
Another analogy can be to consider an infinite set of identical lily pads, all equally spaced on a pond. If a frog wishes to traverse the pond, he must:
- Determine if the first lily pad will hold his weight.
- Prove that he can jump from one lily pad to another.
Thus, he can conclude that he can jump to all of the lily pads.

# Axiom of induction
The basic assumption or axiom of induction (accepted not proved) is, in logical symbols,
where P is the proposition in question and n is a natural number.
In other words, P(0) being true along with ("P(k) is true implies P(k+1) is true" for all natural k) being true together imply that P(n) is true for all natural n. A proof by induction is then a proof that these two conditions hold, thus implying the required conclusion.

# Examples
Suppose we wish to prove that the statement:
holds for all natural numbers n. Call this statement P(n). It gives a formula for the sum of the positive natural numbers less than or equal to number n. The proof that the statement is true for all natural numbers n proceeds as follows.
Check if it is true for n = 1.  The sum of 1 and no other number is simply 1. And 1(1 + 1) / 2 = 1. So the statement is true for n = 1. Thus we have that P(1) holds.
Now we have to show that if the statement holds when n = m, then it also holds when n = m + 1. This can be done as follows.
Assume the statement is true for n = m, i.e.,
Adding m + 1 (which is clearly the left-hand side's next term) to both sides does not change the equality:
1 + 2 + \cdots + m + (m + 1) = \frac{m(m + 1)}{2} + (m+ 1)
By algebraic manipulation we have for the right-hand side
= \frac{m(m + 1)}{2} + \frac{2(m + 1)}{2}
= \frac{(m + 2)(m + 1)}{2}
= \frac{(m + 1)(m + 2)}{2}
= \frac{(m + 1)}{2}.
Thus we have
Notice that this is equivalent to the assertion made by P(m + 1). This proof is conditional: we made the assumption that P(m) is true, and from that we derived P(m + 1). Thus, if P(m) is true, P(m + 1) must also be true. Symbolically, we have shown that
Now, to finish, we use the process of mathematical induction:
- We know P(1) is true by substituting in 1 for n.
- Since P(1) implies P(1 + 1), we get P(2).
- Similarly, since P(2) implies P(2 + 1), we get P(3).
- With P(3), P(4) follows.
- From P(4), we get P(5).
- Etc. (Here is where the axiom of mathematical induction comes in.)
- We may conclude that P(n) holds for any natural number n. Q.E.D.
A further, more elaborate example is the proof of the inequality of the arithmetic and geometric means by induction.

# Variants
In practice, proofs by induction are often structured differently, depending on the exact nature of the property to be proved.

## Starting at some other number
If we want to prove a statement not for all natural numbers but only for all numbers greater than or equal to a certain number b then:
- Showing that the statement holds when n = b.
- Showing that if the statement holds for n = m  b then the same statement also holds for n = m + 1.
This can be used, for example, to show that n2 > 2n for n  3.  A more substantial example is a proof that
In this way we can prove that P(n) holds for all n 1, or even n 5.  This form of mathematical induction is actually a special case of the previous form because if the statement that we intend to prove is P(n) then proving it with these two rules is equivalent with proving P(n + b) for all natural numbers n with the first two steps.

## Building on n = 2
In mathematics, many standard functions, including operations such as "+" and relations such as "=", are binary, meaning that they take two arguments. Often these functions possess properties that implicitly extend them to more than two arguments. For example, once addition a + b is defined and is known to satisfy the associativity property (a + b) + c = a + (b + c), then the trinary addition a + b + c makes sense, either as (a + b) + c or as a + (b + c). Similarly, many axioms and theorems in mathematics are stated only for the binary versions of mathematical operations and relations, and implicitly extend to higher-arity versions.
Suppose that we wish to prove a statement about an n-ary operation implicitly defined from a binary operation, using mathematical induction on n. Then it should come as no surprise that the n = 2 case carries special weight. Here are some examples.

### Example: product rule for the derivative
In this example, the binary operation in question is multiplication (of functions). The usual product rule for the derivative taught in calculus states:
This can be generalized to a product of n functions. One has
- (f_1 f_2' f_3 \cdots  f_n)
- (f_1 f_2 f_3'\cdots  f_n)+\cdots +(f_1 f_2 \cdots f_{n-1} f_n').
In each of the n terms, just one of the factors is a derivative; the others are not.
When this general fact is proved by mathematical induction, the n = 0 case is trivial,(1)' = 0 \! (since the empty product is 1, and the empty sum is 0). The n = 1 case is also trivial, f_1' = f_1' \!. And for each n  3, the case is easy to prove from the preceding n  1 case. The real difficulty lies in the n = 2 case, which is why that is the one stated in the standard product rule.

### Example: Polya's proof that there is no "horse of a different color"
In this example, the binary relation in question is an equivalence relation applied to horses, such that two horses are equivalent if they are the same color. The argument is essentially identical to the one above, but the crucial n = 2 case fails, causing the entire argument to be invalid.
In the middle of the 20th century, a commonplace colloquial locution to express the idea that something is unexpectedly different from the usual was "That's a horse of a different color!".  George Polya posed the following exercise: Find the error in the following argument, which purports to prove by mathematical induction that all horses are of the same color:
- Basis: If there is only one horse, there is only one color.
- Induction step: Assume as induction hypothesis that within any set of n horses, there is only one color.  Now look at any set of n + 1 horses.  Number them: 1, 2, 3, ..., n, n + 1.  Consider the sets {1, 2, 3, ..., n} and {2, 3, 4, ..., n + 1}.  Each is a set of only n horses, therefore within each there is only one color.  But the two sets overlap, so there must be only one color among all n + 1 horses.
Beginning the induction at 1, the n = 1 case is trivial (any horse is the same color as itself), and the inductive step is correct in all cases n  3. However, the logic of the inductive step is incorrect when n = 2, because the statement that "the two sets overlap" is false. Indeed, the n = 2 case is clearly the crux of the matter; if one could prove the n = 2 case, then all higher cases would follow from the transitive property of the equivalence relation.

## Induction on more than one counter
It is sometimes desirable to prove a statement involving two natural numbers, n and m, by iterating the induction process. That is, one performs a basis step and an inductive step for n, and in each of those performs a basis step and an inductive step for m. See, for example, the proof of commutativity accompanying addition of natural numbers. More complicated arguments involving three or more counters are also possible.

## Infinite descent
Another variant of mathematical induction  the method of infinite descent  was one of Pierre de Fermat's favorites. This method of proof works in reverse, and can assume several slightly different forms. For example, it might begin by showing that if a statement is true for a natural number n it must also be true for some smaller natural number m (m < n). Using mathematical induction (implicitly) with the inductive hypothesis being that the statement is false for all natural numbers less than or equal to m, we can conclude that the statement cannot be true for any natural number n.

# Complete induction
Another generalization, called complete induction (or strong induction or course of values induction), says that in the second step we may assume not only that the statement holds for n = m but also that it is true for n less than or equal to m.
In complete induction it is not necessary to list the basis case as a separate assumption.  When considering the first case, it is vacuously true that the statement holds for all previous cases; the inductive step of complete induction in this situation corresponds to the basis case in ordinary induction.  Thus the proof then of the inductive step in complete induction needs to be able to work with an empty antecedent; the first proof above is not of this kind (but can be converted).
Complete induction is most useful when several instances of the inductive hypothesis are required for each inductive step.  For example, complete induction can be used to show that
where fib(n) is the nth Fibonacci number and \varphi = (1 + \sqrt{5})/2 is the golden ratio. By using the definition fib(m + 1) = fib(m) + fib(m  1), the identity above can be verified by direct calculation for fib(m + 1) if we assume that it already holds for both fib(m) and fib(m  1). To complete the proof, the identity must be verified in the two basis cases n = 0 and n = 1.
Another proof by complete induction uses the hypothesis that the statement holds for all smaller n more thoroughly.  Consider the statement that "every natural number greater than 1 is a product of prime numbers", and assume that for a given m > 1 it holds for all smaller n > 1.  If m is prime then it is certainly a product of primes, and if not, then by definition it is a product: m = n1 n2, where neither of the factors is equal to 1; hence neither is equal to m, and so both are smaller than m.  The induction hypothesis now applies to n1 and n2, so each one is a product of primes.  Then m is a product of products of primes; i.e. a product of primes.  Note both that the base case (m equal to 2) was never explicitly considered, and that the hypothesis that all smaller numbers than m are products of primes was used, since the factors of m are a priori unknown.
This generalization, complete induction, can be derived from the ordinary mathematical induction described above. Suppose P(n) is the statement that we intend to prove by complete induction. Let Q(n) mean P(m) holds for all m such that 0  m  n. Apply mathematical induction to Q(n). Since Q(0) is just P(0), we have the base case. Now suppose Q(n) is given and we wish to show Q(n+1). Notice that Q(n) is the same as P(0) and P(1) and ... and P(n). The hypothesis of complete induction tells us that this implies P(n+1). If we add P(n+1) to Q(n), we get P(0) and P(1) and  ... and P(n) and P(n+1), which is just Q(n+1). So using mathematical induction, we get that Q(n) holds for all natural numbers n. But Q(n) implies P(n), so we have the conclusion of strong induction, namely that P(n) holds for all natural numbers n.

## Transfinite induction
The last two steps can be reformulated as one step:
- Showing that if the statement holds for all n < m then the same statement also holds for n = m.
This is in fact the most general form of mathematical induction and it can be shown that it is not only valid for statements about natural numbers, but for statements about elements of any well-founded set, that is, a set with a partial order that contains no infinite descending chains (where < is defined such that a < b means that a  b and a = b).
This form of induction, when applied to ordinals (which form a well-ordered and hence well-founded class), is called transfinite induction. It is an important proof technique in set theory, topology and other fields.
Proofs by transfinite induction typically distinguish three cases:
- when m is a minimal element, i.e. there is no element smaller than m
- when m has a direct predecessor, i.e. the set of elements which are smaller than m has a largest element
- when m has no direct predecessor, i.e. m is a so-called limit-ordinal
Strictly speaking, it is not necessary in transfinite induction to prove the basis, because it is a vacuous special case of the proposition that if P is true of all n < m, then P is true of m.  It is vacuously true precisely because there are no values of n < m that could serve as counterexamples.

# Proof or reformulation of mathematical induction
The principle of mathematical induction is usually stated as an axiom of the natural numbers; see Peano axioms.  However, it can be proved in some logical systems. For instance, it can be proved if one assumes:
- The set of natural numbers is well-ordered.
- Every natural number is either zero, or n+1 for some natural number n.
- For any natural number n, n+1 is greater than n.
To derive simple induction from these axioms, we must show that if P(n) is some proposition predicated of n, and if:
- P(0) holds and
- whenever P(k) is true then P(k+1) is also true
then P(n) holds for all n.
We first show that if P(k) is true for all k < m, then P(m) is also true.  If m is zero, then P(m) is true. If m = k + 1, then P(k) is true because k < m and so P(k+1) is true which means that P(m) is true. The rest follows from applying the principle transfinite induction (see below).

## Generalization
Transfinite induction: Given a well-ordered set, W, and a proposition, P, such that whenever m is such that P(k) is true for all k < m, then P(m) is also true. We can show that P(n) is true for all n. Let S be the subset of W for which P(n) is false. We first show that S has no minimal element. Consider any element m. Either P(k) is true for every k < m or there is a k < m such that P(k) is false. In the first case, P(m) must be true and m does not belong to S and so m is not the least element of S. In the second case, P(k) is false for some k < m and so k is in S and smaller than m. Thus, m cannot be the least element of S. Now if S has no minimal element and is a subset of a well-ordered set, then S must be empty and so P(n) must be true for all n.