# Uncertainty Measurement and Density operator of a continuous basis

Generally speaking the density operator for discrete states $$|\psi_i\rangle$$ is given by:

$$\rho = \sum_i p_i|\psi_i\rangle\langle\psi_i|$$

I had a hard time finding this (it is not even on wiki) but for a continuous basis {$$|x\rangle$$} this goes over to:

$$\begin{array}\rho = \int_{-\infty}^{+\infty} p(x)|x\rangle\langle x| \,\mathrm{dx}\end{array}$$

So far so good, now assuming the states $$|\psi\rangle$$ respectively $$|x\rangle$$ are an Eigenbasis of $$\rho$$. The uncertainty measurement in a discrete case now reads:

$$\eta = -\mathrm{k_B}\,\mathrm{tr}(\rho\,\ln\rho) = -\mathrm{k_B}\,\sum_{i} p_i\,\ln(p_i)$$

I assume in the continuous case this is equation is equivalent with:

$$\eta = -\mathrm{k_B}\,\mathrm{tr}(\rho\,\ln\rho) = -\mathrm{k_B}\,\int_{-\infty}^{\infty}p(x)\,\ln(p(x))$$

is it? How to arrive there? Starting from:

$$\begin{array}{l} \eta = -\mathrm{k_B}\,\mathrm{tr}(\rho\,\ln\rho)= \\-\mathrm{k_B} \mathrm{tr}\left(\int_{-\infty}^{+\infty} p(x)|x\rangle\langle x| \,\mathrm{dx}\,\int_{-\infty}^{+\infty} \ln(p(x))|x\rangle\langle x| \,\mathrm{dx}\right) \end{array}$$

Use the orthonormality of the continuous states $$\langle y|x\rangle=\delta(y-x)$$. Then the argument of your trace is $$\int_{-\infty}^\infty p(y)|y\rangle\langle y| dy\int_{-\infty}^\infty \ln[p(x)]|x\rangle\langle x| dx=\int_{-\infty}^\infty p(y)|y\rangle \delta(y-x)dy\int_{-\infty}^\infty \ln[p(x)]\langle x| dx=\int_{-\infty}^\infty p(x)\ln[p(x)]|x\rangle \langle x| dx.$$ For the second equality I used the definition of a delta function to integrate over $$y$$.
Now, there is a problem when taking the trace: $$\mathrm{tr}(|x\rangle\langle x|)=\delta(0)$$. But that problem is also present in the definition of the states, which should have trace unity: $$1=\mathrm{tr}(\rho)=\int p(x)\delta(0)dx=\delta(0)\int p(x)dx$$; the problem is that we have not been using trace-class operators $$|x\rangle\langle x|$$, so there are certain subtleties here.
What is really happening is an application of the spectral theorem: if you express an operator $$\rho$$ in terms of its spectrum $$p(x)$$ with projection-valued measure $$|x\rangle\langle x|dx$$ then any function $$f(\rho)$$ can be expressed as a function of this spectrum and the PVM $$f[p(x)]|x\rangle\langle x|$$. This is what I was trying to show by collapsing the two integrals into one. As for taking the trace of $$f(\rho)$$, this should only be done rigorously using trace-class operators.