# PDE with inhomogeneous term $u_t + xu_x = x^2$

I am trying to solve the PDE: $u_t + xu_x = x^2$ with initial condition $u(x,0) =sinx$.

I am having difficulty solving this equation. I have tried the method of characteristics.

$dx/dt = x$ so I can get $x=ce^t$

$du/dt = x^2$ This I cannot figure out how to solve?

• What is $\frac{du}{dt}$ supposed to mean here? Should it be $\frac{\partial u}{\partial t}$, or do you mean $\frac{d}{ds}u(x(s),t(s))$? – Omnomnomnom Oct 24 '16 at 13:18

The two characteristic equations you have found are

\begin{align} \frac{dx}{dt} &= x \quad (1)\\ \frac{du}{dt} &= x^{2} \quad (2) \end{align}

You found that the solution to $(1)$ is given by $x(t) = x_{0} e^{t} \implies x_{0} = xe^{-t}$. The solution to $(2)$ is given by

\begin{align} \frac{du}{dt} &= x^{2} \\ &= x_{0}^{2} e^{2t} \\ \implies \int \frac{du}{dt} dt &= \int x_{0}^{2} e^{2t} dt \\ \implies u(x(t), t) &= \frac{x_{0}^{2} e^{2t}}{2} + f(x_{0}) \\ &= \frac{x^{2} e^{-2t} \cdot e^{2t}}{2} + f(xe^{-t}) \\ &= \frac{x^{2}}{2} + f(xe^{-t}) \end{align}

which satisfies the PDE for arbitrary $f$. Applying the initial condition $u(x,0) = \sin x$ gives

\begin{align} u(x,0) &= \frac{x^{2}}{2} + f(x) \\ &= \sin x \\ \implies f(x) &= \sin x - \frac{x^{2}}{2} \\ \implies f(xe^{-t}) &= \sin (xe^{-t}) - \frac{x^{2} e^{-2t}}{2} \\ \implies u(x(t), t) &= \frac{x^{2}}{2} + \sin (xe^{-t}) - \frac{x^{2} e^{-2t}}{2} \\ &= \frac{x^{2}}{2} \bigg( 1 - e^{-2t} \bigg) + \sin (xe^{-t}) \end{align}

You already found that $x(t) = xe^t$. It follows that $x^2 = C^2 e^{2t}$. Thus, we are simply solving $$\frac{du}{dt} = C^2 e^{2t}$$ we obtain the solution $$u(t) = \frac {C^2}2 e^{2t} + D$$ where $D \in \Bbb R$ is arbitrary.