Find the function(s) $f: \mathbb{R} \to \mathbb{R}$ which satisfies $f(x)+f(y)-f(x+y)=f(xy)-f(x)f(y)$.

algebra-precalculusfunctional-equationsfunctions

Find the function(s) $f: \mathbb{R} \to \mathbb{R}$ which satisfies $f(x)+f(y)-f(x+y)=f(xy)-f(x)f(y)$.

My attempt:

\begin{align}
&P(x, 0): f(0)=f(0)-f(x)f(0). \\
&\text{if } f(0) \neq 0: \\
&1=1-f(x). \Rightarrow f \equiv 0, \textbf{ Contradiction.} \\
&\therefore f(0)=0. \\
\ \\
&P(x, 1): f(x)+f(1)-f(x+1)=f(x)-f(x)f(1). \\
&\therefore \big( f(x)+1\big)f(1)=f(x+1). \\
\ \\
&\text{if } f(1)=0: & (1)\\
&f(x+1)=0. \Rightarrow \boxed{f \equiv 0}, \textbf{ Solution.} \\
\ \\
&\text{if } f(1) \neq 0: \\
&P(x, -x): f(x)+f(-x)-f(0)=f(-x^2)-f(x)f(-x). \\
&\Rightarrow f(x)+f(-x)=f(-x^2)-f(x)f(-x). \\
&\Rightarrow \big( f(x)+1 \big) \big( f(-x)+1 \big) =f(-x^2)+1. \\
\ \\
&x=1; \ \big(f(1)+1\big) \big(f(-1)+1 \big) = f(-1)+1. \\
\ \\
&\text{if } f(-1) \neq -1: \\
&f(1)=0. \Rightarrow \textbf{ Contradiction. } \\
\ \\
&\text{if } f(-1) = -1: \\
&P(x, -1): f(x)-1-f(x-1)=f(-x)+f(x). \\
&\therefore f(-x)+1+f(x-1)=0.
\end{align}

Best Answer

This is a partial answer that shows $f(x)=x~~\forall x\in \mathbb{Q}$.
We are considering the case where $f(x)\ne0~~\forall x\ne 0$ .
You have showed that $f(-x)+1+f(x-1)=0$.
Let $x=y+\frac12$
$$\implies f(-y-\frac12)+f(y-\frac12)=-1$$
$$\implies P(-y-\frac12, y-\frac12): -1+1=f(\frac14-y^2)-f(-y-\frac12)f(y-\frac12)$$

Let $z=y-\frac12$ $$\implies f(-z-1)f(z)=f(-z^2-z)$$ Substitutting $z=1$ we get $f(1)=1$ $$\implies f(x+1)=f(x)+1$$ $$\implies f(x+n)=f(x)+n~~~~~~~~~\forall{n\in\mathbb{N}}$$ $$ P(x, n):f(x)+n-(f(x)+n)=f(xn)-nf(x)$$ $$\implies f(xn)=nf(x)~~~~~~~~~\forall{n\in\mathbb{N}}$$ $$\implies f(x)=x~~~~~~~~~\forall{x\in\mathbb{Q}}$$