Solving differential equation $xdy + ydx = 0$
Solve following equation
$$xdy + ydx = 0$$
My process: group variables
$$xdy = -ydx \ \ \ ; \ \ \ \frac{x}{dx} = -\frac{y}{dy}$$
Integrate
$$\int{\frac{dx}{x}} = \int{\frac{-dy}{y}}$$ $$\ln |x| + K = - \ln |y| + K$$
Solution $$\ln|xy| = K$$
However my textbook gives answer:
$$xy = K$$
Where am I going wrong?
$\endgroup$ 13 Answers
$\begingroup$Your approach is alright. Note that if $\ln A = k$, then $A = e^k$ and if $k$ is a constant, then so is $e^k$ and you could rename it to (for example) $K$.
Other approach (using the product rule):$$xdy+ydx = 0 \Leftrightarrow d(xy) = 0 \implies xy = C$$
$\endgroup$ 5 $\begingroup$You aren't going wrong. Your solution and the textbook's solution are the same. $e^K$ is just some arbitrary constant where $K > 0$.
As a side note you should be more careful in naming your constants. You have $K$ on as the integration constant on both sides. The should be named something like $K_1$ and $K_2$ because they can (and probably are) different.
$\endgroup$ $\begingroup$$$ Xdy + ydx =0 xdy = -- ydx 1/y dy = -- 1/x dx $$
Integrating both sides;$$ log |y| = -- log |x| + log |C| $$$$ log |y| + log |x| = log |C| $$$$ log |xy| = log |C| $$Comparing respective parts;$$xy = C$$$$ y = C/x $$, which is required general solution..
$\endgroup$