Question: For any rational numbers $x$ and $y$, $f(x)$ is a real number and: $$f(x+y) = f(x)f(y) - f(xy) +1$$ Again, $f(2017) \neq f(2018)$ and: $$f\left(\frac{2017}{2018}\right) = \frac{a}{b}$$ where $a$ and $b$ are co prime. Find $a-b$.
Attempts: I have tried for several days, but I don't have any clue on how to solve it. I tried substitution, and got some useless facts: $$f(0) = 1$$ $$f(-x^2) = f(x)f(-x)$$ $$f(-1) = 0$$ $$f(2x) = [f(x)]^2 - f(x^2) + 1$$ Can anyone help with this problem please?
Suppose $f(1)=r$. Also, plugging $y=1$ gives $f(x+1)=f(x)\cdot(r-1)+1$, so $$f(2) = 1-r+r^2\\ f(3) = 2r-2r^2+r^3\\ f(4) = 1-2r + 4r^2 - 3r^3 + r^4$$ Now plug $x=y=2$ and we'll end up with an equation on $r$. $$2f(4) = f^2(2)+1\\ 2(1-2r + 4r^2 - 3r^3 + r^4) = (1-r+r^2)^2+1\\ -2r + 5r^2 - 4r^3 + r^4 = 0\\ r(r-1)^2(r-2)=0 $$ Now,