What is the domain of a division of functions?

Your mistake is in thinking that $$\frac2{1/x}\quad\hbox{and}\quad 2x$$ are always equal. They're not. To carefully prove that they are equal, we have $$\frac2{1/x}=\frac2{1/x}\,1=\frac2{1/x}\frac xx=\frac{2x}1=2x\ .$$ But this is not correct when $x=0$, because $\frac00$ is not equal to $1$. So we have to consider $x=0$ separately. In that case we have $2x=0$, but $$\frac2{1/x}=\frac2{1/0}=\frac2{\hbox{nonsense}}=\hbox{nonsense}\ .$$ So in your example, the domain of $f/g$ must exclude $0$.


If the domain of $f$ is $A$ and the domain of $g$ is $B$ then the domain of $f/g$ is $$A\cap B\setminus\{x:B|g(x)\ne 0\}.$$ (Of course, we must assume that $A\cap B\setminus\{x:B|g(x)\ne 0\}\ne \emptyset$. In other case $f/g$ doesn't make sense.)

In your example, $f(x)=2$ and $g(x)=1/x.$ We have that

$$\dfrac{f(x)}{g(x)}=2x, \forall x\in\mathbb{R}\setminus\{0\}.$$ Why? Note that $g(0)$ doesn't exist. So we can't consider

$$\dfrac{f(0)}{g(0)}.$$