Solution. Deriving the equation,
By Eisenstein's criterion, the polynomial 2007x206+2 is irreducible. Hence, one of the two factors is constant. Since gcd(2007,2)=1, this constant must be 1 or -1.
If g'(x)=1 then g(x)=x+c with some integer c and f(x)=(x-c)2007+2(x-c)+1.
If g'(x)=-1 then g(x)=-x+c and f(x)=(-x+c)2007+2(-x+c)+1.
If f'(g(x))=1 then g'(x)=2007x2006+2. The degree of polynomial g(x) is 2007, and it attains infinitely many distinct values. So f'(g(x))=1 is possible only if f'(x)=1. Then f(x)=x+c and g(x)=x2007+2x+1-c.
Finally, if f'(g(x))=-1 then, similarly to the previous case, f'(x)=-1, f(x)=-x+c and g(x)=-x2007-2x-1+c.