Mathematical tool for summing multiplicative functions
An example of the Dirichlet hyperbola method with and
In number theory, the Dirichlet hyperbola method is a technique to evaluate the sum
where f is a multiplicative function. The first step is to find a pair of multiplicative functions g and h such that, using Dirichlet convolution, we have f = g ∗ h; the sum then becomes
where the inner sum runs over all ordered pairs (x,y) of positive
lattice points
in the first quadrant on the hyperbolas of the form xy = k, where k runs over the integers 1 ≤ k ≤ n: for each such point (x,y), the sum contains a term g(x)h(y), and vice versa.
Let a be a real number, not necessarily an integer, such that 1 < a < n, and let b = n/a. Then the lattice points can be split into three overlapping regions: one region is bounded by 1 ≤ x ≤ a and 1 ≤ y ≤ n/x, another region is bounded by 1 ≤ y ≤ b and 1 ≤ x ≤ n/y, and the third is bounded by 1 ≤ x ≤ a and 1 ≤ y ≤ b. In the diagram, the first region is the
principle of inclusion and exclusion
, the full sum is therefore the sum over the first region, plus the sum over the second region, minus the sum over the third region. This yields the formula
Computing D(n) naïvely requires factoring every integer in the interval [1, n]; an improvement can be made by using a modified Sieve of Eratosthenes, but this still requires Õ(n) time. Since σ0 admits the Dirichlet convolution σ0 = 1 ∗ 1, taking a = b = √n in (1) yields the formula
which simplifies to
which can be evaluated in O(√n) operations.
The method also has theoretical applications: for example, Peter Gustav Lejeune Dirichlet introduced the technique in 1849 to obtain the estimate[1][2]