\documentclass[11pt]{scrartcl}
\usepackage{evan}

\begin{document}
\title{IMO 1999/6}
\subtitle{Evan Chen}
\author{Twitch Solves ISL}
\date{Episode 91}
\maketitle

\section*{Problem}
Find all the functions $f \colon \RR \to \RR$ such that
\[f(x-f(y))=f(f(y))+xf(y)+f(x)-1\]
for all $x,y \in \RR$.

\section*{Video}
\href{https://www.youtube.com/watch?v=rlMW65i_VtI&list=PLi6h8GM1FA6yHh4gDk_ZYezmncU1EJUmZ}{\texttt{https://youtu.be/rlMW65i\_VtI}}

\section*{External Link}
\url{https://aops.com/community/p131856}

\newpage

\section*{Solution}
The answer is $f(x) = -\half x^2+1$
which obviously works.

For the other direction, first note that
\[ P(f(y),y) \implies 2f(f(y)) + f(y)^2 - 1 = f(0). \]
We introduce the notation $c = \frac{f(0)-1}{2}$,
and $S = \opname{img} f$.
Then the above assertion says
\[ f(s) = -\half s^2 + (c + 1). \]
Thus, the given functional equation can be rewritten as
\[ Q(x,s) : f(x-s)=-\half s^2 + sx + f(x) - c. \]

\begin{claim*}
  [Main claim]
  We can find a function $g \colon \RR \to \RR$ such that
  \[ f(x-z) = zx + f(x) + g(z). \qquad (\spadesuit). \]
\end{claim*}
\begin{proof}
  If $z \neq 0$,
  the idea is to fix a nonzero value $s_0 \in S$ (it exists)
  and then choose $x_0$ such that $- \half s_0^2 + s_0 x_0 - c = z$.
  Then, $Q(x_0, s)$ gives an pair $(u,v)$ with $u-v = z$.

  But now for any $x$, using $Q(x+v,u)$ and $Q(x,-v)$ gives
  \begin{align*}
    f(x-z)-f(x) &= f(x-u+v)-f(x)
    = f(x+v)-f(x) + u(x+v) - \half u^2 + c \\
    &= -vx-\half s^2-c + u(x+v) - \half u^2 + c \\
    &= -vx-\half v^2 + u(x+v) - \half u^2 = zx + g(z)
  \end{align*}
  where $g(z) = -\half(u^2+v^2)$ depends only on $z$.
\end{proof}

Now, let
\[ h(x) \coloneqq \half x^2 + f(x) - (2c+1), \]
so $h(0) = 0$.
\begin{claim*}
  The function $h$ is additive.
\end{claim*}
\begin{proof}
  We just need to rewrite $(\spadesuit)$.
  Letting $x=z$ in $(\spadesuit)$,
  we find that actually $g(x)=f(0)-x^2-f(x)$.
  Using the definition of $h$ now gives
  \[ h(x-z) = h(x) + h(z). \qedhere \]
\end{proof}

To finish, we need to remember that $f$, hence $h$, is known
on the image
\[ S =  \left\{ f(x) \mid x \in \RR \right\}
  = \left\{ h(x) - \half x^2 + (2c+1) \mid x \in \RR \right\}. \]
Thus, we derive
\[ h\left( h(x)-\half x^2+(2c+1) \right) = -c
  \qquad \forall x \in \RR. \qquad(\heartsuit)  \]
We can take the following two instances of $\heartsuit$:
\begin{align*}
  h\left( h(2x)-2x^2+(2c+1) \right) &= -c \\
  h\left( 2h(x)-x^2+2(2c+1) \right) &= -2c.
\end{align*}
Now subtracting these and using $2h(x)=h(2x)$ gives
\[ c = h\left( -x^2 - (2c+1) \right). \]
Together with $h$ additive, this implies readily $h$ is constant.
That means $c=0$ and the problem is solved.

\end{document}
