How does it make sense to rearrange equations like this to find a function Like for example I had $\dfrac{(g(x)-1)}{g(x)}=\dfrac x{(x+1)}$ and rearranged to get $g(x)=x+1$ involving multiplying through by $g(x)$.

Clearly $g(x)$ can equal $0$ but it doesn't seem to make sense to me to multiply through by $g(x)$ to get a solution when $g(x)$ can equal $0$ so how does it work and get the right solution. Thanks

edit: Sorry I didn't word this very well. It is the composition of two functions f(x) and g(x) is the solution I showed x/(x+1) which is f(g(x)) however I knew f(x) which was (x-1)/x and needed to find g(x) which is what I was trying to do. So then g(x)=x+1 would satisfy this. And g(-1) would be defined in this case. It is the 4th row down in this image link gyazo.com/adbd45de4445ac8600c6f9695d66fd29
Your solution is partially correct. If someone writes $(g(x)-1)/g(x)=x/(x+1)$, they are assuming $g(x)$ is non-zero and $x\neq -1$, so you must specify the domain has changed for $g$, that is, $g(x)=x+1, x\neq -1$. From an algebraic point of view, you can also just solve this formally.
I see two possible interpretations:


either the first identity is guaranteed to hold for all $x\ne -1$, then implicitly $g(x)\ne0$ and $g(x)=x+1$,
or the first identity holds when it is defined, then $g(x)$ is either $0$ or $x+1$.