Solution (source code)

= Solution

A <stationary state> has the form
$$
\Psi(t)=e^{-iEt/\hbar}\psi.
$$
For a time-independent <quantum observable> $Q$, the global phases cancel in the <expectation value>:
$$
\langle Q\rangle_{\Psi(t)}
=\langle e^{-iEt/\hbar}\psi,Qe^{-iEt/\hbar}\psi\rangle
=\langle\psi,Q\psi\rangle.
$$
It is therefore independent of time.

For the <infinite square well>,
$$
E_n=\frac{n^2\pi^2\hbar^2}{2ma^2}.
$$
The possible <energy measurement> results are
$$
\boxed{E_1=\frac{\pi^2\hbar^2}{2ma^2},
\qquad E_2=\frac{2\pi^2\hbar^2}{ma^2}},
$$
with respective <Born rule> probabilities $|c_1|^2$ and $|c_2|^2$. Normalization gives $|c_1|^2+|c_2|^2=1$.

At time $t$,
$$
\Psi(x,t)=c_1e^{-iE_1t/\hbar}\psi_1(x)
+c_2e^{-iE_2t/\hbar}\psi_2(x).
$$
The required <matrix elements> are
$$
\langle\psi_1,\hat x\psi_1\rangle
=\langle\psi_2,\hat x\psi_2\rangle=\frac a2,
\qquad
\langle\psi_1,\hat x\psi_2\rangle=-\frac{16a}{9\pi^2}.
$$
Consequently
$$
\boxed{\langle\hat x\rangle_{\Psi(t)}
=\frac a2-\frac{32a}{9\pi^2}
\operatorname{Re}\!\left(c_1^*c_2e^{-i\omega t}\right)},
$$
where the <angular frequency> is
$$
\boxed{\omega=\frac{E_2-E_1}{\hbar}
=\frac{3\pi^2\hbar}{2ma^2}}.
$$
Finally, $2|c_1c_2|\le |c_1|^2+|c_2|^2=1$, so
$$
\boxed{\left|\langle\hat x\rangle_{\Psi(t)}-\frac a2\right|
\le\frac{16a}{9\pi^2}}.
$$