Division by $0$ and its restrictions Consider the following expression:
$$\frac{1}{2} \div \frac{4}{x}$$
Over here, one would state the restriction as  $x \neq 0 $, as that would result in division by $0$. 
But if we rearrange the expression, then:
$$\begin{align}
\frac12\div\frac4x &= \frac{1}{2} \times \frac{x}{4} \\
&= \frac{x}{8}
\end{align}$$
In this expression, there are no restrictions. If we substitute $x = 0$, then the answer is $\frac{0}{8} = 0$.
So, how come in the first unsimplified expression, when we substitute $ x =0$, we get undefined, whereas in the simplified expression we get $0$?

When we make a simplification like that, we are implicitly assuming that $x\neq 0$. Really, one should write that
$$
\frac{1}{2} \div \frac{4}{x}=\begin{cases}
x/8&\text{if $x\neq 0$}\\
\text{undefined}&\text{if $x=0$}.
\end{cases}
$$
