The proofs of limit laws and derivative rules appear to tacitly assume that the limit exists in the first place Say I was trying to find the derivative of $x^2$ using differentiation from first principles. The usual argument would go something like this:

If $f(x)=x^2$, then \begin{align} f'(x) &= \lim_{h \to
0}\frac{(x+h)^2-x^2}{h} \\ &= \lim_{h \to 0}\frac{2hx+h^2}{h} \\
&= \lim_{h \to 0} 2x+h \end{align} As $h$ approaches $0$, $2x+h$
approaches $2x$, so $f'(x)=2x$.

Throughout this argument, I assumed that
$$
\lim_{h \to 0}\frac{f(x+h)-f(x)}{h}
$$
was actually a meaningful object—that the limit actually existed. I don't really understand what justifies this assumption. To me, sometimes the assumption that an object is well-defined can lead you to draw incorrect conclusions. For example, assuming that $\log(0)$ makes any sense, we can conclude that
$$
\log(0)=\log(0)+\log(0) \implies \log(0)=0 \, .
$$
So the assumption that $\log(0)$ represented anything meaningful led us to incorrectly conclude that it was equal to $0$. Often, to prove that a limit exists, we manipulate it until we can write it in a familiar form. This can be seen in the proofs of the chain rule and product rule. But it often seems that that manipulation can only be justified if we know the limit exists in the first place! So what is really going on here?

For another example, the chain rule is often stated as:

Suppose that $g$ is differentiable at $x$, and $f$ is differentiable at $g(x)$. Then, $(f \circ g)$ is differentiable at $x$, and
$$
(f \circ g)'(x) = f'(g(x))g'(x)
$$

If the proof that $(f \circ g)$ is differentiable at $x$ simply amounts to computing the derivative using the limit definition, then again I feel unsatisfied. Doesn't this computation again make the assumption that $(f \circ g)'(x)$ makes sense in the first place?
 A: The other answers are perfectly fine; just a perspective that can save your day in situations in which the existence of the limit is actually a critical point.
The crucial definition is the one of limsup and liminf: these are always well defined, and all you have to know at the moment are the following two properties:

*

*$\liminf_{x \to x_0} f(x) \le \limsup_{x\to x_0} f(x) $

*The limit of $f$ exist if and only if $\liminf_{x \to x_0} f(x) = \limsup_{x\to x_0} f(x) $, and in this case the limit agree with this value.

Now imagine you do your computation twice: firstly, you compute the liminf; then you compute the limsup. In both computations, as soon as you arrive to something that actually has limit (like $2x+h$), because of property (2) you can forget about the inf/sup story and just compute the limit.
Since with some manipulations you arrive to something that actually has limit, both calculations will give the same result and, because of property (2) again, the limit exist and coincide with the value you just computed.
Now this is not really the thing you should do if you are doing introductory analysis and you don't know liminf and limsup: formal properties of these two are slightly different from the formal properties of lim, and you could end up with an error. But as long as you don't "touch" the limit, and you just make some manipulation inside theimit, the same argument will carry on: if you end up with a well defined result, it is the limit :)
A: What we have here should really be interpreted as multiple statements:
(1.) If $ \lim_{h \to 0} \frac{2hx + h^2}{h} $ exists then
$ \lim_{h \to 0} \frac{(x+h)^2 - x^2}{h}$ exists and is equal to $\lim_{h \to 0} \frac{2hx + h^2}{h} $.
(2.) If $ \lim_{h \to 0} [2x + h] $ exists then
$ \lim_{h \to 0} \frac{2hx + h^2}{h}$ exists and is equal to  $\lim_{h \to 0} [2x + h]$.
(3.) If $ \lim_{h \to 0} 2x$ exists then $ \lim_{h \to 0} [2x + h]$ exists and is equal to $ \lim_{h \to 0} 2x$.
(4.) $ \lim_{h \to 0} 2x$ exists and is equal to $ 2x $.
Note that once we have (4.) the "if" (conditional) part of (3.) is satisfied and so on all the way up to (1.). You can see that assuming that the limit exists in statements 1 to 3 is not a problem because you haven't used used that assumption to prove that it actually does. That would be circular logic and no good.
Your log example is different to this in the way that you don't have a statement that takes the role of statement (4.) above, which would allow you to escape the conditional. You have only proven that $\log(0) = 0$ IF $\log(0)$ exists, not that $\log(0)$ exists! This in itself is not an incorrect conclusion.
A: If you want to be more precise you could write:
  $f'(x) = \lim_{h→0} \frac{(x+h)^2-x^2}{h}$ if the limit exists
    $= \lim_{h→0} (2x+h)$ if the limit exists
    $= 2x$.
