# Computing braket with exponentials when derivating the classical partition function from the quantum function

I am currently reading David Tong's notes on statistical physics (Page 33) where, just before finishing the derivation of the classical partition function, he obtains the following equation $$Z=\int{dqdpdp' e^{-\beta V(q)} \langle{p|q}\rangle \langle{p|e^{-\beta\hat{p}^2/2m}|p'}\rangle \langle{p'|q}\rangle }.$$ I am stuck at this point, mainly because I am not that used to work with quantum physics, so I don't know how to compute $$\langle{p|e^{-\beta\hat{p}^2/2m}|p'}\rangle$$

Just by looking at the solution and trying to guess, the only thing I can come up with is that$$\langle{p|e^{-\beta\hat{p}^2/2m}|p'}\rangle = e^{-\beta p^2/2m} \langle{p|p'}\rangle = e^{-\beta p^2/2m} \delta (p'-p)$$ But even if that was correct and not a stupid guess, I still wouldn't know why it holds.

$$e^\hat{A}=\sum_{n=0}^\infty \frac{(\hat{A})^n}{n!}.$$
In your case, since $$|p'\rangle$$ is an eigenstate of $$\hat p$$ with eigenvalue $$p'$$, the eigenvalue of the operator $$\exp(-\beta\hat{p}^2/2m)$$ is, indeed, $$\exp(-\beta (p')^2/2m)$$. So $$e^{-\beta\hat{p}^2/2m}|p'\rangle=e^{-\beta (p')^2/2m}|p'\rangle.$$
Note that you got the $$p$$ without the $$'$$, so it is as if you had applied the exponential operator to the bra $$\langle p|$$, which in this case is also correct because the operator in the exponent is hermitian. Anyway, since there is a delta later, the result is the same in both cases.