# Quantum Mechanics Gaussian Wave Packet: $\langle p^2 \rangle$ Comes out negative [closed]

I am currently doing a problem in *Introduction to Quantum Mechanics, 2nd edition Griffiths *

QUESTION

In question 2.22 part D, we are asked to calculate $\langle p^2 \rangle$ for the Gaussian Wave packet $$\Psi(x,0) = A e^{-ax^2}$$ In an earlier problem we calculate the normalization constant $A = (\frac{2a}{\pi})^\frac{1}{4}$

PROBLEM

I tried calculating $\langle p^2 \rangle$ by letting the operator $p$ be $$p = -i \hbar \frac{\partial}{\partial x} \Rightarrow p^2 = -\hbar^2 \frac{\partial^2}{\partial x^2}$$ Hence I get \begin{eqnarray} \langle p^2 \rangle &=& \int_{-\infty}^{\infty} A e^{-ax^2}-\hbar \frac{\partial^2}{\partial x^2}Ae^{-ax^2}dx\\ &=& A^2 -\hbar^2 \int_{-\infty}^{\infty} e^{-ax^2} 4a^2e^{-ax^2}dx\\ &=&A^2 -\hbar^2 4a^2 \int_{-\infty}^{\infty} e^{-ax^2} e^{-ax^2} dx\\ &=&A^2 -\hbar^2 4a^2 \int_{-\infty}^{\infty} e^{-2ax^2} dx \\ &=&A^2 -\hbar^2 4a^2 2\int_{0}^{\infty} e^{-2ax^2}dx \\ &=&A^2 -\hbar^2 4a^2 2 \frac{1}{2} (\frac{\pi}{a})^\frac {1}{2} \\ &=&(\frac{2a}{\pi})^\frac{1}{2} -\hbar^2 4a^2 (\frac{\pi}{a})^\frac {1}{2} \\ &=&(2)^\frac{1}{2} -\hbar^2 4a^2 \end{eqnarray} However this answer is wrong and the correct answer is $$\langle p^2 \rangle = a \hbar^2$$ I looked at the solutions manual and they way they did it was completely different and instead they substituted for a bunch of different variables. My question is why wouldn't the method I tried to do work with this wave function?

$$\frac{\partial^2}{\partial x^2}e^{-ax^2}=\frac{\partial}{\partial x}(-2axe^{-ax^2})=4a^2x^2e^{-ax^2}-2ae^{-ax^2}$$
Further to proton's answer, if you want to compute the state-$|\psi\rangle$ mean of an operator of the form $\hat{A}^\dagger\hat{A}$ (which simplifies to $\hat{A}^2$ for Hermitian $\hat{A}$) more easily, you can just take the inner product of $\hat{A}|\psi\rangle$ with itself. In this case $\hat{p}Ae^{-ax^2}=2i\hbar Aaxe^{-ax^2}$, so the desired mean is $\int_\mathbb{R}4|A|^2\hbar^2 a^2e^{-2ax^2}dx$.