Quasi-Linear PDE Solving issues I have got the equation $y_t+2y_x=x$ with the conditions $y(x,0)=\sin x;\ \ y(0,t)=e^{-2t}$.
Writing the characteristic equation, we have $\frac{dx}{2}=\frac{dt}{1}=\frac{dy}{x}$. However, this presents me with two forms of solutions, that is we can write the above characteristics as $\frac{x^2}{2}-y=c_1;\ \ 2t-x=c_2;\ \ xt-y=c_3$. Now, I can even reduce the previous equations by writing $y=\frac{x^2}{2}-g(2t-x)$.
But, I get different values of $g$ for different initial conditions, namely I get both $g(2t)=e^{-2t}$ by applying $y(0,t)=e^-{2t}$ and $g(-x)=\sin x-\frac{x^2}{2}$ by applying $y(x,0)=\sin x$. How should I settle the problem?
Also, how do I plot the characteristics to see where there are shocks/ discontinuities? Any hints? Thanks beforehand.
 A: $$y_t+2y_x=x$$
You wrote correctly the Charpit-lagrange ODEs:
$$\frac{dx}{2}=\frac{dt}{1}=\frac{dy}{x}$$
But they are some mistakes in solving the ODEs.
A first characteristic equation comes from solving $\frac{dx}{2}=\frac{dy}{x}$.
But $\int \frac{dx}{2}\neq \frac{x^2}{2}$ . The correct equation is :
$$\frac{x^2}{4}-y=c_1$$
A second characteristic equation comes from solving $\frac{dx}{2}=\frac{dt}{1}$. You correctly obtained :
$$2t-x=c_2$$
You try to get a third characteristic equation from solving $\frac{dt}{1}=\frac{dy}{x}\quad\implies\quad xdt=dy$
But $\int xdt\neq xt$ . Thus $xt-y=c_3$ is false. $x$ is not constant. So you cannot integrate.
The general solution of the PDE is :
$$\boxed{y(x,t)=\frac{x^2}{4}+g(2t-x)}$$
$g$ is an arbitrary function  (to be determined according to the specified conditions).
Initial condition : $y(x,0)=\sin(x)\quad$ Thus $y(0,0)=\sin(0)=0.$
Bondary condition : $y(0,t)=e^{-2t}\quad$. Thus $y(0,0)=e^0=1.$
We observe a difficulty : $y(0,0)=0=1$ which seems contradictory.
In fact this is a discontinuity like in the Heaviside step function. This will induce a discontinue function $g(2t-x)$ with two different forms $g_1(2t-x)$ and $g_2(2t-x)$.
First, according to the initial condition : $y(x,0)=\sin(x)=\frac{x^2}{4}+g_1(-x)$. This leads to the solution :
$$y_1(x,t)=\frac{x^2}{4}-\sin(2t-x)-\frac{(2t-x)^2}{4}$$
Second, according to the boundary condition $y(0,t)=e^{-2t}=g_2(2t)$. This leads to the solution :
$$y_2(x,t)=\frac{x^2}{4}+e^{-2t+x}$$
$$\boxed{y(x,t)=\big(\frac{x^2}{4}-\sin(2t-x)-\frac{(2t-x)^2}{4}\big)H(2t-x)+\big(\frac{x^2}{4} +e^{-2t+x}\big)H(x-2t)}$$
$H$ is the Heaviside step function : $H(x-2t)=1-H(2t-x)$ .
The discontinuity location is $x(t)=2t$ .
