What is wrong with this proof of chain rule? Let $U$ and $V$ be open subsets of $\mathbb{R}$. Let $f:U\rightarrow
V$ be differentiable at $x_0$ and $g:V\rightarrow\mathbb{R}$ be
  differentiable at $f(x_0)$. Then $g\circ f$ is differentiable at
  $x_0$.


What is wrong with the following "proof" of the above fact:

$$(g\circ f)'(x)=\lim_{x\rightarrow x_0} \Big(\frac{g(f(x))-g(f(x_0))}{f(x)-f(x_0)}\cdot \frac{f(x)-f(x_0)}{x-x_0}\Big)=$$ $$\lim_{x\rightarrow x_0} \frac{g(f(x))-g(f(x_0))}{f(x)-f(x_0)}\cdot \lim_{x\rightarrow x_0} \frac{f(x)-f(x_0)}{x-x_0}=g'(f(x_0))\cdot f'(x_0)$$
Just note that if $f$ is constant you cannot write 
  $$\frac{g(f(x))-g(f(x_{0}))}{f(x)-f(x_{0})}$$
  because it is not well defined.
First, you should read the "proof" from the back to the front because you do not know whether the first limit in your proof exists or not. By assumption (and the fact that $f$ is continuous at $x=x_0$) you know that the two limits in the second line exist. Therefore the limit in the first row exists.

Now, recall the definition of a limit: The limit is defined as: $\lim_{x\to a} f(x) = L$ if and only if for all sequences $(x_n)_{n\in \mathbb N}$, $x_n\neq a$ and $x_n\to a$, the sequence $f(x_n)$ converges to $L$ (https://en.wikipedia.org/wiki/Limit_of_a_function).

Therefore $f(x)-f(x_0) \neq 0$ for all sequences and for all $n$. Therefore you can simplify the expression in the first line and you are done. 

To wrap up, I would only change the order of your equations and start from the end. Then the proof should be fine.