"Deriving" the epsilon-delta definition The intuitive definition normally says that
The limit of $f(x)$ as $x \to c$ is $L$ iff $f(x)$ approaches $L$ as $x$ approaches $c$.
The obvious problem with this is that the words ''tends'', ''approach'' and ''near'' are not exact.
Look at the table showing an estimation method for finding the limit of $f(x)=x^2$ as $x \to 2$ (excel rounded some stuff)

It seems like $x^2$ is approaching 4. However, why shouldn't we say it is approaching 4.0000001.
If we tested values of $x$ between $2$ and $\sqrt{4.0000001}$, we would see that $f(x)<4.0000001$. Therefore $f(x)$ cannot be approaching it.
As a result I said that:

The limit of $f(x)$ as $x\to c$ is not $D$, if $x$ can be made to sit in an interval containing $c$, such that the image of that interval through $f$ does not include $D$

I just noticed that this is a flawed conclusion. Since $x \neq c$ ($x\to c$ means that $x$ cannot be at $c$), that means the image of an interval containing $c$ would not include $f(c)$, which for continuous functions is the limit
Based on this I thought a more formal way of defining a limit is:

If the limit of $f(x)$ as $x\to c$ is $L$, then $f(x)$ always sits in an interval containing $L$, no matter how close $x$ is to $c$

Lassadar has shown that this definition is false since ''an interval'' could be $(-\infty, \infty)$ which includes all $L\in \mathbb{R}$ and $f(x)$ so, by my definition, every number would pass as the limit
I just took the opposite of my earlier conclusion.
However, I am having trouble going from my definition to the true epsilon-delta definition of a limit.
Edit: How would you create a formal definition from the intuitive one like I've tried to do here?
 A: In Michael Spivak's Calculus, he gives a brilliant piece of exposition (pages 97-98) that guides the reader in how to turn the intuitive idea of a limit into a mathematically rigorous one. I will leave the exact quote here:
The time has now come to point out that of the many demonstrations about limits which we have given, not one has been a real proof. The fault lies not with our reasoning but with our definition. If our provisional definition of a function was open to criticism, our provisional definition of approaching a limit is even more vulnerable. This definition is not sufficiently precise to be used in proofs. It is hardly clear how one "makes" $f(x)$ close to $l$ (whatever "close" means) by "requiring" $x$ to be sufficiently closer to $a$ (however close "sufficiently" close is supposed to be). Despite the criticisms of our definition you may feel (I certainly hope you do) that our arguments were nevertheless quite convincing. In order to present any sort of argument at all, we have been practically forced to invent the real definition. It is possible to arrive at this definition in several steps, each one clarifying some obscure phrase which still remains. Let us begin, once again, with the provisional definition:

The function $f$ approaches the limit $l$ near $a$, if we can make $f(x)$ as close to $l$ as we like to $l$ by requiring that $x$ be sufficiently close to, but unequal to, $a$.

The very first change which we made in this definition was to note that making $f(x)$ close to $l$ meant making $|f(x)-l|$ small, and similarly for $x$ and $a$:

The function $f$ approaches the limit $l$ near $a$, if we can make $|f(x)-l|$ as small as we like by requiring that $|x-a|$ be sufficiently small, and $x\neq a$.

The second, more crucial, change change was to note that making $|f(x)-l|$ "as small as we like" means making $|f(x)-l|<\varepsilon$ for any $\varepsilon>0$ that happens to be given to us:

The function $f$ approaches the limit $l$ near $a$, if for every number $\varepsilon>0$ we can make $|f(x)-l|<\varepsilon$ by requiring that $|x-a|$ be sufficiently small, and $x\neq a$.

There is a common pattern to all of the demonstrations about limits which we have given. For each number $\varepsilon>0$ we found some other positive number, $\delta$ say, with the property that if $x\neq a$ and $|x-a|<\delta$, then $|f(x)-l|<\varepsilon$. For the function $f(x)=x\sin1/x$ (with $a=0$, $l=0$), the number $\delta$ was just the number $\varepsilon$; for $f(x)=\sqrt{|x|}\sin1/x$ it was $\varepsilon^2$; for $f(x)=x^2$ it was the minimum of $1$ and $\varepsilon/(2|a|+1)$. In general, it may not be at all clear how to find the number $\delta$, given $\varepsilon$, but it is the condition $|x-a|<\delta$ which expresses how small "sufficiently" small must be:

The function $f$ approaches the limit $l$ near $a$, if for every $\varepsilon>0$ there is some $\delta>0$ such that, for all $x$, if $|x-a|<\delta$ and $x\neq a$, then $|f(x)-l|<\varepsilon$.

This is practically the definition that we will adopt. We will make one trivial change, noting that "$|x-a|<\delta$ and $x\neq a$" can just as well be expressed $0<|x-a|<\delta$".

DEFINITION: The function $\pmb{f}$ approaches the limit $\pmb{l}$ near $\pmb{a}$ means: for every $\varepsilon>0$ there is some $\delta>0$ such that, for all $x$, if $0<|x-a|<\delta$, then $|f(x)-l|<\varepsilon$.

A: Informally, $L$ is the limit if $f(x)$ remains close to $L$.
"Close" is not difficult, it actually means arbitrarily close, i.e. $|f(x)-L|<\epsilon$ for an arbitrary $\epsilon$.
The key point is "remains", which we interpret as "$f(x)$ is close for all $x$ in some neighborhood of $c$".
We don't want to specify this "some", to allow maximum freedom in the proofs. All that matters is that such a neighborhood exists. Now we have all ingredients: for any $\epsilon$, we can find a neighborhood of $c$ where $f(x)$ remains close to $L$:
$$\forall \epsilon>0:\exists \delta>0:|x-c|<\delta\implies|f(x)-L|<\epsilon.$$

We omitted two little technicalities:

*

*we don't want to take into account $f(c)$, so that a limit is defined even for a function that is discontinuous or undefined at $c$;


*we can only care about the values of $x$ in the domain of $f$, so undefined values of $f$ in the neighborhood of $x$ do not matter.
$$\forall \epsilon>0:\exists \delta>0:\color{green}{ 0<}|x-c|<\delta\color{green}{\land x\in\text{dom}(f)}\implies|f(x)-L|<\epsilon.$$
