Order of measurement of two observables Let $\hat A$ and $\hat B$ be two operators representing the observables $A$ and $B$, and let $\Psi(t)$ be the state of a quantum system. Let's suppose that we measure $A$ at $t_0$ and just after that we measure $B$, getting the results $a$ and $b$.
If we had made the measurements in the opposite order ($A$ first and $B$ after it), under what conditions would we have obtained the same values $a$ and $b$ for $A$ and $B$?

My attempt at a solution
I see that, after measuring $A$ or $B$, the system will collapse to one of the eigenstates of these operators. For instance, if we measure $A$ in first place, then the state at $t_0$ sill be $\Psi(x,t_0)=\psi_a(x)$, with $\psi_a(x)$ the eigenstate of $A$ corresponding to the eigenvalue $a$. And I also see that, if $\psi_a(x)$ is also an eigenfunction of $B$, and we call it's eigenvalue $b$, then the order won't matter. So this would be true if $[\hat A, \hat B]=0$ and $A$ and $B$ non-degenerate.
However, I'm not sure about the case one (of both) of the operators is degenerate, or about the case they don't commute...
 A: I think the right parsing of the question here is “under what conditions on the operators would we have obtained the same joint probability distribution for $(a, b)$ for arbitrary $\Psi$?”
Background
This is really easy to state in terms of projectors but there is a decent chance that you have not seen those yet so let me introduce them here.
These observables define PVMs $M_a$ and $N_b$ such that $$\operatorname{Prob}(A = a) = \langle \Psi | M_a |\Psi\rangle,\\
\operatorname{Prob}(B = b) = \langle \Psi | N_b |\Psi\rangle,\\
M_a M_{a'} = \delta_{aa'} M_a,\\
N_b N_{b'} = \delta_{bb'} N_b.$$
If you have never seen this before, imagine that we index all of the eigenvectors $|m_i(a)\rangle$ compatible with observing $a$ with index $i$, then $M_a = \sum_i |m_i(a)\rangle \langle m_i(a)|$ is the projector onto the states compatible with $A=a$, so these are also self-adjoint if that wasn't totally obvious from the above.
After observing $A=a$ the state collapses to the state $M_a |\Psi\rangle$ and then the probability of observing $B = b$ by the above rules must be $$\operatorname{Prob}_{A\text{-then-}B}(a,b) = \langle \Psi|M_a N_b M_a |\Psi\rangle,\\
\operatorname{Prob}_{B\text{-then-}A}(a,b) = \langle \Psi|N_b M_a N_b |\Psi\rangle,
$$ and asserting that these are the same for arbitrary $|\Psi\rangle$ ultimately forces $M_a N_b M_a - N_b M_a N_b = \hat 0$ as the zero operator is the only operator which has average zero for arbitrary $|\Psi\rangle$.
Your question
So if we boil down the math to these PVMs, the question is “under what conditions of the operators would we have that their projectors satisfy $M_a N_b M_a = N_b M_a N_b$, for all $(a, b)$ we could measure?”
We have not used one important point, which is that these operators are projectors. Let us drop the subscripts and just assume we fix $a, b$ and $M = M_a$ is our shorthand. Then it is straightforward to say that $$ M N M = N M M + [M, N] M = N M + [M, N] M,\\
N M N = N N M + N [M, N] = N M + N [M, N]$$ so on projectors, the criterion $MNM = NMN$ is equivalent to saying that $[M, N] M = N [M, N].$
Clearly $[M, N] = 0$ (that is to say: for all $a, b: [M_a, N_b] = 0$) is sufficient to guarantee this last equation (it will say $0 = 0$ then which is obviously true). We can then reconstruct $A = \sum_a a M_a$ and $B = \sum_b b M_b$ to find that $[A, B] = 0$, and this argument reverses perfectly: $[A, B] = 0$ is sufficient to guarantee that the joint probability distribution is the same for arbitrary $\Psi.$
The only question which remains is that of proving that from this $[M, N] = 0$ is necessary rather than sufficient. That looks somewhat nontrivial and probably requires diving deep into the eigenvectors and eigenvalues of $M, N$ and repeatedly using the fact that the eigenvalues must be either $0$ or $1$ by construction.
