General solution of a first order PDE with zeroth order term So I have got the following equation:
$$x\frac{\partial u}{\partial x} - 2 \frac{\partial u}{\partial y} = 2u$$
I have tried to solve the following way. I was taught that LHS can be thought of as the directional derivative of $u$ in the direction of the vector $\begin{bmatrix}x \\ -2\end{bmatrix}$. Therefore, on the curves defined by $$\frac{dy}{dx} = \frac{-2}{x} ==> y = - 2ln(x) + K$$ the PDE reduces to an ODE of the form: 
$$\frac{du}{dx} = 2u ==> u = e^{2x}e^K$$
where $k$ is a constant. Therefore $u(x,y)$ must be:
$$ e^{2x} f(y + 2ln(x))$$ 
where $f$ is any arbitrary function. However this solution is wrong (I have plugged in the equation and checked with Maple). 
 A: This line is not correct
$$\frac{du}{dx} = 2u ==> u = e^{2x}e^K$$
It should be 
$$\frac{du}{2u} = \frac {dx}x  \implies ..... $$
Here is my approach
$$x\frac{\partial u}{\partial x} - 2 \frac{\partial u}{\partial y} = 2u$$
Lagrange equation is
$$\frac {dx}{x}=-\frac {dy}{2}=\frac {dz}{2z}$$
Integrating first equation
$$ \int \frac {dx}{x}=-\frac 12 dy \implies \ln(x)=-\frac 12y +C_1$$
$$\implies C_1=\ln(x)+\frac 12y$$
Integrating second eqaution 
$$-\frac {dy}{2}=\frac {dz}{2z} \implies  \ln(z)=-y+C_2$$
$$\implies  C_2=\ln(z)+y$$
Therefore
$$\ln(z)+y=f(\ln(x)+\frac12y)$$
$$\ln(z)=f(\ln(x)+\frac12y)-y$$
$$\displaystyle u=\displaystyle e^{f(\ln(x)+\frac12y)-y}$$
$$\displaystyle \boxed{u(x,y)=\displaystyle F(\ln(x)+y/2)e^{-y}}$$
A: On the curves with $y=-2\ln(x)+K_1$ the derivative of $z(x)=u(x,-2\ln(x)+K_1)$ is
$$
z'(x)=u_x-\frac2xu_y=\frac2xz(x)
$$
which has the solution $z=K_2x^2$ and with $K_2=f(K_1)$ the general solution form is
$$
u(x,y)=x^2f(2\ln(x)+y)
$$
so that you get a slightly different factor.

Note that the first identity can also be written as $x^2e^y=C$ so that then the alternative form of the general solution is
$$
u(x,y)=x^2g(x^2e^y)=e^{-y}h(x^2e^y).
$$
