Incorrect Chain Rule Proof

One simple way to fix the problem of "division by zero" when $g(x)-g(a)=0$ is to define the continuous function $$ \frac{\Delta f}{\Delta g}(x)= \begin{cases} f'(g(a))&\quad\text{if }g(x)-g(a)=0\\ \\ \dfrac{f(g(x))-f(g(a))}{g(x)-g(a)}&\quad\text{otherwise} \end{cases} $$ and confirm (think it through properly) that we have $$ \frac{f(g(x))-f(g(a))}{x-a}=\frac{g(x)-g(a)}{x-a}\cdot\frac{\Delta f}{\Delta g}(x) $$ both for values of $x$ where $g(x)-g(a)=0$ and other values of $x$. In the first case, both sides becomes zero, and in the second case we are basically considering the dangerous step $$ \frac{f(g(x))-f(g(a))}{x-a}=\frac{g(x)-g(a)}{x-a}\cdot\frac{f(g(x))-f(g(a))}{g(x)-g(a)} $$ which is now legitimate since $g(x)-g(a)\neq 0$. When taking limits, you will need the continuity of $\dfrac{\Delta f}{\Delta g}(x)$.


The problem is simply that if $g$ were constant in a neighborhood of $a$, then $g(x)-g(a)=0$ when $x$ is close to $a$, and thus you are dividing by $0$.