Probability distributions in quantum mechanics In general, how does one calculate a probability distribution, $P(A)$ for some observable $\hat{A}$, given a state $|{\psi}\rangle$?
I know that the expectation value of $A$ for $|\psi\rangle$ is simply $\langle \psi| \hat{A}|\psi\rangle$ which I may expand in the position basis as $\int \langle \psi|x\rangle\langle x| \hat{A}|\psi\rangle\, dx = \int \langle \psi|x\rangle\langle x| \hat{A}|\psi\rangle\, dx = \int \psi^*(x) \hat{A}_x \psi(x)\, dx$, where $\hat{A}_x$ is the $A$ operator written in the $x$ basis, and we integrate over all space.  If I had to guess, from the definition of expected value, $E(A) = \int P(A|x)\,dx$ so I would guess that $P(A|x) = \psi^*(x) \hat{A}_x \psi(x)$. Is this correct?
More generally, in any basis may we write
$$P(A|q) =  \psi^*(q) \hat{A}_q \psi(q)$$
for the probability distribution of $A$ over $q$?
If not, what is the correct way to calculate probability distributions?
 A: To find the probability distribution for an observable $A$ in a given quantum state $|\psi\rangle$, you need to find the eigenvalues and eigenvectors of $A$.  It should actually be obvious that you need to find the eigenvalues, since those are exactly the allowed values of $A$.  However, you also need the eigenvectors (or at least the eigenspaces) associated with each eigenvalue to find the probability.
For a (nondegenerate, discrete) eigenvalue $\lambda$ of $A$ with corresponding eigenstate $|\lambda\rangle$, meaning $A|\lambda\rangle=\lambda|\lambda\rangle$, the probability of observing $\lambda$ is $P(\lambda)=\left|\langle\lambda|\psi\rangle\right|^{2}$. This occurs because we can expand the state $|\psi\rangle$ as a sum over the complete set of normalized eigenstates
$$|\psi\rangle=\sum_{\lambda_{j}}c_{j}|\lambda_{j}\rangle;$$
the probability that, if $A$ is measured, it will be found in a particular eigenstate $\lambda_{j}$ is $|c_{j}|^{2}$, and since the $|\lambda_{j}\rangle$ are orthonormal (meaning $\langle\lambda_{j}|\lambda_{k}\rangle=\delta_{jk}$), $c_{j}=\langle\lambda_{j}|\psi\rangle$.
For an operator $A$ with a continuous spectrum of eigenvalues (like $x$ or $p$), the expansion in eigenstates becomes an integral, and $\left|\langle\lambda|\psi\rangle\right|^{2}$ is the probability density $\wp(\lambda)$ in $\lambda$-space.  For example, the probability density in space is simply
$$\wp(x)=\left|\langle x|\psi\rangle\right|^{2}=\psi^{*}(x)\psi(x),$$
so that $1=\int dx\,\wp(x)$ and $\langle x\rangle=\int dx\,x\wp(x)$. For the
probability density in the wave number $k=p/\hbar$, we similarly have $\wp(k)=\left|\langle k|\psi\rangle\right|^{2}$.  In that case, the normalized state $|k\rangle$ is
$$\langle x|k\rangle=\frac{1}{\sqrt{2\pi}}e^{ikx}.$$
The normalization constant is chosen so that
$$\langle k'|k\rangle=\int dx\,\left(\frac{1}{\sqrt{2\pi}}e^{-ikx'}\right)
\left(\frac{1}{\sqrt{2\pi}}e^{ikx}\right)=\delta(k-k'),$$
is normalized in the same way as $\langle x'|x\rangle=\delta(x-x')$. This means that
$$\langle k|\psi\rangle=\int dx\,\left(\frac{1}{\sqrt{2\pi}}e^{-ikx}\right)
\psi(x)$$
is just the Fourier transform $\tilde{\psi}(k)$, and $\wp(k)=\left|\tilde{\psi}(k)\right|^{2}$, as expected.
The other complication is that when $A$ has degenerate eigenvalues, you have to sum the overlap probabilities (or probability densities) of finding $|\psi\rangle$ in each orthogonal eigenstate in the eigenvalue-$\lambda$ subspace.
A: The finite-dimensional case is simplest, so let's begin there.  If an operator $A$ is self-adjoint, then it can be decomposed as
$$A:= \sum_{\lambda\in \Lambda} \lambda \cdot \Pi_\lambda^A$$
where $\Lambda$ is the set of eigenvalues of $A$ and $\Pi^A_\lambda$ is the orthogonal projection operator onto the eigenspace of $A$ corresponding to the eigenvalue $\lambda$.  As a few examples,
$$A = \pmatrix{2 & 0 \\ 0 & 4} = 2 \cdot \pmatrix{1&0\\0&0} + 4\cdot \pmatrix{0&0\\0&1}$$
$$B = \pmatrix{0 & 1 \\ 1 &0} = 1 \cdot \pmatrix{\frac{1}{2} & \frac{1}{2} \\ \frac{1}{2} & \frac{1}{2}} + (-1) \cdot \pmatrix{\frac{1}{2} & -\frac{1}{2}\\-\frac{1}{2} & \frac{1}{2}}$$
For a system in the pure state $\psi$, the probability of measuring the observable (represented by) $A$ to have value $\lambda$ is given by the following:
$$\mathrm{Prob}_\psi(A,\lambda):= \frac{\langle \psi,\Pi_\lambda^A \psi\rangle}{\langle \psi,\psi\rangle}$$

