## On reducible polynomials with positive coefficients, $1$ as constant coefficient and certain bounds on coefficients

Given $a \in \mathbb{Z}$ with $a > 1$. Let $g(x) \in \mathbb{Z}[x]$ be a polynomial with $g(a)=\pm 1$. Let $h(x) \in \mathbb{Z}[x]$ be a polynomial with $h(a)= p$, a prime. Let $g(x)$ and $h(x)$ have not all coefficients negative nor positive. Can $g(x)h(x)$ have only positive or only negative coefficients? Is there a way to generate such polynomials? What if $a < 1$? The motivation is to test if a given polynomial has only positive coefficients and assumes a prime value at a positive integer larger than $1$, then it is irreducible.

I got good answers for the above question. The answer includes the phrase "...the last few coefficients of $g(x)h(x)$ are large enough...". Is there a way to overcome this?

The given polynomials $g(x)$ and $h(x)$ have constant coefficient $\pm 1$ with $g(x)h(x)$ having constant coefficient $1$, $g(a)h(a)$ a prime for some $a > 1$, say $a=2$.

-
Please do not omit the 'ac.' prefix (I changed it). Also providing some motivation for this question seems like a good idea. – quid Feb 12 at 12:36
Posted earlier to m.se, math.stackexchange.com/questions/300055/… – Gerry Myerson Feb 12 at 22:32
@Gerry Could not delete that question since someone posted an answer that does not satisfy the needs – unknown (google) Feb 12 at 22:52
You are really getting on my nerves. Every time someone solves your problem, you move the goalposts. 15 revisions! Why don't you go away for a couple of weeks, think your problem through from every angle, and, when you are finally sure that you really, really, really are ready to state your problem in full, come back and ask your question. – Gerry Myerson Feb 14 at 11:16
@Gerry: I feel the same... – Ilya Bogdanov Feb 14 at 11:43

$$g(x)h(x)=(x^2-4x+5)(x^{14}+5x^{13}+16x^{12}+40x^{11}+81x^{10}+125x^9+96x^8$$ $$\qquad -x^7+6x^5+25x^4+71x^3+160x^2+286x+355)$$ $$=x^{16}+x^{!5}+x^{14}+x^{13}+x^{12}+x^{11}+x^{10}+240x^9+484x^8$$ $$+ x^7 + x^6 + x^5 + x^4 + x^3 + 11x^2 + 10x + 1775.$$ $g(2)=1$, $h(2)=378919$.

In fact, it is known that each polynomial with no nonnegative real roots has a multiple with only positive coefficients. Moreover, there exists a large variety of such polynomials, hence there is nothing special in such an example.

So, having obtained $h(x)$ such that the last few coefficients of $g(x)h(x)$ are large enough, you may change few its last coefficients to make $h(a)$ prime. That's how this concrete example was obtained: first, I have found one by one the coefficients of $h(x)$ so that the first coefficients of the product are ones and the next two are positive, then I have added the negative coefficient and repeated the procedure, and then I have changes the last coefficient to make $h(2)$ prime.

It might be helpful to notice the following fact. If $g(x)$ has a complex root with argument $\alpha$, then each its multiple $p(x)$ with nonnegative coefficients has the degree at least $\pi/\alpha$. To see this, just substitute that root into $p(x)$ and look at the sign of the imaginary part.

EDIT, I'm a bit lazy to construct an explicit example with the last coefficients $\pm1$, sorry; but here is the way.

Take $g(x)=x^2(x-2)^2+1$. In the same way you may find the polynomial $h(x)$ such that $g(x)h(x)$ has positive coefficients (and $h(x)$ does not) --- since $g(x)$ has no nonnegative real roots. Next, consider $g_1(x)=x^4g(1/x)$ and construct the corresponding polynomial $h_1(x)$, say of degree $n$ (we need $h_1$ to have $1$ as the leading coefficient; it is surely possible).

It remains to notice that $g(x)(x^{n+5}h(x)+x^nh_1(1/x))$ is almost the desired example; you just need to change the appropriate coefficients of $h$ and $h_1$ to make the corresponding value prime. I am almost sure thath this is possible...

Notice that one may even decrease the exponent $n+5$ (the only fact to check is that the second factor should have a negative coefficient, and that of $h(x)$ is somewhere in the middle).

-
 pretty good example and explanation – unknown (google) Feb 13 at 19:24 what if $g(x)h(x)$ has last constant coefficient $1$? – unknown (google) Feb 13 at 19:29 I have added the way of constructing such an example. – Ilya Bogdanov Feb 14 at 7:29 Well, the construction blows up not the higher terms, but the terms in the middle... – Ilya Bogdanov Feb 14 at 11:51

\eqalign{g(x)h(x)&=(5x^3+14x^2-3x+1)(x^3-x^2+4x+1)\cr&=5x^6+9x^5+3x^4+65x^3+3x^2+x+1\cr}

$g(-3)=1$, $h(-3)=-47$.

-
 Thankyou for the answer – unknown (google) Feb 12 at 23:06 Do you have an example for $a > 1$? – unknown (google) Feb 13 at 1:19 No, nor do I have a firm opinion on whether one's possible. To make the coefficients of the product all positive, I think you want the negative coefficients in the factors to be few and small, which tends to make the factors big at positive arguments. But maybe you can get around that tendency by going to higher degree. – Gerry Myerson Feb 13 at 4:40 how high of a degree do you expect? – unknown (google) Feb 13 at 6:15 Sorry, I'm all out of intuition. I'll defer to Ilya. – Gerry Myerson Feb 13 at 22:02
show 1 more comment