P(x) = (g1(x) + 1)(g2(x) + 2)
where P(x) is a quadratic with integer coefficients, g1(0) = g2(0) = 0, but g1(x) does not equal 0 for all x.
(Updating October 26, 2017, to correct wrong beliefs about existence in ring of algebraic integers. Was able to simply remove from this earlier section so was easy.)
I pushed the envelope by imagining the quadratic is what's called primitive and irreducible over Q, which means that it does NOT factor into polynomials.
And I showed stepping through some simple algebraic manipulations where I multiplied by 7, but this time I will multiply by k, where k is a nonzero integer, and not 1 or -1:
Introduce new functions f1(x), and f2(x), where I'll use the second one first, as let
g2(x) = f2(x) + k-2.
Now make the substitution:
P(x) = (g1(x) + 1)(f2(x) + k - 2 + 2) = (g1(x) + 1)(f2(x) + k)
Multiply both sides by k:
k*P(x) = (kg1(x) + k)(f2(x) + k)
Now, let g1(x) = f1(x)/k, and make that substitution to get:
k*P(x) = (f1(x) + k)(f2(x) + k)
Now multiply it out:
k*P(x) = f1(x)*f2(x) + k(f1(x) + f2(x)) + k2
And introduce H(x), where I like using the capital letter here for visual reasons, but it is not to signify H(x) must be a polynomial, where:
f1(x) + f2(x) = H(x), so: f2(x) = -f1(x) + H(x),
and make that substitution, to get:
k*P(x) = f1(x)*(-f1(x) + H(x)) + kH(x) + k2
So you have:
k*P(x) = -f12(x) + H(x)f1(x) + kH(x) + k2
f12(x) - H(x)f1(x) - kH(x) - k2 + k*P(x) = 0
And you can solve for f1(x) using the quadratic formula:
f1(x) = (H(x) +/- sqrt(H2(x) + 4kH(x) + 4k2 - 4k*P(x)))/2
f1(x) = (H(x) +/- sqrt[(H(x) + 2k)2 - 4k*P(x)])/2
And we can see when that is rational.
Looking at our trivial example again, H(x) = kx + x - k + 2 = (k+1)x - k + 2
And inside that square root then is:
((k+1)x + k + 2)2 - 4k(x2 + 3x + 2)
(k+1)2x2 + 2(k+1)(k+2)x + (k+2)2 - 4kx2 - 12kx - 8k
(k-1)2x2 + 2(k-1)(k-2)x + (k-2)2 = ((k-1)x + k-2)2
And making that substitution:
f1(x) = ((k+1)x - k + 2 +/- ((k-1)x + k-2))/2 = kx or x - k + 2 as required.
So only polynomial factorizations can remove that square root for all integer x.
Here is a non-polynomial factorization example though.
Where I use:
P(x) = 175x2 - 15x + 2, and k = 7
And further I have:
7*P(x) = 7(175x2 - 15x + 2) = (5a1(x) + 7)(5a2(x) + 7)
So f1(x) = 5a1(x), and f2(x) = 5a2(x), where the a's are roots of:
a2 - (7x-1)a + (49x2 - 14x) = 0
Where notice H(x) = 5(7x - 1), as you can see the a's summed in there, and just multiply that by 5, to get the sum of the f's.
That non-polynomial factorization though from which I worked out what the value for H(x) must be comes from my use of a special construction.