Boundary conditions of a particle in a "topological" box It is argued that the boundary conditions on a particle in a box (the box being a potential with value $0$ on the interval $[0,L]$ and infinite everywhere else) are $\psi(0) = \psi(L)=0$. Since the particle cannot with any probability be outside the box, the wave function there must be zero, so by continuity that boundary condition holds.
But what if we do not consider an artificially confined interval on $\mathbb{R}$, but instead a Hilbert space that is defined exclusively on $[0,L]$? This is exactly the same problem, except we lack the boundary conditions: since there is no zero wave function outside the box to speak of (because the outside doesn't exist), we cannot argue that the wave function goes to zero on the boundary. My question is therefore: is there another reason that this has to be the case, or is the wave function somehow "free", like a plane wave?
I believe this has practical implications: solving Schrödinger's Equation in spherical coordinates gives us the coordinate $r$ that is defined purely for $r>0$. Solving for a free particle, we find that the radial component is given by the spherical Bessel function $j_l$. When $l=0$, the wave function does not vanish at the origin. It seems to me we've now "lost" the $r=0$ boundary condition (although we have already obtained a discrete set of eigenstates), and this appears to be no issue. Would it be meaningful to apply this reasoning to both ends of the box? And if so, what does the answer tell us?
 A: 
Since the particle cannot with any probability be outside the box, the wave function there must be zero, so by continuity that boundary condition holds.

The wavefunction $\psi(x) = \frac{1}{\sqrt{L}}$, which results in a uniform spatial probability density, is perfectly allowed for the particle-in-a-box, whose Hilbert space is indeed $L^2\big([0,L]\big)$.  The boundary conditions $\psi(0)=\psi(L)=0$ are not (or rather, need not be) restrictions on the Hilbert space, they're restrictions on the domain of the Hamiltonian.
That is, the Hamiltonian operator is a linear map $\hat H : \mathcal D(\hat H)\mapsto L^2\big([0,L]\big)$, where
$$\mathcal D(\hat H) := \bigg\{\psi \in L^2\big([0,L]\big) \ \bigg| \ \psi\text{ is twice (weakly) differentiable and }\psi(0)=\psi(L)=0\bigg\}$$
$$\hat H \psi = -\frac{\hbar^2}{2m} \psi''$$

This is exactly the same problem, except we lack the boundary conditions: since there is no zero wave function outside the box to speak of (because the outside doesn't exist), we cannot argue that the wave function goes to zero on the boundary.

Without boundary conditions, this Hamiltonian is not Hermitian (check!).  One possible choice of boundary conditions is $\psi(0)=\psi(L)=0$; this defines the particle on a box.  On the other hand, periodic boundary conditions $\psi(0)=\psi(L)$ and $\psi'(0)=\psi'(L)$ would yield a perfectly well-defined (and Hermitian) Hamiltonian, which would correspond to a particle on a ring.


For an infinite line with infinite walls, QM is in principle defined on the whole space. However, the wave function is zero everywhere in the potential, and on the edges it needs to go to zero by continuity.

The way to say this is that
$$\mathcal H := \bigg\{\psi\in L^2(\mathbb R) \ \bigg| \ \psi(x)=0\text{ for } x\notin [0,L]\bigg\}$$
constitutes a Hilbert space$^\dagger$.  We are then free to choose the (self-adjoint) Hamiltonian $\hat H:\mathcal D(\hat H) \rightarrow \mathcal H$, where
$$D(\hat H) := \bigg\{\psi \in \mathcal H \ \bigg| \ \psi\text{ is twice (weakly) differentiable}\bigg\}$$
$$\hat H \psi = -\frac{\hbar^2}{2m}\psi''$$
Doing so yields two results:

*

*The requirement of differentiability for $\mathcal D(\hat H)$ implies continuity, which implies that $\psi(0)=\psi(L)=0$.  Note that this is true only for those vectors in $\mathcal D(\hat H)$, because arbitrary vectors need not satisfy the differentiability requirements.

*$\hat H$ is Hermitian, because $\psi(\pm \infty) = 0$ by the definition of the Hilbert space we're working in.


When we work in the big picture (i.e. the interval is the whole universe), there are no a priori boundary conditions. We need to bring boundary conditions (which are arbitrary) or the system is ill-defined. Is that right?

There are no a priori boundary conditions on the domain of the Hamiltonian, yes. On the space $L^2\big([0,L]\big)$, you will find that the free-particle Hamiltonian is not Hermitian unless you suitably restrict its domain with boundary conditions.  Again, though, I must emphasize that these boundary conditions do not apply to the whole Hilbert space, but rather only those elements of the Hilbert space that $\hat H$ is allowed to act on.

$^\dagger$There is a bit of subtlety related to the fact that $L^2(\mathbb R)$ consists not of functions but rather of equivalence classes of functions - see e.g. here - but this ends up not being problematic for the current discussion.
A: The choice of Hilbert space depends only on the degrees of freedom of the states we want to describe, not on the details of the actual system. In this case, we consider some particle moving in one dimension, so our Hilbert space should be that of admissible wave functions in 1D, independant of whether we eventually put the particle in a box, a harmonic oszillator, or some other potential. The space of functions on [0,L] can't live up to this task.
Of course, mathematically there is nothing stopping you from considering states in the Hilbert space of wave functions on [0,L], as argued above it just wouldn't be particularly meaningful. In that Hilbert space, we could only describe particles that are somehow intrinsically constrained to that particular region in space anyway.
In the Hilbert space of wave functions on [0,L], the particle would indeed have no boundary conditions and behave as a free particle, but that is simply because the box potential is not "part of its universe".
