Meaning of the general matrix element $\langle x'|O|x\rangle $ In a recent lecture we were told that  $\langle x'|\hat{O}|x \rangle = O(x,x') = O(x)\delta(x-x')$ "due to the locality of quantum mechanical observables". 
I have no idea what this is supposed to mean any comments or references to a book from which this, or something similar, originates would be much appreciated
 A: Okay, $\delta$ is the Dirac $\delta$-function; it is an infinitely thin infinitely tall spike at $0$ where the limit is taken such that the area of the spike remains a constant $1.$ In general there are lots of function families $f_k$ which satisfy the essential property $\lim\limits_{k\to0}\int dx~f_k(x) ~g(x) = g(0),$ and for some of these families every $f_k$ is a smooth function, so you can always essentially pretend that $\delta(x)$ is smooth. One such choice is $k = \sigma$ in the Gaussians of unit integral, $(2\pi\sigma^2)^{-1/2} \exp\big[-x^2/(2\sigma^2)\big].$ That is valid if $x$ is defined in the position-space $\mathbb R$, but there are certainly other Dirac-$\delta$ functions for higher-dimensional spaces, where generally $\int dx_1\int dx_2\dots \int dx_n~\delta_n(\vec x) ~g(\vec x) = g(\vec 0).$
The basis vectors $|x\rangle$ and $|x'\rangle$ are being written in the "position basis", which is not actually 100% well-defined. The general idea is that $\int dx~|x\rangle\langle x|$ is the identity operator $\hat 1$ (when integrated over $(-\infty, \infty)$), with the "orthonormality" relation $\langle m|n\rangle = \delta_{mn}$ using the Kronecker $\delta$ being replaced by the Dirac $\delta$ as $\langle x' | x\rangle = \delta(x - x').$  
The fact that you cannot really find a set of wavefunctions which do this perfectly is viewed as a side-note to a valid way of managing the algebra involved. Yes, basically $|x_0\rangle$ is essentially supposed to be a square-root-of-$\delta$ function, so that in 1D we're supposed to consider $\psi_{x_0}(x)$ as the limit of $(2\pi\sigma^2)^{-1/4} \exp\big[-(x - x_0)^2/(4\sigma^2)\big]$ in the limit (after the integrals have been all performed) as $\sigma\to 0.$  But more importantly: the math works at the bra- and ket- levels, so why not use it?
The claim being offered here is that a quantum mechanical observable must be local, presumably in the sense that it must not connect two different positions at the same time. Therefore probably $\vec x$ lives in Minkowski space and the $\delta$ functions we're meant to use are 4D ones, though you could also retrieve the 1D case if you are making the statement that $\hat O$ is a measurement that is performed instantaneously rather than by evolving the system with some Hamiltonian first and then performing your instantaneous projective measurement.
The claim probably requires that $O(x)$ remain a differential operator, because locality should really only demand that an observable depend on a wavefunction and its derivatives at some point. In particular I'd very much struggle to see how the momentum operator in 1D would look if not $O(x) = -i\hbar \partial_x.$
A: Since having asked this question I know feel I understand the meaning:
Firstly the matrix element can only really be understood within a corresponding matrix equation such as:
$$\langle \psi  |\hat{O}|\psi\rangle=\int \mathrm dx \int \mathrm dx' \langle \psi |\,x'\rangle \langle x' |\hat{O}|\,x\rangle  \langle x\, |\,\psi\rangle $$
Now in non relativistic QM $\hat{O}=f(\hat{p},\hat{x})$ i.e. the operator can be written as some function of momentum and position operators. Firstly the simplest case is if  $\hat{O}=f(\hat{x})$ then we have
\begin{align}&=\int \mathrm dx \int \mathrm dx' \langle \psi |\,x'\rangle \langle x' |\,f(\hat{x})|\,x\rangle  \langle x\, |\,\psi\rangle \\&= \int \mathrm dx \int \mathrm dx' \langle \psi |\,x'\rangle f(x)\langle x' |\,x\rangle  \langle x\, |\,\psi\rangle \\ &= \int \mathrm dx \int\mathrm dx' \langle \psi |\,x'\rangle f(x)\delta(x-x')  \langle x\, |\,\psi\rangle \end{align} 
Next we can consider the case when $\hat{O}=f(\hat{p})$:
\begin{align}&=\int\mathrm  dx \int \mathrm dx' \langle \psi |\,x'\rangle \langle x' |\,f(\hat{p})|\,x\rangle  \langle x\, |\,\psi\rangle\\ & = \int\mathrm dp \int\mathrm dx \int\mathrm dx' \langle \psi |\,x'\rangle f(p)\langle x' |\,p\rangle\langle p\, |x\rangle  \langle x\, |\,\psi\rangle \\& = \int \mathrm dp \int\mathrm dx \int\mathrm dx' \langle \psi |\,x'\rangle f(p)e^{-ip(x'-x)/\hbar} \langle x\, |\,\psi\rangle \\& = \int \mathrm dp \int \mathrm dx \int \mathrm dx' \langle \psi |\,x'\rangle f\left(-i\hbar\frac{\partial}{\partial x'}\right)e^{-ip(x'-x)/\hbar} \langle x\, |\,\psi\rangle \\ &=  \int \mathrm dx \int \mathrm dx' \langle \psi |\,x'\rangle f\left(-i\hbar\frac{\partial}{\partial x'}\right)\delta(x-x') \langle x\, |\,\psi\rangle \\&=   \int \mathrm dx' \langle \psi |\,x'\rangle f\left(-i\hbar\frac{\partial}{\partial x'}\right) \langle x'\, |\,\psi\rangle \end{align}
Hence we have again related the matrix form of the operator to its corresponding differential operator in the position representation. This process can be generalised for any product of operators $\hat{p}$ and $\hat{x}$ and so in general we see that:
$$\langle x' |\hat{O}|\,x\rangle=\langle x' |f(\hat{x},\hat{p})|\,x\rangle=f\left(x',-i\hbar\frac{\partial}{\partial x'}\right)\delta(x-x')\,.$$
