Eigenstates of momentum and energy of a free particle Given the momentum operator $\hat{P}:= \frac{\hbar}{i}\frac{d}{dx}$, as I understand, the eigenvalue equations are $$\hat{P}f_{p}(x)= \frac{\hbar}{i}\frac{d}{dx}f_{p}(x) = p f_{p}(x)$$ and the eigenfunctions which correspond to this are $$f_{p}(x) = A e^{\frac{ipx}{\hbar}}.$$ Given then that the square of this operator $\hat{P}^2$ commutes with $\hat{P}$, so $[\hat{P}, \hat{P}^2] = 0$, it follows that the two operators share a common set of eigenstates which form a basis (apparently in something called a rigged Hilbert space) such that any quantum state, represented as a member of some Hilbert space can be written as a linear combination of elements of these basis vectors (this is a postulate of QM).
Question: I know that all eigenvectors of $\hat{P}$ are eigenvectors of $\hat{P}^2$ (which are of the form $f_{p}(x) = A e^{\frac{ipx}{\hbar}}$) this is easy to show. But what are the eigenvectors of $\hat{P}^2$ which are not eigenvectors of $\hat{P}$ and can you form a basis of such vectors?  Thanks.
 A: You ask for

the eigenvectors of $\hat{p}^2$ which are not eigenvectors of $\hat{p}$.

These do exist: each plane wave $|p⟩$ is an eigenvector of $\hat p$ with eigenvalue $p$, and an eigenvector of $\hat{p}^2$ with eigenvalue $p^2$, which means that the plane wave $\left|-p\right>$ has the same eigenvalue of $\hat{p}^2$. This means, in turn, that any linear combination of the two will still be an eigenvector of $\hat{p}^2$.
As a quick example of how you turn these into a basis, you can simply consider the basis
$$
\left\{\frac{\left|p\right>+\left|-p\right>}{\sqrt{2}}\middle|\, p\geq0\right\}
\bigcup
\left\{\frac{\left|p\right>-\left|-p\right>}{\sqrt{2}}\middle|\,   p<0\right\}
,
$$
which consists of the real-valued plane waves with position-representation wavefunctions
$$
\left<x\right|\frac{\left|p\right>+\left|-p\right>}{\sqrt{2}}
=
\frac{1}{\sqrt{\pi}}\cos(px)
\quad\text{and}\quad
\left<x\right|\frac{\left|p\right>-\left|-p\right>}{\sqrt{2}}
=
\frac{i}{\sqrt{\pi}}\sin(px)
,
$$
respectively. It should be a relatively easy exercise for you to transform the completeness relation over the $|p⟩$ states to show that these are a basis. (While doing that, by the way, never mind the zero: all your integrals are Lebesgue integrals, and pointwise values do not matter.)
In three dimensions, of course, it becomes a bit more complicated (you need to change the condition $p>0$ for a set that includes half of all $p$ space, for this example) but you also have more freedom, as there is a much bigger set of $\mathbf p$s that share the same $p^2$.
A: Assume the dimension of the space is $D$.
Let $f:L(\Phi)\rightarrow L(\Phi)$ be a function which carries linear operators to linear operators that is in the closure of polynomial functions.
Consider $f(P)|\psi\rangle=E|\psi\rangle$ where $|\psi\rangle\neq0$. Thus:
$$\langle q|f(P)|\psi\rangle=f(q)\langle q|\psi\rangle=E\langle q|\psi\rangle$$
Since $|\psi\rangle\neq0$, there is at least a $q$ such that $\langle q|\psi\rangle\neq0$ and so $E=f(q)$ (Here we used the fact that $f$ is in the closure of polynomial functions). If $f(p)\neq f(q)$ then $\langle p|\psi\rangle=0$ ($E$ is a constant number). Conversely, if $f(p)=f(q)=E$, then $f(P)|p\rangle=E|p\rangle$ and because $\int d^Dp |p\rangle\langle p|=I$ so:
$$|\psi_{q}\rangle=\int_{f(p)=f(q)} dp \alpha(p) |p\rangle$$
which $q$ varies over $\mathbb{R}^D$ and $\alpha$ is a function. Hence, if $f$ is injective, then an eigenvector of $f(P)$ is $|q\rangle $ that its eigenvalue is equal to $E=f(q)$. That is why the eigenvectors of the time evolution operator is exactly those of the Hamiltonian.
In your case, $f(p)=p^2$ and it is not injective so the eigenvectors of $P^2$ is in this form:
$$|\psi_{q}\rangle=\int_{p^2=q^2} dp \alpha(p) |p\rangle$$
which $q$ varies over $\mathbb{R}^D$ and $\alpha$ is a function.
