Solving the One Way Wave Equation with Boundary Condition and Initial Condition I want to solve the one way $1$D wave equation with the following IC and BC:
$$ u_t+au_x=0; \quad 0\leq x\leq1, \quad t\geq0 $$
$$ u(x,0)=u_0(x) \quad\quad u(0,t)=g(t) $$
Previously, with a question like this I would try to use the method of characteristics but I'm not sure if that would work considering it's an initial boundary value problem rather than just an IVP.
Instead, to solve this, I tried to use a change of variables where I defined:
$$\tilde{u}(\xi,\tau)=u(x,t) \quad\quad\text{and}\quad\quad t=\tau \quad\quad \xi=x-at$$
I then calculated the derivative:
$$ \frac{\partial}{\partial\tau}(\tilde{u})=\frac{\partial u}{\partial x}\frac{\partial x}{\partial\tau}+\frac{\partial u}{\partial t}\frac{\partial t}{\partial\tau}=\frac{\partial x}{\partial\tau}u_x+u_t=au_x+u_t=0 $$
So I have:
$$ \tilde{u}_{\tau}=0;\quad \tilde{u}(\xi,0)=u_0(\xi); \quad \tilde{u}(0,\tau)=g(\tau) $$
I'm not really sure where to go from here. Should it be obvious? This question is from a textbook where the answer is simply stated as:
$$ u(x,t) = u_0(x-at) \quad \text{if } x-at>0 $$
$$ u(x,t) = g(t-a^{-1}x) \quad \text{if } x-at<0 $$
Should I apply the BC or the IC first at this point? Also, where should I break into cases based on the sign of $a$? Did I implicitly assume $a>0$ already somewhere in my solution? Any help/hint/comment would be much appreciated.
When I did try using the method of characteristics, I had:
$$ \frac{dt}{1}=\frac{dx}{a} \implies dx = a dt \implies x = at-x_0 \implies x_0 = x-at $$
Then I think all you would do is let:
$$ u(x,t) = u_0(x_0(x,t)) = u_0(x-at)  $$
Now I apply the boundary condition but it only gives me:
$$ u(0,t) = u_0(-at)=g(t) $$
and I have no idea how to interpret this. Again, any help/hint/comment would be much appreciated.
 A: The method of characteristics leads to the general solution of the PDE :
$$u(x,t)=F(x-at)$$
Your problem is to determine the arbitrary function $F$ in order to satisfy the specified conditions.
Considering the initial condition alone :
$$u(x,0)=u_0(x)=F(x)$$
$$u(x,t)=u_0(x-at)\tag 1$$
Considering the boundary condition alone :
$$u(0,t)=g(t)=F(-at) \quad\implies\quad F(X)=g\left(-\frac{1}{a}X\right)$$
$$u(x,t)=g\left(-\frac{1}{a}(x-at)\right)=g\left(t-\frac{x}{a} \right)\tag 2$$
The two conditions are compatible any $x,t$ if the functions $u_0$ and $g$ are not independant functions but are related $g(\tau)=u_0(-a\tau)$ for any argument $\tau$.
In the general case the two conditions are not compatible for a continuous solution valid any $x,t$. This means that they are two domains separated by a discontinuity (which could be modeled with a piecewise function such as Heaviside's function).
$$u(x,t)=\begin{cases}
u_0(x-at)\qquad x>at\geq 0 \\
g\left(t-\frac{x}{a} \right)\qquad 0\leq x<at
\end{cases}$$
On the discontinuity line $x=at$ the function $u(x,t)$ is undefined and the PDE is considered as localy not valid on strict sens. If this was not acceptable in the strict lecture of the wording of the problem, there would be no solution in case of not related functions $u_0$ and $g$ such as show above.

A: Let's consider the natural domain $0 \le x$ instead of $0 \le x \le 1$. And let's also assume that $a$ is positive (this seems to be understood, since otherwise the problem is unsolvable for most $u_0$ and $g$).
You've already found that $u$ is constant along the characteristics, which are the lines $x-at = C$. Now think geometrically; depending on whether $C$ is positive or negative, such a line will intersect either the positive $x$-axis or the positive $t$-axis. (Here it's essential that $a$ is positive.) So the constant value of $u$ on that line will be determined either by the initial value $u_0(x)$ at the point where the line intersects the positive $x$-axis or by the boundary value $g(t)$ at the point where the line intersects the positive $t$-axis.