In order to frame this somewhat more cleanly in terms of probability theory, we generalize this as follows.  Let $E\subseteq \mathbb R$ be some set of possible measurement results (e.g. "we measured the observable $A$ to lie in the set $E$"). We define a map $\mu_A$ which has the following properties:

*

*$\mu_A(\mathbb R) = \mathbb I$, the identity map on the Hilbert space

*$\mu_A(\emptyset) = 0$, the zero map on the Hilbert space

*If $E_i$ are a countable collection of disjoint subsets of $\mathbb R$, then
$$\mu_A\left(\bigcup_i E_i\right) = \sum_i \mu_A(E_i)$$

*For each $\lambda \in \Lambda$, $\mu_A(\{\lambda\}) = \Pi^A_\lambda$
A map satisfying properties 1-3 is called a projection-valued measure; property 4 provides the unique PVM associated to the self-adjoint operator $A$. Given the appropriate PVM, we can map a set $E$ - representing a possible outcome of a measurement - to a projection operator $\mu_A(E)$; from there, it is this projection operator to which we assign a probability.
In that sense, the projection operator $\mu_A(E)$ plays the role of an event which may be familiar from probability theory, while the state $\psi$ plays the role of a probability measure
$$\mu_A(E) \mapsto \frac{\langle \psi,\mu_A(E)\psi\rangle}{\langle\psi,\psi\rangle}\in [0,1] \qquad (\star)$$
To recap: given an observable $A$, we can decompose it as a linear combination of projection operators. The projection-valued measure $\mu_A$ associates a measurement outcome $E$ with a projection operator $\mu_A(E)$. Given a state $\psi$, the probability of measuring $A$ to have a value in $E$ is then given by $(\star)$.

