<s>[INST] Fourier Transforming the Klein Gordon Equation Starting with the Klein Gordon in position space,
\begin{align*}
\left(\frac{\partial^2}{\partial t^2} - \nabla^2+m^2\right)\phi(\mathbf{x},t) = 0
\end{align*}
And using the Fourier Transform: $\displaystyle\phi(\mathbf{x},t) = \int \frac{d^3p}{(2\pi)^3}e^{i \mathbf{p} \cdot\mathbf{x}}\phi(\mathbf{p},t)$:
\begin{align*}
\int \frac{d^3p}{(2\pi)^3}\left(\frac{\partial^2}{\partial t^2} - \nabla^2+m^2\right)e^{i \mathbf{p} \cdot\mathbf{x}}\phi(\mathbf{p},t)&=0 \\
\int \frac{d^3p}{(2\pi)^3}e^{i \mathbf{p} \cdot\mathbf{x}}\left(\frac{\partial^2}{\partial t^2} +|\mathbf{p}|^2+m^2\right)\phi(\mathbf{p},t)&=0
\end{align*}
Now I don't understand why we are able to get rid of the integral, to be left with \begin{align*}
\left(\frac{\partial^2}{\partial t^2} +|\mathbf{p}|^2+m^2\right)\phi(\mathbf{p},t)=0
\end{align*}
 [/INST] The reason you can get rid of the integral and the exponential is due to the uniqueness of the Fourier transform. Explicitly we have,
\begin{align} 
\int \frac{ \,d^3p }{ (2\pi)^3 } e ^{ i {\mathbf{p}} \cdot {\mathbf{x}} } \left( \partial _t ^2 +  {\mathbf{p}} ^2 + m ^2  \right)  \phi ( {\mathbf{p}} , t ) & = 0 \\ 
\int d ^3 x \frac{ \,d^3p }{ (2\pi)^3 } e ^{ i ( {\mathbf{p}} - {\mathbf{p}} ' ) \cdot {\mathbf{x}} } \left( \partial _t ^2 + {\mathbf{p}} ^2 + m ^2  \right)  \phi ( {\mathbf{p}} , t ) & = 0 \\ 
 \left( \partial _t ^2 + {\mathbf{p}} ^{ \prime 2} + m ^2 \right)  \phi ( {\mathbf{p}'} , t ) & = 0
\end{align} 
where we have used,
\begin{equation}
\int d ^3 x e ^{- i ( {\mathbf{p}} - {\mathbf{p}} ' ) \cdot x } = \delta ( {\mathbf{p}} - {\mathbf{p}} ' ) 
\end{equation}
and 
\begin{equation} 
\int \frac{ d ^3 p }{ (2\pi)^3 } \delta ( {\mathbf{p}} - {\mathbf{p}} ' ) f ( {\mathbf{p}} ) = f ( {\mathbf{p}} ' ) 
\end{equation}
</s>