Does there exist a function $f : \mathbb{R} \rightarrow \mathbb{R}$ such that $f > 0$ and $$ \int_{-\infty}^\infty f(x) dx = \int_{-\infty}^\infty f(x)^2 dx = 1. $$
I suspect the answer is yes. I have looked at taking $f$ to be the PDF of a normal distibution $\mathcal N(0, \sigma)$ to guarantee that $f > 0$ and integrates to give $1$. I'm thinking about using IVT to find a value of $\sigma$ that works. However, in order to do this, I'm not entirely sure how to integrate $e^{x^4}$.
It is possible. Take
$$f(x) = 2 e^{-4|x|}$$
$\int_{\Bbb{R}} f \:dx = \int_{\Bbb{R}} f^2 \:dx = 1$ as desired.