How to solve this PDE equation? (I never had a PDE course unfortunately, but this problem came up from some physical problem.) 

Solve for $g(x,t)$, where:
  $$\frac{\partial{g(x,t)}}{\partial t} + \frac{\partial}{\partial x}\left(g(x,t)\frac{-x}{a}\right)=0$$
  with some initial condition $g(x,0) = f(x)$, and constant $a$. 

Mathematica tells me its solution should be $g(x,t)=e^{t/a} f(x e^{t/a})$, but I would like to know how to solve it myself too. How to do it? Or can you point me in the right direction?
Edit: you suggested separating variables $g(x,t)=\psi(x)\phi(t)$. This gives the following:
$$\frac{\partial\ln{\phi(t)}}{\partial t} = \frac{\partial}{\partial x} \left(\psi(x) \frac{x}{a}\right)$$
How to continue from here then? The final answer does not look immediately separable to me either...
 A: $$\frac{\partial{g(x,t)}}{\partial t} + \frac{\partial}{\partial x}\left(g(x,t)\frac{-x}{a}\right)=0$$
$$\frac{\partial{g(x,t)}}{\partial t}-\frac{x}{a}\frac{\partial{g(x,t)}}{\partial x}=\frac{1}{a}g(x,t)$$
By luck, the method of separation of variables is perfect in this case, according to the initial condition $g(x,0)=f(x)$. But this is not always so simple.
Alternatively one can use the method of characteristics in order to find not only some particular solutions, but the general solution.
The Charpit-Lagrange system of equations is:
https://en.wikipedia.org/wiki/Method_of_characteristics
$$\frac{dt}{1}=\frac{dx}{-x/a}=\frac{dg}{g/a}$$ 
This easily leads to two characteristic equations :
$$\frac{dt}{a}+\frac{dx}{x}=0\qquad\to\qquad xe^{t/a}=c_1$$
$$\frac{dt}{a}-\frac{dg}{g}=0\qquad\to\qquad ge^{-t/a}=c_2$$
The general solution is : $\quad ge^{-t/a}=F(xe^{t/a})\quad$
where $F$ is an arbitrary function.
$$g(x,t)=e^{t/a}F(xe^{t/a})$$
The arbitrary function $F$ is no longer arbitrary when the initial condition is specified :
$$g(x,0)=f(x)=e^{0/a}F(xe^{0/a})=F(x)$$
This is why this case is so simple $F(x)=f(x)$ and the result is 
$$g(x,t)=e^{t/a}f(xe^{t/a})$$
A: Let's look for solution in the form $g(x,t)=X(x)T(t)$. We have
$X(x)T'(t)-xX'(x)T(t)/a-X(x)T(t)/a=0$. Separating the variables we obtain:
$\frac{T'}{T}=\frac{xX'+X}{aX}=k$ (it's equal to some constant because we have two functions with independent variables on different sides). Now you just split PDE into two ODE: $\frac{T'(t)}{T(t)}=k$ and $\frac{xX'(x)+X(x)}{aX(x)}=k$. Integrating the first one we get $\ln(T)=kt+c$, $T(t)=Ce^{kt}$. The second equation can be rewritten as $\frac{xX'(x)}{aX(x)}=k-\frac{1}{a}$ or $\frac{X'(x)}{X(x)}=\frac{ak-1}{x}$. Integrating bot sides we get $\ln X(x)=(ak-1)\ln x+c_1$, $X(x)=C_1x^{ak-1}$. Thus, $g(x,t)=Bx^{ak-1}e^{kt}$ (where $B$ is some constant). Use boundary conditions to find constants $k$ and $B$.
A: I can give you a hint.
Assume that your function $g(x, t)$ can be set to be equal to multiplication of two functions $\psi(x)$ and $\phi(t)$.
Then apply your conditions and see how far you can go with that :)