Meaning that each line only holds "if the limit exists". But we do not have to actually bother to do so in most cases for two reasons:

*

*It is usually easy enough to mentally add such conditions and check that we did not at any point rely on the existence of the limit.


*If we allow expressions to attain an "undefined value", and define that every expression with an "undefined" subexpression is itself undefined, then we do not even have to write the condition "if the limit exists"! If the limit is not defined, then the "$\lim \cdots$" expression would simply have value "undefined", which will not lead to any incorrect conclusions.
A: You're correct that it doesn't really make sense to write $\lim\limits_{h\to 0}\frac{f(x+h)-f(x)}{h}$ unless we already know the limit exists, but it's really just a grammar issue. To be precise, you could first say that the difference quotient can be re-written $\frac{f(x+h)-f(x)}{h}=2x+h$, and then use the fact that $\lim\limits_{h\to 0}x=x$ and $\lim\limits_{h\to 0}h=0$ as well as the constant-multiple law and the sum law for limits.
Adding to the last sentence: most of the familiar properties of limits are written "backwards" like this. I.e., the "limit sum law" says
$$\lim\limits_{x\to c}(f(x)+g(x))=\lim\limits_{x\to c}f(x)+\lim\limits_{x\to c}g(x)$$
as long as $\lim\limits_{x\to c}f(x)$ and $\lim\limits_{x\to c}g(x)$ exist. Of course, if they don't exist, then the equation we just wrote is meaningless, so really we should begin with that assertion.
In practice, one can usually be a bit casual here, if for no other reason than to save word count. In an intro analysis class, though, you would probably want to be as careful as you reasonably can.
A: Proposition: Let $c \in \mathbb{R}$. Suppose $f$ and $g$ are defined and equal to each other on some punctured open ball $(c - \delta) \cup (c + \delta)$ of $c$, where $\delta > 0$. Then $\lim_{x \to c} f(x)$ exists if and only if $\lim_{x \to c} g(x)$ exists. And if either limit exists, so does the other, and they are both equal.
Sketch of proof: Observe that the definition of limit at a point $c$ concerns itself only with points close to $c$ but not equal to $c$. So whatever the value of $f$ or $g$ at $c$, or for that matter whether or not they are defined there, does not matter. Since $f$ and $g$ are equal at points close to $c$ but not equal to $c$, our limit statement about either function at $c$ must therefore also hold for the other. $\square$
This justifies the various limit calculations that we often do, such as the one you showed. In fact, let us go through your example step by step.

If $f(x)=x^2$, then \begin{align} f'(x) &= \lim_{h \to
0}\frac{(x+h)^2-x^2}{h} \\ &= \lim_{h \to 0}\frac{2hx+h^2}{h} \\
&= \lim_{h \to 0} 2x+h \end{align} As $h$ approaches $0$, $2x+h$
approaches $2x$, so $f'(x)=2x$.

What do these sequences of calculations really mean or imply? Well, in the final step/equality, we computed
$\displaystyle \lim_{h \to 0} 2x + h$, which we agree exists and equals to $2x$. Since the function $\displaystyle \frac{2hx + h^2}{h}$ equals $2x + h$ in some punctured neighborhood of $0$, we can now use the proposition to conclude that $\displaystyle \lim_{h \to 0} \frac{2hx + h^2}{h}$ equals $\displaystyle \lim_{h \to 0} 2x + h$, which equals $2x$. So going from line (3) to line (2) is justified. Next, the function $\displaystyle \frac{(x+h)^2 - x^2}{h}$ equals $\displaystyle \frac{2hx + h^2}{h}$ in some punctured neighborhood of $0$, so again we can use the proposition to justify going from line (2) to line (1).
So we have sort of reasoned backwards, but practically speaking this is not necessary in ordinary limit calculations. Our reasoning also "works" even when the limit does not exist. If at the end we arrive at a limit that exists, then necessarily we can work backwards and guarantee that the initial first limit exists; and if at the end we arrive at a limit that does not exist, then necessarily the initial first limit cannot exist, otherwise we could go down the series of equivalences guaranteed by the proposition to guarantee that the final limit exists.
So in all cases things "work out fine". The important thing to note is simply that we have certain logical equivalences at each step: the limit exists at some step if and only if it exists at any earlier or later step.
A: The derivative does not exist unless the limit of the difference quotient exists.
The "limit law" that says the limit of a sum of two functions is equal to the sum of the two separate limits is not applicable unless the two separate limits exist. Notice that

*

*There are no cases where the two separate limits exist and the limit of the sum does not. If the two separate limits exist, then so does the limit of the sum.


