Is there such a thing as proof by example (not counter example)

In mathematics, "it probably works" is never a good reason to think something has been proven. There are certain patterns that hold for a large amount of small numbers - most of the numbers one would test - and then break after some obscenely large $M$ (see here for an example). If some equation or statement doesn't hold in general but holds for certain values, then yes, there will be constraints, but those constraints might be very hard or even impossible to quantify: say an equation holds for all composite numbers, but fails for all primes. Since we don't know a formula for the $n$th prime number, it would be very hard to test your "path" to see where this failed.

However, there is such a thing as a proof by example. We often want to show two structures, say $G$ and $H$, to be the same in some mathematical sense: for example, we might want to show $G$ and $H$ are isomorphic as groups. Then it would suffice to find an isomorphism between them! In general, if you want to show something exists, you can prove it by finding it!

But again, if you want to show something is true for all elements of a given set (say, you want to show $f(x) = g(x)$ for all $x\in\Bbb{R}$), then you have to employ a more general argument: no amount of case testing will prove your claim (unless you can actually test all the elements of the set explicitly: for example when the set is finite, or when you can apply mathematical induction).


Yes. As pointed out in the comments by CEdgar:

Theorem: There exists an odd prime number. Proof: 17 is an odd prime number.

Incidently, this is also a proof by example that there are proofs by example.


Whether a statement can be proved by example depends on the logical form of the statement.

If the statement is of the form "there exists an $X$ such that ..." then you can prove the statement by providing an example of such an $X$. For example, I can prove that the equation $2x=6$ has a solution over $\mathbb{N}$ by proving that $3$ is a solution. There are other possible proof methods for proving existential theorems, as well, such as proof by contradiction.

The claim than an equation is always correct is not an existential statement, however: it is a universal statement ("for every $z$ in the domain of the equation, the equation holds"). Statements of that form cannot, in general, be proved by presenting examples. In some special cases, though, they can.

For example, if $p(x)$ and $q(x)$ are two polynomial functions of degree $n$ over a field, to prove they are the same function it is sufficient to find $n+1$ points where they are equal. Notice that to use this method we first had to prove a general theorem that two degree $n$ polynomials that agree at $n+1$ points are equal. This is an example of the informal principle of "conservation of difficulty": if a result is made substantially easier to prove through a certain lemma, the proof of the lemma is typically of comparable difficulty to the original result.

Most mathematical theorems are neither existential nor purely universal; they are of the general form "for every $X$ with certain properties, there is a $Y$ with certain properties". For example, the fundamental theorem of algebra says that for every polynomial with complex coefficients there exists a complex number that is a root of the polynomial. Theorems of this form also cannot be proved, in general, by giving examples.