TITLE: Absolute values of two functions and absolute values of their Fourier transform coincides
QUESTION [6 upvotes]: Let $f, g \in L^2(\mathbb{R})$.
Is it true that if both $|f|=|g|$ and $|\hat f|=|\hat g|$ hold, then there exists $\theta \in \mathbb{R}$ such that $f=ge^{i\theta}$?
I am not able to prove it or disprove it. I suspect that this is true. Do you have a reference for this?

REPLY [9 votes]: This is true. This was proved by Hardy and Littlewood and the proof is reproduced in Zygmund's Trigonometric Series (which I don't have access to at the moment).
(Contradicting my prior "answer")
The answer to this question is negative. Such counterexamples are known as "Pauli partners" and are studied in, among other places, the quantum mechanics literature.
See, for example:
(J. V. Corbett and C. A. Hurst) Are Wave Functions Uniquely Determined by their position and momentum distributions? [https://www.cambridge.org/core/services/aop-cambridge-core/content/view/228E4A34D0B3C63C54B1A01006278C42/S0334270000001569a.pdf/are-wave-functions-uniquely-determined-by-their-position-and-momentum-distributions.pdf]
(P. Jaming) Phase Retrieval Techniques for Radar Ambiguity Problems [https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.521.4906&rep=rep1&type=pdf]