Spectral theorem in Quantum Mechanics In Quantum Mechanics one often looks at self-adjoint(unbounded and closed) linear operators $A,B$ that are defined dense on $L^2$. My question is: Is it true that if we have $[A,B]=0$, where $[,]$ is the commutator, that we find some sort of same eigenbasis for both operators? 
My problem is: In Physics this result is often just blindly transfered from the finite dimensional case and I wanted to ask whether there is some sort of similar result for the actual case?
 A: The first problem you get into is the issue of the domain on which $A$ and $B$ are defined. Normally there is some large common domain for $A$ and $B$, but $AB$ or $BA$ may not be defined on the same domain, which makes comparisons of $AB$ and $BA$ hard. A simple one-dimensional problem illustrates the complexity. For example, consider the one-dimensional box $-1 \le x \le 1$, and let $H=L^{2}[-1,1]$ be the underlying Hilbert "vector" space. Define $Af = xf(x)$ for $f \in H$, and let $B=-i\frac{d}{dx}$ for continuously differentiable functions $f \in H$. These correspond to position and momentum operators. However, real observables must be selfadjoint (not just symmetric); though $A$ is selfadjoint on $H$, $B$ is not selfadjoint on its unrestricted domain. Some kind of additional endpoint condition is required on the domain of $B$ in order to obtain a selfadjoint restriction $B_{0}$. The most common one would be a periodic condition
$$
             f(-1)=f(1).
$$
Already you have a problem because $A$ does not preserve periodicity except in special cases. So how do you define $B_{0}A$, and how does that relate to $AB_{0}$. On the functions which vanish at both endpoints, you do have $[A,B_{0}]=iI$, but that doesn't really give you whole story. So a general formulation of your problem can be hard.
Even if you restrict to operators which commute on a common domain, the operators may not have a common set of eigenfunctions because the eigenfuntions of one may not satisfy the conditions of the other. For example, let $A = -\frac{d^{2}}{dx^{2}}$ on functions with $f(-1)=f(1)=0$ and let $B=-\frac{d^{2}}{dx^{2}}$ on functions with $f'(-1)=f'(1)=0$. These operators commute on the dense subspace $\mathcal{C}^{\infty}_{c}$ of infinitely-differentiable functions which vanish identically near $\pm 1$, but the basis of eigenfunctions of $A$ are not in the domain of $B$, and the basis of eigenfunctions of $B$ are not in the domain of $A$. The eigenfunctions of $A$ are $\sin$ functions which vanish at both endpoints and the eigenfunctions of $B$ are $\cos$ functions which are $1$ at the endpoints, along with the constant function.  The problem here is that the common domain is not enough to fully characterize $A$ or $B$ because $A=B$ on the common domain $\mathcal{C}^{\infty}_{c}$. Normally this doesn't come up in Quantum, because you're focused on one problem with one set of conditions, but how do you describe that in a general sense?
Free space problems can be better. In such cases, free space conditions should not be required (if they are, then the free space Quantum problem may have questionable meaning.) This is the case for non-relativistic atomic problems, where forcing functions to be in $L^{2}$ spaces is good enough. What's even better for such cases is that the compactly-supported, infinitely-differentiable functions form a common domain for all observables, and the closures of the graphs of observables on these domains gives you the unique selfadjoint operators you need for Quantum Mechanics (such a domain is called a 'core' for the observable.) In this type of setting, you may well get what you want for operators which commute on the $C^{\infty}_{c}$ functions. Restricting the global to local problems and imposing necessary boundary conditions to make the restrictions selfadjoint may roughly give you what you want.
Mathematics problems of Quantum Mechanics require a lot of detail to properly formulate the problems. It's often just better to see if your methods will lead to verifiable answers which agree with the original assumptions than to go too far down a rabbit hole.
