> [!Question] Problem > Find all functions $f:\mathbb{Q}\to \mathbb{Q}$ such that $f(1)=2$ and $f(xy)=f(x)f(y)-f(x+y)+1$ ###### Solution Plugging $y=1$ gives $f(x+1)=f(x)+1$ which yields inductively that for all positive integers $n,$ $f(n)=n+1.$ Plugging $x=y=0$ gives $f(0)=f(0)^{2}-f(0)+1$ so $f(0)=1.$ Now plugging $y=1$ and $x=-1$ gives $f(-1)=2f(-1)-1+1$ so $f(-1)=0.$ Plugging $x=-1$ and $y=n$ gives $f(-n)=f(-1)f(n)-f(n-1)+1$ so $f(-n)=-f(n-1)+1=-n+1$ so indeed for all integers $n,$ $f(n)=n+1.$ Now plugging $x=n$ and $y=\frac{1}{n}$ gives $nf\left( \frac{1}{n} \right)+f\left( n+\frac{1}{n} \right)-1=0$ Also plugging $x=1$ and $y=m+\frac{1}{n},$ where $m,n$ are positive integers, gives $f\left( m+1+\frac{1}{n} \right)=f\left( m+\frac{1}{n} \right)+1$ which yields by induction on $m$ $f\left( m+\frac{1}{n} \right)=m+f\left( \frac{1}{n} \right)$so substituting for $f\left( n+\frac{1}{n} \right)$ in the previous equation gives $f\left( \frac{1}{n} \right)=\frac{1}{n}+1$Plugging $x=m$ and $y=\frac{1}{n}$ gives $f\left( \frac{m}{n} \right)=\frac{m}{n}+1.$ So for all positive rationals $r,$ $f(r)=r+1$ Finally $x=r$ and $y=1$ gives $f(-r)=-r+1.$ So for all $r\in \mathbb{Q},$ $f(r)=r+1.$