We will show that there are exactly two solutions to this functional equation. First, take x=0 to get
f(y)=f(0)g(1)+g(y),
so g=f+C for some constant C. Since f(1)=3, we deduce that
f(x+y)=(3+C)f(x)+f(y)+C,x,y∈Q.(15)
The equations x+y+t=x+(y+t)=(x+t)+y imply that
f(x+y+t)=(3+C)f(x)+f(y+t)+C=(3+C)f(x+t)+f(y)+C.
Taking y=x, the last equation yields
(2+C)f(x)=(2+C)f(x+t),x,t∈Q.
It follows that either f is constant (and equal to 3) or C=−2. If f≡3, then (15) implies that 3=(3+C)4, and so C=−9/4. This gives a constant solution, (f,g)≡(3,3/4), to our problem.
It remains to consider the case C=−2, and so (15) gives
f(x+y)=f(x)+f(y)−2,x,y∈Q.
Writing h:=f−2, we get
h(x+y)=h(x)+h(y),x,y∈Q.(16)
If we take y=0 in (16), we get h(0)=0. If instead we take x=−y in (16), we get h(x)=−h(x). By repeatedly applying (16) to h(mx), we get the identity h(mx)=mh(x) for all m∈N. By virtue of the identities h(0)=0 and h(−x)=x, we can extend to m∈Z:
h(mx)=mh(x),x∈Q,m∈Z.(17)
Applying (17) with mx/n in place of x and n in place of m, we see that h(mx)=mh(mx/n) and so mh(x)=mh(mx/n). We have shown that
h(rx)=rh(x),x∈Q,r∈Q.
Rewriting this in terms of f for x=1, we get the identity f(r)≡r+2, and so g(r)≡r. This is the second solution to the functional equation.