The generalization to infinite-dimensional Hilbert spaces is immediate, provided that the spectrum of $A$ is discrete.  However, infinite-dimensional Hilbert spaces bring with them the possibility that the spectrum of $A$ is continuous, or possibly a mixture of both discrete and continuous.
The spirit of the above discussion remains precisely the same; the major technical distinction comes in how one defines a PVM for a continuous spectrum.  I think the clearest way to do this is by example.
Position Operator
The PVM associated to the position operator (in the position basis) is given by
$$\mu_X(E):= \chi_E \mathbb I \quad \text{ where }\quad \chi_E(x)=\begin{cases} 1 & x\in E \\ 0 & x\notin E\end{cases}$$
is the indicator function on $E$.  Given a wavefunction $\psi$ (which I assume to be normalized, purely for convenience), the question "what is the probability of measuring $X$ to lie in $E$?" is answered by
$$\mathbb P_\psi(X,E) :=\langle \psi, \mu_X(E)\psi\rangle = \int_\mathbb R \chi_E(x)\cdot  |\psi(x)|^2 \mathrm dx = \int_E |\psi(x)|^2\mathrm dx$$
which is indeed what we learned in our first class in quantum mechanics.
Momentum Operator
The PVM associated to the momentum operator is (unsurprisingly) the indicator function in the momentum basis.  In the position basis, one first takes the Fourier transform, then multiplies by the indicator function, then inverse-Fourier transforms back:
$$\mathbb P_\psi(P,E) :=\langle \psi, \mu_P(E)\psi\rangle = \int_\mathbb R \chi_E(p)\cdot  |\tilde\psi(p)|^2 \mathrm dp = \int_E |\tilde\psi(p)|^2\mathrm dp$$
where $\tilde \psi(p) = \frac{1}{\sqrt{2\pi\hbar}}\int \psi(x) e^{-ipx/\hbar} \mathrm dx$ is the Fourier transform of $\psi(x)$.

In the preceding examples, we saw that the PVM was either an indicator function or an indicator function conjugated with a unitary operator (in this case, the Fourier transform operator); this is a general feature.  That is, for every observable $A$ with continuous spectrum, the projection-valued measure can be expressed as
$$\mu_A(E) = U^\dagger \cdot \chi_E \mathbb I  \cdot U$$
for some unitary operator $U$, which in physics parlance transforms us to the (continuous) eigenbasis of $A$. In this light, the standard procedure of solving for the (non-normalizable) eigenfunctions of $A$ can be viewed as a quest to find this $U$.
As a final note, in the above description we defined probability measures (i.e. maps which assign probabilities to projection operators) via elements of the Hilbert space $\psi$ as $\Pi \mapsto \frac{\langle \psi,\Pi\psi\rangle}{\langle\psi,\psi\rangle}$.  It turns out that this is not the most general notion of probability measure we could use. Given a density matrix $\rho$, the appropriate probability measure is given by
$$\Pi \mapsto \mathrm{Tr}\big(\Pi \rho)\in [0,1]$$
but other than that, the formalism remains the same.
A: I would try to give a TL;DR version of the existing elaborate answers.

*

*Given a state $\vert \psi\rangle$ and an operator $\hat{A}=\sum_{a} a\vert a\rangle \langle a\vert$, the probability distribution $P(a)$ over the eigenvalues of $\hat{A}$ is given by $P(a)=\langle\psi\vert a\rangle\langle a\vert\psi\rangle = \psi^*(a)\psi(a)$.

*Given a state $\vert \psi\rangle$ and an operator $\hat{A}=\int da\  a\vert a\rangle\langle a\vert$, the probability density distribution $\rho(a)$ over the eigenvalues of $\hat{A}$ is given by $\rho(a)=\langle\psi\vert a\rangle\langle a\vert\psi\rangle = \psi^*(a)\psi(a)$.

*Given a state $\vert \psi\rangle$ and an operator $\hat{A} =\sum _a a\vert a\rangle\langle a\vert +\int db\ b\vert b\rangle\langle b\vert$, the probability distribution $P(a)$ over its discrete eigenvalues is given by $P(a)=\langle\psi\vert a\rangle \langle a\vert \psi\rangle = \psi^*(a)\psi(a)$ and the probability density distribution $\rho(b)$ over its continuous eigenvalues is given by $\rho(b)=\langle \psi\vert b\rangle\langle b\vert\psi\rangle = \psi^*(b)\psi(b)$.

