$L^2$ estimate of heat equation solution Suppose $u$ is a solution of the heat equation below:
$$u_t-\Delta u=0 \ in\  U\times (0,T) $$
$$u=0 \ on \ \partial U\times (0,T) $$
$$u=g \ on \ U\times \{t=0\} $$
Where $U$ is a bounded open set in $R^n$ and $g\in L^2(U)$,
Can we have this estimate :
$$\int_U u(x,T)^2 dx\leq \lambda\int_U g^2 dx$$
Where $0<\lambda <1$ is a constant.
Thanks!
 A: In the simple case $g \equiv 0$ we get $0 \leq 0$ and we are happy. Otherwise, multiply the equation by $u$, identify the left side as $\frac{1}{2} \frac{d}{dt} u^2$. Then integrate both sides and interchange. Defining $E(t) = \frac{1}{2} \int_U u^2 dx$, we have
$$\frac{dE}{dt} = \int_U u \Delta u dx.$$
Now integrate by parts:
$$\frac{dE}{dt} = \int_{\partial U} u (\nabla u \cdot n) dS - \int_U |\nabla u|^2 dx \\
= -\int_U |\nabla u|^2 dx$$
using the boundary condition. Motivated by the exponential decay that we see when we use separation of variables on simple domains, we'd like to say that this is less than $-cE$ for some $c>0$.
Provided the boundary is nice enough (Lipschitz turns out to be sufficient), this follows from the Sobolev inequality (although this might be overkill; I've been dealing with this topic this week, so it's on my mind). Applying it in the case $p=2$, we get that
$$\| u \|_{L^{p^*}} \leq C \| \nabla u \|_{L^2}$$
where $p^* = \frac{2n}{n-2}$. Since the domain is bounded and $p^* > 2$, $\| u \|_{L^2} \leq C' \| u \|_{L^{p^*}}$, so $\| u \|_{L^2} \leq C'' \| \nabla u \|_{L^2}$ where $C''=C C'$. 
A warning: here I am using the variant of the Sobolev inequality involving $W_0^{1,2}(U)$, not all of $W^{1,2}(U)$. Over all of $W^{1,2}(U)$, we get $C \| u \|_{W^{1,2}}$ on the right side, which would break this argument. But $u \in W_0^{1,2}(U)$ in this context because of the boundary condition. 
So returning to our original problem, the minus sign flips the inequalities, so we have
$$-\int_U |\nabla u|^2 dx \leq -cE.$$
This can be rewritten as
$$\frac{d}{dt} e^{ct} E \leq 0$$
from which it follows that
$$e^{c T} E(T) \leq E(0)$$
which gives the result.
Note that this proof does not work if $n=1$ or $n=2$. If $n=1$ you can just write down the explicit solution with separation of variables, and the form of the solution gives the answer immediately. I'm not sure how to handle the case $n=2$. Edit: as Famous Blue Raincoat pointed out in the comments, there is actually no problem when $n=1$ or $n=2$; the above goes through regardless.
Also note that there is a smoothing argument to be made if $g$ does not have a weak derivative in $L^2$. But this is routine: you have the desired inequality if you replace $g$ by $u(t,x)$ for any $t>0$ (since $u$ is in fact $C^\infty$ for $t>0$), and you just need that $\lim_{t \to 0^+} u = g$ in the sense of $L^2$.
