Is it legal to substitute the limit variable in a question like this? The question: Find the derivative of $f(x) = x^{-1}$
You can write down the derivative (Using limits) as 
$\lim_{h\to 0} \frac{f(x+h)-f(x)}{h}$
$\lim_{h\to 0} \frac{(x+h)^{-1}-x^{-1}}{h}$
$\lim_{(x+h)\to x} \frac{(x+h)^{-1}-x^{-1}}{(x+h) - (x)}$
As you can see, i switch the variable in the limit above. Is that legal? What is the formula behind the switch? What are the formal requirements for it to be legal?
 A: You have the right idea, but the notation is not very good. What you can do it something that looks like substitution in integral computation: let $y = y(h) = x+h \iff h = y - x$, and now your expression becomes:
$$\lim_{h \to 0} \frac{f(x+h)-f(x)}{h} = \lim_{y \to x} \frac{f(y)-f(x)}{y-x},$$
and this is true.
Formally, how does that works? You're computing the limit of some function $g_1(h) = \frac{f(x+h)-f(x)}{h}$ with $h \to 0$. Let $\phi : \mathbb{R} \to \mathbb{R}$ be defined by $\phi(h) = x+h$. Then you can let $g_2(y) = \frac{f(y) - f(x)}{y - x}$, so that:
$$g_1(h) = g_2(\phi(h)).$$
It's obvious that $\lim_{h \to 0} \phi(h) = x$. So now, if $\lim_{y \to x} g_2(y) = l$ exists, then the theorem about limits and composition of functions* implies that:
$$\lim_{h \to 0} g_1(h) = \lim_{h \to 0} g_2(\phi(h)) = \lim_{y \to \lim_{h \to 0} \phi(h)} g_2(y) = \lim_{y \to x} g_2(y) = l.$$
Note that I used a theorem here, it's not something completely obvious. It's usually not very hard, but you need to check that all the hypotheses of the theorem are satisfied.

* The one that says that if $\lim_{x \to a} f(x) = b$ and $\lim_{y \to b} g(y) = c$, then $\lim_{x \to a} g(f(x)) = c$.
A: In that limit, the number $x$ is fixed, the number $h$ is variable. So it's somewhat strange to write ${(x+h)\to x} $ but it makes sense and even it's equivalent to ${h \to 0} $ in your case (since the number $x$ is fixed here). I mean this: since $x$ is fixed, obviously ${(x+h)\to x} $ if and only if ${h \to 0}$.    
A: Yes, you can do that since the two statements are equivalent if $x$ is continuous. Consider a discontinuous function i.e.
$x = {1, \hspace{0.25cm} if \hspace{0.1cm} x \leq x^*}$
$\hspace{0.4cm} = {0, \hspace{0.25cm} if \hspace{0.1cm} x>x^*}$
In a case like this, such a substitution would be incorrect.
Please share if you have something different to say. :)
A: First question to ask is whether the writing $\lim_{x+h\to x}$ even makes sense according to the definition of limits. In this case it does. The second is if it's a valid transformation. Which it also does in this case.
You have to recall the definition of limits:

We say $\lim_{\xi\to a} \phi = L$ if for each $\epsilon > 0$ there's an $\delta > 0$ such that whenever $|\xi-a|<\delta$ we have $|\phi-L|<\epsilon$.

I intentionally left out the argument of $f$ as we shall see what happens if $x$ is not the argument of $f$. The thing here is that in the first cases we have $\xi$ being $h$, and $a$ being $0$ and in the last $\xi$ being $x+h$ and $a$ being $x$. In the definition that affects $|\xi-a|$ which would be $|h-0|=|h|$ in the first case and $|x+h-x|=|h|$ in the second. So it's seem to make sense and be correct.
Now for the problem of substitution in general. You simply have to make sure that the substitution behaves well enough. You first of course have to make sure that the substitution is bijective - otherwise you could miss out parts of the neighborhood of the target, but you also have to make sure it's continuous in both directions.
