I am studying DG for conservation laws from this book.
Local inner product is defined like
$$(u,v)_{D^k} = \int_{D^k} uv dx$$
and the $L^2(D^k)$-norm as
\begin{equation} (u,u)_{D^k} = ||u||^2_{D^k} \end{equation}
Now, consider the following problem where the flux $f(u) = au$
$$\frac{\partial u}{\partial t} + \frac{\partial (au)}{\partial x} = 0$$
I am a little confused in example 2.3 they have
$$\frac{d}{dt}||u_h||^2_{\Omega,h} = -a(u^2(R)-u^2(L))$$
and they say that it is derived from multiplying the equation of the problem by $u(x,t)$, integration over the domain $D^k$, followed by integration by parts.
If I take the equation of the problem and multiply it by $u(x,t)$ is it correct to have the following?
$$\frac{\partial u^2}{\partial t} + \frac{\partial (au^2)}{\partial x} = 0$$
Note the square exponent in $u$. Or should it be?
$$u \frac{\partial u}{\partial t} + u\frac{\partial (au)}{\partial x} = 0$$
Perhaps they are equivalent but don't have arguments to convince myself.
Following with the integration over the domain $D^k$ I have $$\int_{D^k} \frac{\partial u^2}{\partial t} dx + \int_{D^k} \frac{\partial (au^2)}{\partial x} dx = 0$$
Now assuming I can change the derivate and integral (is there some theorem or condition the function must satisfy so that I am allowed to do this?) of the first term and using fundamental theorem of calculus in the second I get
$$ \frac{\partial}{\partial t} \int_{D^k} u^2 dx + a[u^2]^R_L = \frac{d}{dt} ||u||^2_{D^k} + a[u^2(R)-u^2(L)]^R_L$$
which gives the result they have in the book (the notation is a little bit off don't know if I make a mistake on it but it seems to me that there are some typos in the book)
So my last question is, where does the third step comes into play? I don't see where to apply integration by parts.
I believe my confusion comes from the notation and some theorems/conditions I am missing to do certain stuff with the integrals/derivatives. Could someone clarify all the small details I asked?