This question is inspired by my answer to this one: Surprising identities / equations
In that question, people were asked about the most surprising result that they knew. Almost all of them quoted someone else's result.
I was one of the only ones to reply about a result of mine that greatly surprised me.
So, I have decided to make that a question on its own:
What is your own mathematical result that surprised you the most?
Here is mine.
Consider the diophantine equation $$x(x+1)...(x+n-1) -y^n = k$$
where $x, y, n,$ and $k$ are integers, $x \ge 1$, $y \ge 1$, and $n \ge 3$.
I was led to consider considering this by trying to generalize the Erdos-Selfridge result that the product of consecutive integers could never be a power.
I phrased this as "How close and how often can the product of $n$ consecutive integers be to an $n$-th power?"
Looking at this equation, it seemed reasonable to think that, for fixed $k$ and $n$, there were only a finite number of $x$ and $y$ that satisfied it. This was not too hard to prove.
What greatly surprised me was that I was able to prove that for any fixed $k$, there were only a finite number of $n$, $x$, and $y$ that satisfied it.
The proof went like this:
I first showed that any solution must have $y \le |k|$. This was moderately straightforward, and involved considering the three cases $y < x$, $x \le y \le x+n-1$, and $y \ge x+n$.
Note: The proof that $y \le |k|$ has been added at the end.
The next step really surprised me. I showed that $n < e|k|$, where $e$ is the good old base of natural logarithms.
The proof was amazingly (to me) simple. Since $y \le |k|$ and $2(n/e)^n < n!$,
$\begin{align} 2(n/e)^n &< n!\\ &\le x(x+1)...(x+n-1)\\ &= y^n+k\\ &\le |k|^n+|k|\\ &\le |k|^n+|k|^n\\ &= 2|k|^n\\ \end{align} $
so $n < e |k|$.
I still remember staring at this in disbelief, over forty years later.
I was asked to show my proof that $y \le |k|$.
For brevity, I will write $x(x+1)...(x+n-1)$ as $x!n$, because this is a generalization of factorial.
The basic inequality is $$(x^2+(n-1)x)^{n/2} \le x!n \le (x+(n-1)/2)^n$$
I also use two lemmas:
(L1) If $0 < a < b$ and $n > 1$ then $n(b-a)a^{n-1} < b^n-a^n < n(b-a)b^{n-1}$.
(L2) If $a^m \leq b^m+c$ where $a \geq 0$, $b >0$, $c \geq 0$, and $m \geq 1$, then $a \leq b + c/(m\,b^{m-1})$.
The basic idea is simple: either $x < y < x+n-1$ or $y$ is outside this range. If $y$ is inside the range, then $y$ divides both $x!n$ and $y^n$, so $y$ divides their difference, which is $k$. If $y$ is outside the range, then we can use the basic inequality and the lemmas to derive very strong inequalities on $x$ and $y$.
Here are all the cases.
If $k=0$, so $x!n = y^n$, then $x < y < x+n-1$, or $x+1 < y+1 \leq x+n-1$, so that $y+1 | x!n$ or $y+1 | y^n$, which is impossible.
If $k > 0$, $x!n > y^n$, so that, $y < x+(n-1)/2$.
If $ y > x$, then, as stated above, $y | k$.
If $y \leq x$, then $(x^2 + (n-1)x)^{n/2} \le x!n = y^n + k \le x^n + k $ or, by L2, $x^2 + (n-1)x \le x^2 + 2k/\left(n\,x^{n-2}\right) $ so that $ x^{n-1} \leq 2k/n(n-1). $
Therefore $y \le x \le \left(\frac{2k}{n(n-1)}\right)^{1/(n-1)}$.
If $k < 0$, $x!n < y^n$, so that, $y^2 > x^2+(n-1)x$, which implies that $y > x$.
If $ y < x+n-1$, then, as stated above, $y | |k|$.
If $y \geq x+n-1$, then
$(x+n-1)^n \leq y^n = x!n - k = x!n + |k| \leq (x+(n-1)/2)^n + |k| $ or, by L2, $x+n-1 \leq x+(n-1)/2 + \frac{|k|}{ n(x+(n-1)/2)^{n-1} }$ or $(n-1)/2 \leq \frac{|k|} { n(x+(n-1)/2)^{n-1}} $ so that $\left(x+(n-1)/2\right)^{n-1} \leq \frac{2|k|}{n(n-1)}. $
Since $y^n \leq (x + (n-1)/2))^n + |k| \leq \left(\frac{2|k|}{n(n-1)}\right)^{n/(n-1)} + |k| \leq |k|^{n/(n-1)} + |k|, $ $ y \leq |k|^{1/(n-1)} + 1/n.$
In all the cases, $y \le |k|$. When $y < x$ or $y \ge x+n-1$, $y$ is significantly smaller.
This was the most surprising to me, I suppose, because it was one of my first:
One day I considered the alternating harmonic series, and realized that if you replace the $-1$ with the imaginary unit, $i$, then the resulting series still converges. (This can be shown in several ways.)
I asked a professor whether this was true for any root of unity, and we quickly decided not only that it is, but that this is true using any complex number $z \neq 1$ such that $|z| = 1$. This was via a hand-wavy geometric argument, but it subsequently became clear to me that this result is known and easily proved with the Dirichlet Convergence Test.
Years later, I posted on MO to ask about a rigorous geometric proof for the general case, and someone nicely provided one. But: It was pretty cool to think it up the first time, especially since it is tough to guess at a first glance that the harmonic series diverges; turns out any fixed wobble (rotation) after each step would, indeed, give convergence.
Edit: On second thought, I once explored the following problem: Suppose a bag contains $m$ black marbles, $n$ white marbles, and $m \leq n$. Remove a marble, note its color, and put it back in the bag. What is the chance that the total number of black marbles counted - at some point - exceeds the total number of white marbles counted at that same point?
I figured this would be a tractable problem, and maybe even that it would always be $1$, i.e., at some point there would be enough black marbles picked in a row to exceed the number of white ones picked. However, this did not turn out to be the case, though there ends up being a very simple formula: $m/n$. (Surprise!)
Of course, this number syncs up with a few reality checks (e.g., when we have $m = n$). I should also note that there are surprising ways of tackling this problem: Random walks, Catalan numbers, recurrence relations, and the Gambler's Ruin can each be used to provide "different" proofs that the formula provided above holds.