*However, there are cases in which the two separate limits do not exist and the limit of the sum does. A similar situation applying to products rather than sums arose in something I posted here recently (I can't find it right now). For one of the two factors the limit did not exist, but the function was bounded and therefore the limit of the product could be found by squeezing.
A: No property of the limit was used in the first argument before the last step so actually what we have done inside the limit is just rewriting and when we reach the last step we can show the existence using the epsilon-delta definition which apparently deals with the existence issue , same thing applies to the chain rule thing since every thing in the proof before the last steps is just rewriting and the final steps which use the properties of limits which is justified since the epsilon delta definition deals with the existence issue, hope this helps
A: The issue largely vanishes if we just consider $\lim$ and $\log$ explicitly as partial functions. A partial function can be seen as a function whose codomain contains one extra (distinguishable!) element, basically the “error value”.
$$\begin{align}
   \log :&& \mathbb{R} \not\to \mathbb{R}
\\ \lim_0 :&& ((\mathbb{R}\setminus\{0\})\to\mathbb{R}) \not\to \mathbb{R}
\end{align}$$
where we have for example
$$\begin{align}
   \log(1) =& \text{OK}(0)
\\ \log(0) =& \text{ERR}
\\ \lim_0( h\mapsto \tfrac{\sin h}{h}) =& \text{OK}(1)
\\ \lim_0( h\mapsto \tfrac1{h}) =& \text{ERR}
\end{align}$$
Now, the logarithm law
$$
  \log(a\cdot b) = \log a + \log b
$$
is to be understood with a “lifted” $+$ operator, that just passes failure on either side on. But that means that for this operator, we can't infer from $p+q=p$ that $q=0$, because $\text{ERR}+q$ is always $\text{ERR}$ regardless! Instead, only from $\text{OK}(p)+q = \text{OK}(p)$ we can infer $q = \text{OK}(0)$. Thus we don't get to the wrong conclusion about $\log(0)$, because that is not an $\text{OK}$ value.
Applied to the limits in the differentiation, we can immediately write
$$
  f'(x) = \lim_0\left(h\mapsto\frac{f(x+h)-f(x)}{h}\right)
$$
just noting that the result might be $\text{ERR}$. What we can also do without any problem is rewrite the expression inside the limit with anything that – as a function $h\mapsto\ldots$ – really is (extensionally) the same. This is in particular no problem for
$$\begin{align}
  f'(x) =& \lim_0\left(h\mapsto\frac{(x+h)^2-x^2}{h}\right)
\\ =& \lim_0\left(h\mapsto\frac{2\cdot h\cdot x+h^2}{h}\right)
\end{align}$$
because $h\mapsto\frac{(x+h)^2-x^2}{h}$ and $h\mapsto\frac{2\cdot h\cdot x+h^2}{h}$ really are the same for all $h\in\mathbb{R}$. Still, at this point we don't know if either of the limits actually exist – they might be both $\text{ERR}$, or both $\text{OK}$, but at any rate equal.
For the next step we need the fact that the limit considers its argument as only a function with nonzero numbers as the domain, because only considered as a function on that domain is $h\mapsto\frac{2\cdot h\cdot x+h^2}{h}$ the same function as $h\mapsto 2\cdot x+h$.
And that's it, at this point we can read off that the limit is indeed $\text{OK}(2\cdot x)$ and going back we see that the other limits must also have been $\text{OK}$ with that same value.
A: Note that $\dfrac{(x+h)^2-x^2}{h}$ is undefined at $h=0$ and that, when $h \ne 0$,
$$\dfrac{(x+h)^2-x^2}{h} = \frac{2hx+h^2}{h} = 2x+h$$
However, the function $:x \mapsto 2x+h$ is defined, continuous, and has a value of $2x$ at $h=0$.
We also need to use
$$\lim_{h \to 0}\frac{2hx+h^2}{h} 
= \lim_{h \to 0}\frac hh \; \lim_{h \to 0}\frac{2x+h}{1}
= \lim_{h \to 0} (2x+h) = 2x$$
The rest follows.
A: If we want to be absolutely clear, then the argument for the derivative should be the following: $\lim\limits_{h\to0}\frac{(x+h)^2-x^2}{h}$ and $\lim\limits_{h\to0}2x+h$ both exist and are equal if and only if at least one of them exists. Since $\lim\limits_{h\to0}2x+h$ does in fact exist and is $2x$, so too must the other limit (that's $\lim_{h\to0}\frac{(x+h)^2-x^2}{h}$) exist and be $2x$.
This does not work for your logarithm example: You can argue that $\log0$ and $\log0+\log0$ exist and are the same if at least one of the two exists. But neither exists, so the point is moot.
