If the spin operator is a matrix, why aren't the momentum or position operators a matrix? So my question is to do with the fact that some operators seem to be matrices while others are not. I suspect if the eigenvalues of an operator has continuous eigenvalues then the operator is not a matrix but if it is discrete it is? I hoped for an explanation of why this might be the case?
 A: *

*If the position operator $\hat{x}$ and the momentum operator $\hat{p}$ were represented by finite-dimensional square matrices, then ${\rm Tr}[\hat{x},\hat{p}]=0$, which would violate the CCR, cf. e.g. this Phys.SE post.
For their infinite-dimensional representations, see instead the theorem of Stone and von Neumann.


*In contrast, the $so(3)$ Lie algebra of spin operators has finite-dimensional representations.
A: Any operator which acts on an $n$-dimensional Hilbert space can be represented as an $n\times n$ matrix.  An operator which acts on an infinite-dimensional Hilbert space such as $L^2(\mathbb R^n)$ can at best be loosely thought of as an $\infty\times\infty$ matrix (at least insofar as we still call quantities like $\langle \phi|\hat O|\psi\rangle$ matrix elements) - which is sometimes a useful way to think about it, and sometimes not.
To more directly answer your question, the spin operators for e.g. a spin-1/2 particle act on the 2-dimensional Hilbert space $\mathbb C^2$, and so can be represented as $2\times 2$ matrices.  On the other hand, the Hamiltonian operator for a free particle on a line acts on the infinite-dimensional Hilbert space $L^2(\mathbb R)$.
When we talk about spin operators acting on a wavefunction, what we're really talking about is the operators $\mathbf 1 \otimes S_i$ which act on vectors in the composite Hilbert space $L^2(\mathbb R)\otimes \mathbb C^2$. We usually ignore the identity operator $\mathbf 1$ and just talk about the $S_i$'s acting on wavefunctions, but this is strictly speaking an abuse of notation.
