---
id: 1521
lang: en
translation_of: index.md
source_sha256: 33a1f68ce7c17b15fe6092d291b68e6163c17443167b7364a5961e8797d53056
title: "Binomial Inversion"
description: "The core of binomial inversion: two symmetric pairs of inversion formulas, a brute-force substitution proof, and turning “at least” into “exactly”."
tags: ["OI","Math","Binomial Coefficients","Inversion","Binomial Inversion","Binomial Theorem"]
translated: 2026-11-27
translator: Claude Opus 5.5
translator_model: claude-opus-5-5
translation_notes:
  - "Trailing spaces were added inside the translated \\text{…} lines that run straight into math (“prove ”, “just ”), since English needs word spacing there."
  - "The tag 二项式 is rendered as “Binomial Theorem”, as tags.yaml prescribes."
---

## Symmetric Inversion

The main content of binomial inversion is:

$$
f_n = \sum_{i = 0}^n (-1)^i {n \choose i} g_i \longleftrightarrow g_n = \sum_{i = 0}^n (-1)^i {n \choose i} f_i
$$

This inversion formula is really beautiful: in this form, the two sides are symmetric. Of course, it can also be written as:

$$
f_n = \sum_{i = 0}^n {n \choose i} g_i \longleftrightarrow g_n = \sum_{i = 0}^n (-1)^{n - i} {n \choose i} f_i
$$

<!--more-->

## Proof

Consider proving it by the <span class="slang" data-zh="喜闻乐见" data-gloss="xǐ wén lè jiàn, “glad to hear, happy to see”. An idiom for something everyone loves; used jokingly for a familiar, routine step.">ever-popular</span> brute-force substitution:

$$
\begin{gathered} \begin{aligned} f_n &= \sum_{i = 0}^n (-1)^i {n \choose i} \sum_{j = 0}^i (-1)^j {i \choose j} f_j \\ &= \sum_{i = 0}^n \sum_{j = 0}^n (-1)^{i + j} {n \choose i} {i \choose j} f_j [j \leq i] \end{aligned} \\
\text{where} \\
\begin{aligned} {n \choose i} {i \choose j} &= \frac{n!i!}{i!(n - i)!(i - j)!j!} \\ &= \frac{n!}{j!(n - j)!} \frac{(n - j)!}{(n - i)!((n - j) - (n - i))!} \\ &= {n \choose j} {n - j \choose n - i} \end{aligned} \\
\text{substituting back into the original} \\
\begin{aligned} f_n &= \sum_{i = 0}^n \sum_{j = 0}^n (-1)^{i + j} {n \choose i} {i \choose j} f_j [j \leq i] \\ &= \sum_{i = 0}^n \sum_{j = 0}^n (-1)^{i + j} {n - j \choose n - i} f_j [j \leq i] \\ &= \sum_{j = 0}^n {n \choose j} f_j \sum_{i = j}^n (-1)^{i + j} {n - j \choose n - i} \end{aligned} \\
\text{now we need to prove } \sum_{i = j}^n (-1)^{i + j} {n - j \choose n - i} = [j = n] \\
\begin{aligned} \sum_{i = j}^n (-1)^{i + j} {n - j \choose n - i} &= (-1)^j \sum_{i = j}^n (-1)^i {n - j \choose n - i} \\ &= (-1)^j \sum_{i = 0}^{n - j} (-1)^{i + j} {n - j \choose n - (i + j)} \\ &= (-1)^j \sum_{i = 0}^{n - j} (-1)^{n - i} {n - j \choose i} \\ &= (-1)^{n + j} (1 - 1)^{n - j} = [j = n] \end{aligned} \\ \text{substituting back into the original, the result is just } f_n \end{gathered}
$$

## Applications of Binomial Inversion

### At Least to Exactly

A lot of problems that use binomial inversion are, roughly, solved by converting “at least” into “exactly”. For an ordinary at-least-to-exactly conversion, you can usually just write it out and invert directly:

$$
g(x) = \sum_{i = 0}^n {n \choose i} f(i)
$$

Sometimes you have to convert to “at least $k$”. When converting to this, binomial inversion needs a few adjustments. In this case we write:

$$
g(k) = \sum_{i = k}^n {i \choose k} f(i)
$$

This needs a special form of the inversion:

$$
f(k) = \sum_{i = k}^n (-1)^{i - k} {i \choose k} g(i)
$$

This is the solution to the example problem[ BZOJ 3622](https://www.lydsy.com/JudgeOnline/problem.php?id=3622). Use at least $k$ to convert to exactly $k$. At heart it's just inclusion–exclusion, that's all.
