  Given a linear equation of the form $a_1x_1 + a_2x_2 + a_3x_3 = 0$ with
integer coefficients $a_i$, we are interested in maximising the number of
solutions to this equation in a set $S \subseteq \mathbb{Z}$, for sets $S$ of a
given size.
  We prove that, for any choice of constants $a_1, a_2$ and $a_3$, the maximum
number of solutions is at least $\left(\frac{1}{12} + o(1)\right)|S|^2$.
Furthermore, we show that this is optimal, in the following sense. For any
$\varepsilon > 0,$ there are choices of $a_1, a_2$ and $a_3,$ for which any
large set $S$ of integers has at most $\left(\frac{1}{12} +
\varepsilon\right)|S|^2$ solutions.
  For equations in $k \geq 3$ variables, we also show an analogous result. Set
$\sigma_k = \int_{-\infty}^{\infty} (\frac{\sin \pi x}{\pi x})^k dx.$ Then, for
any choice of constants $a_1, \dots, a_k$, there are sets $S$ with at least
$(\frac{\sigma_k}{k^{k-1}} + o(1))|S|^{k-1}$ solutions to $a_1x_1 + \dots +
a_kx_k = 0$. Moreover, there are choices of coefficients $a_1, \dots, a_k$ for
which any large set $S$ must have no more than $(\frac{\sigma_k}{k^{k-1}} +
\varepsilon)|S|^{k-1}$ solutions, for any $\varepsilon > 0$.
