# Solving $\frac{\partial \rho}{\partial t}-x u \frac{\partial \rho}{\partial x}=0$ using the method of characteristics

I have some questions about solving a partial differential equation using the method of characteristics.

The PDE is:

$\frac{\partial \rho}{\partial t}-x u \frac{\partial \rho}{\partial x}=0$

where $\rho$ is density, $t$ is time, $x$ is spatial position and $u$ is velocity. I am given that the initial value of density is one for all $x$-values.

I am given that $\rho(x,t=0)=1$.

I have tried to solve it like this:

First I found $\frac{\partial x}{\partial t}=x u$.$\;\;\;\;\;\;u=u(t)$.

This gives the following: $ln x=-\int{u(t)dt}$

$x=e^{-C\int{u(t)dt}}$ where $C$ is the constant of integration. This gives us that $x(t=0)=xe^{C\int{u(t)dt}}$. I believe this should be correct. If this is correct, how can I get the expression for the density, when I am given that $\rho(x,t=0)=1$ using the method of characteristics?

NEW INITIAL CONDITION:

If we assume that the initial value is instead:

$\rho(x,t=0)=1+e^{-x_0^2}$.

Does anyone then know how we could solve this? I am struggling to solve for $dx/dt=a(x,t)=x u(t)$. How can we solve this?

• You wrote : "I am given that the initial value of density is zero for all $x$-values. I am given that $\rho(x,t=0)=1$." This is contradictory. It should be $\rho(x,t=0)=0$. – JJacquelin Apr 27 '17 at 12:47
• Yes, sorry it should be that the density is equal to 1 initially. – David May 1 '17 at 7:06
• For the examples I have solved so far, we normally get an initial function for example such as $u(x,0)=\sin(x)$. Then we can find the expression for x from the method of characteristics ( I don't know how to get the final expression for the x-expression in the question above, but if for example $\frac{dx}{dt}=x$ then we could get an expression for $x$ and insert this into the function $\sin(x)$). But what do we do when we are given that the initial function is just a value (here 1)? – David May 1 '17 at 7:14
• If the only condition is $\rho(x,0)=1$ , then the solution is obviously $\rho(x,t)=1$, any $x$ and $t$ which fully satisfies the PDE and the condition. So, probably there is a typo or something missing in the wording of the problem. Check carefully the words and equations, especially in the definition of the boundary and initial conditions. – JJacquelin May 1 '17 at 8:19
• Okay, thank you for your reply! – David May 1 '17 at 8:31

$$\frac{\partial \rho}{\partial t}-x u \frac{\partial \rho}{\partial x}=0$$ $u(t)$ is a known function.

Initial condition : $\rho(x,t=0)=1+e^{-x^2}$.

SOLVING FOR THE GENERAL SOLUTION :

The set of ODEs for the characteristic curves is : $\quad\frac{dt}{1}=\frac{dx}{-xu}=\frac{d\rho}{0}$

A first family of characteristics curves comes from $d\rho=0 \quad\to\quad \rho=c_1$

A second family of characteristics curves comes from $\quad u(t)dt=-\frac{dx}{x} \quad\to\quad xe^{\int u(t)dt }=c_2$

The general solution expressed on the form of implicit equation is : $\quad\Phi\left(\rho\:,\:xe^{\int u(t)dt }\right)=0$ where $\Phi$ is any differentiable function of two variables. Or, equivalently, on explicit form : $$\rho(x,t)=F\left(xe^{\int u(t)dt }\right)$$ where $F$ is any differentiable function.

PARTICULR SOLUTION ACCORDING TO THE INITIAL CONDITION :

$\rho(x,0)=1+e^{-x^2}=F\left(xe^{\int_0^0 u(t)dt }\right)=F(x)$

The function $F$ is determined $\quad\to\quad F(X)=1+e^{-X^2}\quad$ any dummy variable $X$.

Putting this function into the above general solution with $X=xe^{\int_0^t u(\tau)d\tau}$ leads to : $$\rho(x,t)=1+e^{-\left(xe^{\int_0^t u(\tau)d\tau} \right)^2}$$

• Thank you very much for writing how to solve it! I can see now that I made a mistake. I had to use an implicit scheme in order to get a value for $u$, so it is not directly a function I get for $u$, but rather only numbers. Do you believe it is still possible to use the expression you found for $\rho(x,t)$? Is it possible to replace the integral of $u(\tau)d\tau$ from from 0 to $t$ with the distance we have traveled that period? Isn't that the same? – David May 10 '17 at 11:17
• If $u(t)$ is not an explicit function, but is known as a series of points $(t,u)$ you can compute the integral with discret numerical integration. – JJacquelin May 10 '17 at 11:20
• Is it possible to replace the integral of $u(τ)dτ$ from from 0 to t with the distance we have traveled that period ? This is no longer a mathematical problem, but a physical problem. Nevertheless I think that you are right and the integral is the distance travelled. – JJacquelin May 10 '17 at 11:25
• Great, then I can solve it! Thank you very much for your great help! It is very much appreciated! – David May 10 '17 at 11:27