Solving a PDE via method of characteristics I'm interested in solving the following PDE via the method of characteristics:
$$\frac{\partial f}{\partial t} - ax\frac{\partial f}{\partial p}+ bp \frac{\partial f}{\partial x} = 0,$$
with $f=f(x,p;t)$ and $a,b>0$ constants, given an arbitratry initial condition
$$f(x,p;0)=f_0(x,p).$$
and the relations
$$x=x(t), \quad p=p(t)$$
$$x(0)=x_0 \quad p(0)=p_0$$
I don't really know the method and the examples I found didn't really deal with anything similar...would appreciate any pointers on how to proceed here. I should get 
$$f(x,p;t)=f_0(x_0(x,p;t),p_0(x,p;t))$$
with $x_0(x,p;t)$ and $p_0(x,p;t)$ being sort of inverted from the equations for $x(t)$ and $p(t)$. But I have no idea how to derive this result.
 A: Let us fix $x_0, p_0$.
The method is to find a curve
$$
(x,p,t) = (x(t), p(t), t) := \gamma(t)
$$
such as
$$
\gamma(0) = (x_0,p_0,0) \\
f\circ\gamma \text{ does not depend on }t
$$
The last condition is equivalent (under smoothness assumptions) to
$$
0 = \frac {d(f\circ\gamma)}{dt} = \frac{\partial f}{\partial t} + 
\frac{\partial f}{\partial p}\frac{\partial p}{\partial t} +
\frac{\partial f}{\partial x}\frac{\partial x}{\partial t} 
$$
To identify with the PDE, you just have to put
$$
\frac{\partial p}{\partial t} = -ax(t); \ \
\frac{\partial x}{\partial t} = bp(t)
$$
Now if you can find a solution $(x_0(t), p_0(t))$ of the previous equation with the initial conditions given and if $x(t_1) = x_1, p(t_1) = p_1$, 
then you must have
$$
f(x_1,p_1,t_1) = f\circ\gamma (t_1) = f\circ\gamma(0) = f(x_0(t),p_0(t),0)
= f_0(x_0, p_0)
$$
A: first fix the notations: $ab=\lambda^2>0­­$
$$by\frac{\partial f}{\partial x}-ax\frac{\partial f}{\partial y}+\frac{\partial f}{\partial z}=0$$
$f$ is a first integral of the vector field $X=by\,\partial_{x}-ax\,\partial_{y}+\partial_{z}$, i.e. $\mathscr{L}_X(f)=0$ or equivalently $f$ is constant on integral curves of $X$.
The integral curves of $X$ are solutions of the differential equation $\gamma'(t)=X(\gamma(t))$:
$$x'=by,\ y'=-ax,\ z'=1$$
$x=x_0\cos(\lambda t)+\sqrt{\frac{b}{a}}y_0\sin(\lambda t)$, $y=-\sqrt{\frac{a}{b}}x_0\sin(\lambda t)+y_0\cos(\lambda t)$, $z=t+z_0.$
We can verify that $f_1=ax^2+by^2$ is constant (a first integral). if you write $\frac{x}{y}$ as a fraction of $\tan(\lambda t)$ you can write a relation between $\frac{x}{y}$ and $z$ and deduce a second integral function $f_2$.
The solution of the pde can be written $f(x,y,z)=F(ax^2+by^2,f_2(x,y,z))$ where $F : \mathbb{R}^3\to\mathbb{R}$ is any smooth function.
