How to show that $g(x-at)$ is the weak solution of the initial value problem $$u_t+au_x=0$$ $$u(x,0)=g(x)$$ where $ g(x)\in L^{\infty}(\mathbb{R})$
Definition: $u$ is said to be the weak solution of the above initial value problem if $$\int\limits_0 ^ {\infty} \int\limits_{\mathbb{R}} ({u{\phi}_t+au{\phi}_x})dxdt =\int\limits_{\mathbb{R}}g(x)\phi(x,0)dx$$ $\forall \phi \in C_c ^1(\mathbb{R} \times[0,\infty))$
The change of variable can also be justified as follows:
Let $\Omega$ be an open set, $\Psi: \Omega \rightarrow \Psi(\Omega)$ be a $C^{\infty}$ diffeomorphism and $f:\Psi(\Omega) \rightarrow \mathbb{R}$ be a measureble function. Then the change of variable formula is given by \begin{eqnarray}\label{CVF} \int\limits_{\Psi(\Omega)}f(x)dx=\int\limits_{\Omega}f(\Psi(x)) |J_{\Psi}(x)|dx \quad \quad \quad (1) \end{eqnarray}
Now, we apply the above formula with $\Omega=\mathbb{R}\times \mathbb{R}^+$ and $\Psi(x,t)=(x+at,t)$ so that $|J_{\Psi}(x)|=1,$ as below.
Consider \begin{eqnarray} &&\int\limits_{\mathbb{R}\times \mathbb{R}^+}u(x,t)(D_2\phi(x,t)+aD_1\phi(x,t))dxdt\\ &&=\int\limits_{\mathbb{R}\times \mathbb{R}^+}g(x-at)(D_2\phi(x,t)+aD_1\phi(x,t))dxdt\\ &&= \int\limits_{\mathbb{R}\times \mathbb{R}^+}g(x)(D_2\phi(x+at,t)+aD_2\phi(x+at,t))dxdt \quad \because (1) \\ &&= \int\limits_{\mathbb{R}\times \mathbb{R}^+}g(x)(\partial_t \tilde{\phi}(x,t))dxdt \quad \quad \quad \quad \quad \quad\quad \quad\quad \quad \because \tilde{\phi}(x,t):=\phi(x+at,t) \\ &&= -\int\limits_{\mathbb{R}}g(x)\tilde{\phi}(x,0)dx = -\int\limits_{\mathbb{R}}u(x,0)\phi(x,0)dx. \quad\quad \because \text{Fundamental theorem of Calculus} \end{eqnarray} This implies that $u(x,t)=g(x-at)$ satisfies the weak formulation.