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

\begin{document}
\title{Twitch 047.2}
\subtitle{Evan Chen}
\author{Twitch Solves ISL}
\date{Episode 47}
\maketitle

\section*{Problem}
Solve over integers:
\[ f(a-1)^2+f(b-1)^2=1-2f(a)f(b)+f(a+b)^2. \]

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



\newpage

\section*{Solution}
The answers are $f(x) = x+1$,
$f(x) = \begin{cases}
  1 & x \text{ even} \\
  0 & x \text{ odd}
\end{cases}$,
and the negations of these two functions.
One may check they work, so let's prove they are the only ones.

Let $P(a,b)$ denote the assertion.
Then $P(a,-1)$ gives
\begin{align*}
  f(a-1)^2 + f(-2)^2 &= 1 - 2f(-1) f(a) + f(a-1)^2 \\
  \iff f(-2)^2 &= 1 + 2f(-1) f(a)
\end{align*}
So either $f(-1) = 0$ or $f$ is constant (which is not possible).

Let's assume $f(-1) = 0$ then.
Consider $P(0,0)$ to get $f(0)^2=1$.
Since $f$ works if and only $-f$ does, it is enough to tackle
$f(0) = +1$.
Then $P(a,0)$ gives
\[ f(a-1)^2 = 1 - 2 \cdot f(a) + f(a)^2 = \left( 1 - f(a) \right)^2. \]

We now consider two cases:
\begin{itemize}
  \ii If $f(1) = 2$: if we assume that $f(b-1) = b$ and $f(b) = b+1$,
  \begin{align*}
    1 + f(b-1)^2 &= 1 - 4 f(b) + f(b+1)^2 \\
    f(b+1)^2 &= (b+2)^2 \\
    f(b+2) &\in \{b, b+2\}.
  \end{align*}
  So $f(x) = x+1$ works for any $x \ge 0$ by induction.

  To go downwards, we can get $f(a-1)$ for $a < 0$ by induction,
  by selecting large positive $b$.

  \ii If $f(1) = 0$ then
  \[ 1 + f(b-1)^2 = 1 + f(b+1)^2 \implies f(b-1)^2 = f(b+1)^2. \]
  This means all odd inputs are zero and all even inputs are $\pm 1$.

  Plug in $a$ and $b$ even to get $f(a) f(b) = +1$,
  so $f$ is constant on even inputs, as desired.
\end{itemize}

\end{document}
