The modern optical telescopes produce a huge number of asteroid observations, that are grouped into very short arcs (VSAs), each containing a few observations of the same object in one single night. To decide whether two VSAs, collected in different nights, refer to the same observed object we can attempt to compute an orbit with the observations of both arcs: this is called the linkage problem. Since the number of orbit computations to be performed is very large, we need efficient methods of orbit determination. Using the first integrals of Kepler's motion we can write algebraic equations for the linkage problem, which can be put in polynomial form. The equations introduced in (Gronchi et al. 2015) can be reduced to a univariate polynomial of degree 9: the unknown is the topocentric distance $\rho$ of the observed body at the mean epoch of one of the VSAs. Using elimination theory we show an optimal property of this polynomial: it has the least degree among the univariate polynomials in the same variable that are consequence of the algebraic conservation laws and are obtained without squaring operations, that can be used to bring these algebraic equations in polynomial form. In this paper we also introduce a procedure to join three VSAs belonging to different nights: from the conservation of angular momentum at the three mean epochs of the VSAs, we obtain a univariate polynomial equation of degree 8 in the topocentric distance $\rho_2$ at the intermediate epoch. This algorithm has the same computational complexity as the classical method by Gauss, but uses more information, therefore we expect that it can produce more accurate results. For both methods, linking two and three VSAs, we also discuss how to select the solutions, making use of the full two-body dynamics, and show some numerical tests comparing the results with the ones obtained by Gauss' method., Comment: 20 pages, 1 figure