TITLE: About finding the function such that $f(xy)=f(x)f(y)-f(x+y)+1$
QUESTION [5 upvotes]: Define a function $f\colon\mathbb{R}\to\mathbb{R}$ which satisfies
$$f(xy)=f(x)f(y)-f(x+y)+1$$
for all $x,y\in\mathbb Q$. With a supp condition $f(1)=2$. (I didn't notice that.)
How to show that $f(x)=x+1$ for all $x$ that belong to $\mathbb{Q}$?

REPLY [11 votes]: Suppose
$$\tag{1}f(xy)=f(x)f(y)-f(x+y)+1.$$
Put $x=y=0$ in $(1)$, we have $f(0)=f(0)^2-f(0)+1$, which implies that 
$f(0)^2-2f(0)+1=0$, or $(f(0)-1)^2=0$, i.e. $f(0)=1$. 
Put $y=-1$ and $x=1$ in $(1)$ we have
$$f(-1)=f(1)f(-1)=2f(-1),$$ 
which implies that $f(-1)=0$. 
Now taking $y=1$ in $(1)$, we have
$$f(x)=f(x)f(1)-f(x+1)+1=2f(x)-f(x+1)+1,$$
which gives
$$\tag{2}f(x)=f(x+1)-1.$$ 
Since $f(1)=2$, by using $(2)$ and induction, $f(x)=1+x$ for all positive integers $x$. Since $f(-1)=0$, by using $(2)$ and induction again, $f(x)=1+x$ for all negative integers $x$.
Note that $(2)$ implies that
$$\tag{3}f(x+q)=f(x)+q.$$ 
for any integer $q$ and for all $x$.
Finally for any rational number $p/q$ where $p,q$ are integers, put $x=p/q$ and $y=q$ in $(1)$, we get
$$\tag{4} f(p)=f(p/q)f(q)-f(p/q+q)+1=f(p/q)f(q)-[f(p/q)+q]+1$$
where we have used $(3)$ in the last equality. Since $f(x)=1+x$ for all integers $x$, it follows from $(4)$ that 
$$1+p=f(p/q)(q+1)-f(p/q)-q+1$$
which implies that 
$f(p/q)=1+p/q$, as required.