# 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...

• this is separable PDE (some sort of heat equation), look for solution in the form $g(x,t)=X(x)T(t)$, group everything that has $t$ into one side, everything that has $x$ into the other side and integrate. – Vasya Nov 13 '18 at 14:58
• This is a linear first order ODE, so it can be understood and solved by looking at its characteristic equations. You can find this explained very nicely for instance in Evans, Partial Differential Equations. – Max Nov 13 '18 at 15:30

$$\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})$$

• Thank you! I'll read up on the method of characteristics a bit more :) – Ewoud Nov 13 '18 at 21:30

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$$.

• Thanks! This should be easily doable, if it is a power-law. What if it is not though? I don't see how to reduce this to the solution that Mathematica gives then... – Ewoud Nov 13 '18 at 15:51
• @Ewoud: I am not quite sure how Mathematica solves it and my PDE skills are 25 years old :) Probably Fourier transform is applied in general case. I did verify that the solution satisfies the PDE. – Vasya Nov 13 '18 at 15:57
• Here is the problem: this is an initial value problem of a PDE, so setting two constants will not be enough to cover all initial conditions. Take your solution and evaluate it at t=0. You find g(x,0)=Bx^(ak-1). So this covers all initial conditions of the form f(x)=x^p. Separation of variables cannot provide the general solution! – Max Nov 14 '18 at 20:09

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 :)

• As you can see by looking at the solution Ewoud proposed, the solution is not of the form f(t)g(x)... – Max Nov 13 '18 at 15:28
• @Max, yes but as Vasya precived, solution obtained by separation of the variables methond satisfies PDE given by Ewoud. – user464980 Nov 14 '18 at 12:02
• See the comment to Vasya‘s answer, that should explain it. – Max Nov 14 '18 at 20:10