Is there a real valued positive function such that it and its square integrate to $1$ 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}$.

For $a>0$, $p>1$, we have
$$
\int _0^{\infty} \frac{1}{(a+x)^p}\,dx=\frac{a^{1-p}}{p-1}
$$Similarly, for $b>0$, we have
$$
\int _{-\infty}^0 e^{bx}\,dx = \frac{1}{b}
$$So if we let $f(x):\mathbb{R}\to\mathbb{R}$,
$$
f(x) = \begin{cases}
e^{bx}, & x <0\\
\frac{1}{(a+x)^p},& x\geq 0
\end{cases}
$$the question amounts to finding $(a,b,p)$ such that:
$$
\begin{cases}
\frac{1}{b} + \frac{a^{1-p}}{p-1} & = 1\\
\frac{1}{2b} + \frac{a^{1-2p}}{2p-1} & = 1\\
\end{cases}
$$Mathematica gives one solution as (approximately) $( 0.80297, 2.50859,5)$. You could probably modify this example to be continuous or even differentiable.
If you don't require $f(x)>0$, a well-known example is $\sin(x)/x$, where both it and its square integrate to $\pi$.
