The constant of integration in the solution to the differential equation $-4 g(x)=2 x g'(x)$ When I solved this differential equation--- 

$$-4 g(x)=2 x g'(x)$$

---I obtained 
$$\log (g(x))=-2 \log (x).$$ Solving for g(x) I got $\frac{1}{x^2}$.
Now this is an error that I constantly manage to get, and I do not understand how I can overcome this mistake. The first mistake here is that I have no constant. Now when using mathematica I get $\frac{c}{x^2}$, where c is the constant. I have been told that I should add the constant and not multiply it. However this is clearly not correct for all cases. Second  the solution I made is conditional. 
$$-\pi <-2 \Im(\log (x))\leq \pi$$ 
My question is, how can I make sure that I get the constant in correct form(multiply or add or subtract etc.) Second I would like to know how a mathematician would know that this would be conditional. Is there an intuition they have, do they check it by graphing?
 A: Rearranging shows that the equation is separable: Provided that $g(x)$ is nowhere $0$, we have
$$\phantom{(ast)} \qquad \frac{g'(x)}{g(x)} = -\frac{2}{x}. \qquad (\ast)$$
The left hand side is $\frac{d}{dx}\log g(x),$ so integrating gives
$$\log g(x) = \int - \frac{2}{x} dx = - 2\log|x| + C.$$
In particular, we've absorbed the constant of integration that occurs on the l.h.s. into $C$, which in turn gives rise to the parameter in the general solution to the o.d.e. $(\ast)$.
Mathematica mentions the additional equation you've called a condition because it tacitly assumes that you're interested in complex solutions, which is presumably not the case here; in fact, it's simply reporting a so-called choice of branch cut for the logarithm function, but this has no consequence for the general condition. Indeed, for any choices $C \in \Bbb C$, one can check by substitution that $g(z) := \frac{C}{z^2}$ is a solution.
A: hint:Let $y = g(x)$, then the equation becomes: $-4y = 2xy' \to xy'=-2y \to x\dfrac{dy}{dx} = -2y \to \dfrac{dy}{y}=-\dfrac{2dx}{x}$. Can you complete the answer?
A: Suppose for now that $g \not\equiv 0$. If we have $$-4 g(x)=2 x g'(x),$$ we can rewrite this as: $$\frac{g'(x)}{g(x)} = \frac{-2}{x}.$$Integrating both sides: $$\int \frac{g'(x)}{g(x)}\,{\rm d}x = \int \frac{-2}{x}\,{\rm d}x \implies \ln|g(x)| = -2\ln |x|+c = \ln(1/x^2)+c, \quad c \in \Bbb R.$$ So taking exponentials: $$|g(x)| = e^{\ln(1/x^2)+c} = e^c\frac{1}{x²} = \frac{C}{x^2}, \quad C > 0.$$Getting rid of the absolute value: $$g(x) = \frac{C}{x^2}, \quad C \in \Bbb R \setminus \{0\}.$$ Since $g \equiv 0$ is also a solution, we write all together: $$g(x) = \frac{C}{x^2}, \quad C \in \Bbb R.$$
A: You rearrange this separable equation as
$$ \dfrac{d}{dx} \log(g) = \dfrac{g'}{g} = \dfrac{-2}{x} = \dfrac{d}{dx} (-2 \log x)$$
(assuming for the moment $x$ and $g$ are positive: the other cases are similar).
Then taking antiderivative of both sides introduces an arbitrary constant:
$$ \log(g) = -2 \log(x) + c $$
and taking exponential of both sides
$$ g = e^c e^{-2 \log(x)} = \dfrac{C}{x^2} $$
where $C = e^c$.
There is no "conditional".  This solution works for any $C$, as you can see by substituting it into the differential equation.
