Are operator matrices of $x$ and $p$ the same for all systems? I recently read Computing quantum eigenvalues made easy . In that article, the author used the position and momentum operator's matrix form in terms of the normalized eigenstates of a harmonic oscillator(truncated to some finite dimension ofcourse) and some numerical methods to approximately guess the eigen-energies of all sorts of polynomial potentials. My question is why are these $x$ and $p$ matrices that are true for the harmonic oscillator also true for all other systems? Shouldn't different systems have position and momentum operators in matrix form that look different? Not to mention the form they used has an $\omega_0$ term which is the frequency of the harmonic oscillator which they conveniently chose to be 1, but then used the matrix containing the $\omega_0$ and said that it can be used for systems with any potential that has a polynomial form in $x$. What if the system is not an oscillating system? What will be $\omega_0$ for that system?
 A: From a theoretical point of view, a quantum mechanical system consists of a Hilbert space $\mathcal H$, which consists (roughly) of the possible states of the system, and a special choice of operator which governs how the system evolves in time.  When we make a choice for this time evolution operator, we call it the Hamiltonian.
A quantum mechanical operator is a linear map from the Hilbert space $\mathcal H$ to itself.  If two systems have the same underlying Hilbert space, then they have the same operators as well.  For instance, both the free particle on a line and the quantum harmonic oscillator are built on the Hilbert space $\mathcal H = L^2(\mathbb R)$, so the position and momentum operators for these two systems are the same.
The only difference between the two systems lies in which operator is chosen to govern the time evolution.  For the free particle, we choose 
$$H_{\text{free}} = \frac{P^2}{2m}$$ 
while for the harmonic oscillator, we choose 
$$H_{\text{QHO}} = \frac{P^2}{2m} + \frac{1}{2}m\omega^2 X^2.$$ 
An important point to note is that $H_{free}$ is still a valid operator when we're talking about the harmonic oscillator - it's just not the one we choose to govern the time evolution of the system.
