# Number of solutions for the inequality with square roots

Let $M$ be some large real number and $\delta>0$. I would like to estimate the number of solutions for the inequality

$$|\sqrt{n_1}+\sqrt{n_2}-\sqrt{n_3}-\sqrt{n_4}|<\delta\sqrt{M},$$

where $n_i$ are positive integers with $M<n_i\leq 2M$ for all $1\leq i\leq 4$. Let us denote this quantity by $N(M,\delta)$.

There is a paper by O.Robert and P.Sargos which provides the bound for a bit more general quantity. In our case their work gives

$$N(M,\delta)\ll M^{2+o(1)}+\delta M^{4+o(1)}.$$

I think, some heuristics suggest that when $\delta\gg 1$ this bound is more or less optimal. But I'm interested in the case when $\delta=o\left(\frac{1}{M}\right)$. So, my question is: can the bound of Robert and Sargos be improved for small $\delta$ and when should we expect that $N(M,\delta)\ll M^{2+o(1)}$? For example, we always have $N(M,M^{-2})\ll M^{2+o(1)}$ but can we do better (i.e. prove this bound for larger $\delta$) or at least are there any conjectures about this?

For $\delta\geq 1$, the inequality is automatic, hence $N(M,\delta)=M^4$.
For $\delta<1$, the bound by Robert and Sargos is optimal up to the $o(1)$ in the exponent, and actually they mention this right before their Theorem 1. They do not give the proof, but the claim follows easily from their Lemma 1, which is a special case of Lemma 2.1 in Watt: Exponential sums and the Riemann zeta-function II (J. London Math. Soc. 39 (1989), 385-404.). For convenience, I give a proof from scratch, using Watt's ideas.
We assume $\delta<1$. It is clear that $$N(M,\delta)\geq\sum_{M<m_1,m_2,m_3,m_4\leq 2M}\max\left(0,1-\left|\frac{\sqrt{m_1}+\sqrt{m_2}-\sqrt{m_3}-\sqrt{m_4}}{\delta\sqrt{M}}\right|\right).$$ By Fourier analysis (cf. triangular function), the $\max(0,\dots)$ term on the right hand side equals $$\int_{-\infty}^\infty\left(\frac{\sin\pi t}{\pi t}\right)^2\ e\left(\frac{\sqrt{m_1}+\sqrt{m_2}-\sqrt{m_3}-\sqrt{m_4}}{\delta\sqrt{M}}\,t\right)dt,$$ where $e(x):=\exp(2\pi ix)$ as customary in analytic number theory. Hence, introducing the exponential generating function $$f(x):=\sum_{M<m\leq 2M}e\bigl(\sqrt{m}x\bigr),$$ we can rewrite the above lower bound as $$N(M,\delta)\geq\int_{-\infty}^\infty\left(\frac{\sin\pi t}{\pi t}\right)^2\ \left|f\left(\frac{t}{\delta\sqrt{M}}\right)\right|^4\,dt.$$ The integrand is nonnegative, and for $|t|<\delta/\sqrt{128}$ it exceeds $6M^4/25$. The latter is because, for $|x|<1/\sqrt{128M}$, each term in $f(x)$ has real part exceeding $1/\sqrt{2}$, so that $|f(x)|>M/\sqrt{2}$. We conclude that $$N(M,\delta)>\frac{2\delta}{\sqrt{128}}\cdot\frac{6M^4}{25}>\frac{\delta M^4}{24}.$$ On the other hand, it is obvious that $N(M,\delta)\geq M^2$, hence we proved for $\delta<1$ that $$N(M,\delta)>\frac{M^2+\delta M^4}{25}.$$