The decidability of a problem involving univariate integer polynomials

Suppose that we are given $f_1(x),...,f_n(x) \in \mathbb{Z}[x]$. Decide whether there exist $a_1,...,a_n \in \mathbb{Z}$ such that

$\sum_{i=1}^{n} a_if_i(x) = p(x)^2$

$p(x) \in \mathbb{Z}[x]$.

In other words, decide whether there are integer coefficients such that a linear combination of the given polynomials is a perfect square.

For example, if we have

$f_1(x) = x$ and $f_2(x) = x^2 + 1$

as input, then we have that

$2f_1(x) + f_2(x) = x^2 + 2x + 1 = (x+1)^2$.

So given the input $f_1(x), f_2(x)$ we would want to answer yes.

My first thought of attacking this problem was to plug in a sufficient number of points for $x$ so that we can solve it as a system of diophantine equations with some non-linear constraints.

So we would get a system like:

$\sum_{i=1}^{n} a_if_i(1) - b_1 = 0$

$\sum_{i=1}^{n} a_if_i(2) - b_2 = 0$

...

$\sum_{i=1}^{n} a_if_i(k) - b_k = 0$

$c_1^{2} - b_1 = 0$

...

$c_k^{2} - b_k = 0$

for $a_i, b_i, c_i \in \mathbb{Z}$ and for sufficiently large k.

I am not sure whether this is an erroneous way of trying to attack the problem, but looked reasonable to me as a first guess.

Whether a solution exists to a non-linear diophantine equation in general is an undecidable problem. So it appears plausible that this problem is undecidable as well, but a proper proof looks beyond my ability. So, does anyone have any suggestions, further information on related problems or even an undecidability proof?

• I was thinking of letting $p(x) = \sum_i a_i f_i(x)$ and supposing $p(x) = q(x)^2$ for some $q(x)$, expanding, and equating coefficients. Unfortunately this gives us a system of quadratic Diophantine equations in the unknowns (the coefficients of $q(x)$ and the $a_i$'s), and in general checking whether a system of quadratic Diophantine equations has any solutions is not decidable. So that approach got me nowhere. – D.W. Jun 1 '18 at 22:33
• Setting all $a_i$ to zero would give a trivial solution, but probably you do not want that. – Hendrik Jan Jun 2 '18 at 18:23
• @Hendrik Jan, I was thinking that 0 is not a square polynomial so that a non-triviality constraint is unnecessary. I just googled whether 0 is defined to be a square number and it seems that there is no clear consensus on the way to define it. You could be talking about the Diophantine system, in which case, yes, it would need to be non-trivial. – Kevin Jun 2 '18 at 18:46