---
title: "Integer Functional Equation f(m+n) + f(mn) = f(m)f(n) + 1 and Parity Solution"
organization: "NityaDhi Digital Mathematics Lab (Asa Edtech Private Limited)"
url: "https://www.nityadhi.com/problems/hard-olympiad-geo-w1-11"
board: "Olympiad"
grade: "Olympiad"
published_at: "2026-11-27T10:45:00+05:30"
---

# Integer Functional Equation f(m+n) + f(mn) = f(m)f(n) + 1 and Parity Solution

Find all functions $f : \mathbb{Z} \to \mathbb{Z}$ such that for all integers $m$ and $n$,
$$f(m + n) + f(mn) = f(m) f(n) + 1,$$
and hence determine the sum of all possible values of $f(2025)$.

## Textbook Solution

1. **Determine $f(0)$:**
   Set $m = n = 0$:
   $$f(0) + f(0) = f(0)^2 + 1 \implies \big(f(0) - 1\big)^2 = 0 \implies f(0) = 1.$$

2. **Find a recurrence using $n = 1$:**
   Set $n = 1$ for any integer $m$:
   $$f(m + 1) + f(m) = f(m) f(1) + 1 \implies f(m + 1) = k f(m) + 1,$$
   where $k = f(1) - 1 \in \mathbb{Z}$. Notice this holds for *all* $m \in \mathbb{Z}$ (including negative integers).

3. **Analyze $m = -1$:**
   Substitute $m = -1$ into $f(m + 1) = k f(m) + 1$:
   $$f(0) = k f(-1) + 1 \implies 1 = k f(-1) + 1 \implies k f(-1) = 0.$$

   - **Case 1: $k = 0$.**
     Then $f(m + 1) = 1$ for all $m \in \mathbb{Z}$, so $f(m) = 1$ for all $m \in \mathbb{Z}$.
     Check: $1 + 1 = 1 \cdot 1 + 1$, valid!

   - **Case 2: $k \neq 0$.**
     Then $f(-1) = 0$. Now substitute $m = n = -1$ into the original equation:
     $$f(-2) + f(1) = f(-1)^2 + 1 \implies f(-2) + (k + 1) = 0 + 1 \implies f(-2) = -k.$$
     On the other hand, setting $m = -2$ in $f(m + 1) = k f(m) + 1$ gives:
     $$f(-1) = k f(-2) + 1 \implies 0 = k(-k) + 1 \implies k^2 = 1 \implies k \in \{1, -1\}.$$

     - **Subcase 2a ($k = 1$):** $f(m + 1) = f(m) + 1$ for all $m \in \mathbb{Z}$ with $f(0) = 1$, which uniquely yields $f(m) = m + 1$.
       Check: $(m + n + 1) + (mn + 1) = (m + 1)(n + 1) + 1$, valid!

     - **Subcase 2b ($k = -1$):** $f(m + 1) = 1 - f(m)$ for all $m \in \mathbb{Z}$ with $f(0) = 1$, which alternates between $1$ (for even $m$) and $0$ (for odd $m$):
       $$f(m) = \frac{1 + (-1)^m}{2}.$$
       Check by parity: if both $m, n$ are even, $1 + 1 = 1 \cdot 1 + 1$; if one is even and one is odd, $0 + 1 = 0 \cdot 1 + 1$; if both are odd, $1 + 0 = 0 \cdot 0 + 1$. All three hold!

4. **Sum of possible values of $f(2025)$:**
   - $f(m) \equiv 1 \implies f(2025) = 1$.
   - $f(m) = m + 1 \implies f(2025) = 2026$.
   - $f(m) = \frac{1 + (-1)^m}{2} \implies f(2025) = 0$ (since $2025$ is odd).
   Total sum $= 1 + 2026 + 0 = 2027$.

**Final Answer:** $f(m) = 1$, $f(m) = m + 1$, or $f(m) = \frac{1 + (-1)^m}{2}$; sum of possible values of $f(2025)$ is $2027$.

## Vedic Shortcut

**NityaDhi Shifting-Origin Trick ($g = f - 1$):**
Set $g(m) = f(m) - 1$. Notice $g(0) = 0$ immediately, and the equation becomes:
$$g(m+n) + g(mn) = g(m)g(n) + g(m) + g(n).$$
With $n = 1$, $g(m+1) = (g(1)) g(m)$! Wait: check $g(m+1) = g(1)g(m)$! Since $f(m+1) = k f(m) + 1$, subtracting $1$ gives $g(m+1) = k g(m)$? Wait: $g(m+1) = k(g(m)+1) = k g(m) + k$ (because $g(1) = k$). Still, evaluating at $m = -1$ immediately forces $k g(-1) + k = 0 \implies g(-1) = -1$ when $k \neq 0$, and $m=n=-1$ instantly pins $k^2 = 1$! Always test negative integers ($m=-1, -2$) in $\mathbb{Z} \to \mathbb{Z}$ functional equations—that is where parity solutions live!

## Common Mistakes

1. **Forgetting the parity solution $f(m) = \frac{1+(-1)^m}{2}$:** Many students assume $f$ must be a polynomial on $\mathbb{Z}$ and miss $k = -1$ by only inducting forward on $\mathbb{N}$ instead of checking $m = -1, -2$.
2. **Dividing by $k$ without splitting $k = 0$:** From $k f(-1) = 0$, failing to handle $k = 0$ loses the constant solution $f(m) \equiv 1$.