(Hungary 2017)(D) Find all functions $f: \mathbb{R} \rightarrow \mathbb{R}$ such that, for all $x, y \in \mathbb{R}$,

$$
f(x y-1)+f(x) f(y)=2 x y-1
$$
$y=0$ on a $f(-1)+f(x) f(0)=-1$ as $f$ is not constant we have $f(0)=0, f(-1)=-1$. Then we set $y=1$ and we have $f(x-1)+f(x) f(1)=2 x-1$ and with $y=\frac{1}{x}$ we get $f(x) f\left(\frac{1}{x}\right)=1$. So $f(1)=1$ or -1.

We set $y=\frac{1}{x-1}$ and we have $f\left(\frac{1}{x-1}\right)(1+f(x))=\frac{x+1}{x-1}$ for $x \neq 1$.

Then we multiply by $f(x-1)$ and $1+f(x)=\frac{x+1}{x-1} f(x-1)$. In short, we substitute, if $f(1)=1$ we get the identity which is a solution, otherwise we have $f(x)=-x^{2}$ which is also a solution.