Generating function for the divisor function

Solution 1:

Switching the order of summation, we have that

$$\sum_{n=1}^{\infty}\sigma_{k}(n)x^{n}=\sum_{n=1}^{\infty}x^{n}\sum_{d|n}d^{k}=\sum_{d=1}^{\infty}d^{k}\sum_{n:\ d|n}^{\infty}x^{n}.$$ From here, applying the formula for the geometric series, we find that the above equals $$\sum_{d=1}^{\infty}d^{k}\sum_{n=1}^{\infty}x^{nd}=\sum_{d=1}^{\infty}d^{k}\frac{x^{d}}{1-x^{d}}.$$

Such a generating series is known as a Lambert Series. The same argument above proves that for a multiplicative function $f$ with $f=1*g$ where $*$ represents Dirichlet convolution, we have $$\sum_{n=1}^\infty f(n)x^n =\sum_{k=1}^\infty \frac{g(k)x^k}{1-x^k}.$$