Maximum principle of heat equation, without a bounded time interval

Is there a maximum principle for the heat equation

$\partial_t u(x,t)=k \partial_{xx}^2 u(x,t)$

for $(x,t)\in[O,L] \times [0, \infty]$?

If $u$ has a maximum it would occur at $t=0$, $x=0$ or $x=L$, just like in the bounded case, but since we can't assume $u$ attains its maximum, I don't know whether it has a maximum principle or how to prove it.

I'm not assuming any boundary conditions since you didn't specify any.. but an analogous argument will work if there are.

If you separate variables, you get that $u(x,t)$ is of the form $$u(x,t) = \sum_{n=0}^{\infty} A_n \cos({n\pi \over L}x)e^{-{n^2\pi^2k^2 \over L^2}t}+ \sum_{n=1}^{\infty} B_n \sin({n\pi \over L}x)e^{-{n^2\pi^2k^2 \over L^2}t}$$ Notice that as $t$ goes to infinity, all terms go to zero except the first term of the cosine series. In fact as $t \rightarrow \infty$, $u(x,t)$ converges uniformly to $A_0$, which is the initial average temperature from $x = 0$ to $x = L$. Unless $u(x,0)$ is constant (in which case $u(x,t)$ is constant and there is nothing to prove), there is going to be some $x_0$ for which $|u(x_0,0)| = A_0 > A$.

You can prove a maximal principle as follows. Let $t_0$ be such that $|u(x,t)| < A_0$ for all $t \geq t_0$. Then by the maximal principle on the box $[0,L] \times [0,t_0]$, $|u(x,t)|$ achieves its maximum somewhere on the boundary of the box. On $[0,L] \times [t_0,\infty)$, $|u(x,t)|$, being less than $A_0$, is less than $|u(x_0,0)|$, which is in turn at most the maximum on the boundary of the box.

So $|u(x,t)|$ achieves its overall maximum on the boundary of the box $[0,L] \times [0,t_0]$. It can't occur on the side $[0,L] \times \{t_0\}$ because $|u(x,t)| < A_0$ there. Hence it achieves its maximum on one of the other three sides, which are all part of the boundary of the original domain $[0,L] \times [0,\infty)$. So we conclude that $|u(x,t)|$ does achieve its supremum over $[0,L] \times [0,\infty)$, and on the boundary of that domain.

Actually it is true for general second order parabolic equations of the form

$$\displaystyle \partial_t u = \sum_{i,j=1}^{n}a_{ij}(x,t)\partial_i\partial_ju+\sum_{k=1}^{n}b_k(x,t)\partial_k u + c(x,t) u$$

on a bounded spatial domain $\Omega\subset\mathbb{R}^n$ and time interval $t\in(0,\infty)$, where the coefficients $a,b,c$ are continuous on $\bar\Omega\times[0,\infty)$ and $[a_{ij}]$ is symmetric positive definite. With some growth condition at infinity it works for unbounded spatial domains as well.