TITLE: Integrate $u_t - \Delta u = 0$ to get $\frac12 \frac{d}{dt} \int_{\Omega} u^2 + \int_{\Omega}|\nabla u|^2 = 0$?
QUESTION [6 upvotes]: In my PDE class, my instructor wrote the following notes:
Consider equations $u_t - \Delta u = 0$ in $\Omega$, where $\Omega \subset \mathbb{R}^n$ is bounded. Suppose boundary conditions $u = u_0(x)$ at $t=0$, and $u=0$ at $\partial \Omega$.
Multiplying the equation by $u$ and integrating by parts gives
$$\frac12 \frac{d}{dt} \int_{\Omega} u^2 + \int_{\Omega}|\nabla u|^2 = 0$$ 
(with no boundary terms, using the bc). This already shows
$$\frac{d}{dt} \int_{\Omega}u^2 \leq 0 \tag{1}$$
which gives uniqueness, since the problem is linear (so the difference of two solutions has initial data 0).
My Questions:
I'm not seeing the integration by parts here, can someone talk me through it?How are we deducing (1)?How does (1) show uniqueness?
Thanks for your help, the details are eluding me here.

REPLY [7 votes]: Multiply by $u$:
$$uu_t -u\Delta u = 0$$
Integrate
$$\int uu_t -\int u\Delta u = 0$$
Rewrite as
$$\frac{1}{2}\frac{d}{dt}\int u^2+\int |\nabla u|^2= 0$$
where I used Green's theorem on the second term. I pulled out the $\frac{d}{dt}$ since the integral is over space only. Move the second term onto the RHS.
$$\frac{1}{2}\frac{d}{dt}\int u^2=-\int |\nabla u|^2 \leq 0$$
with the inequality because the integrand is always positive, and the minus sign outside makes it negative.
For uniqueness: suppose there are 2 solutions $u_1$ and $u_2$ solving the problem. So the difference satisfies
$$(u_1-u_2)_t - \Delta (u_1-u_2) = 0$$
$$u_1-u_2 = u_0 - u_0 = 0 \qquad\text{at $t=0$}$$
and $u_1-u_2=0$ on $\partial \Omega.$ Then it is clear, that the estimate (1) also holds with this difference:
$$\frac{d}{dt}\int_{\Omega} (u_1(t)-u_2(t))^2 \leq 0$$
Now the thing you're differentiating is a positive function, which is zero at $t=0$. Its derivative is always negative, so it must zero almost everywhere (draw a graph). Hence $u_1 = u_2$ for almost every $t$.