TITLE: When is alternating sum $\sum_{i}f(a_i)-\sum_{i<j}f(a_i+a_j)+\ldots+(-1)^{n-1}f(a_1+\ldots+a_n)$ always positive?
QUESTION [13 upvotes]: Let $a_1,a_2,\ldots,a_n\geq 1$, and let $f:\mathbb{R}^+\rightarrow\mathbb{R}^+$. Consider the sum
$$S(f)=\sum_{i}f(a_i)-\sum_{i<j}f(a_i+a_j)+\sum_{i<j<k}f(a_i+a_j+a_k)-\cdots+(-1)^{n-1}f(a_1+\cdots+a_n).$$
This question shows that if $f(x)=\frac1x$, then $S(f)>0$ for all $a_1,\ldots,a_n$. If we perturb $f$ a tiny bit, say $f(x)=\frac{1}{x}-\frac{1}{100x^{100}}$, I would imagine that $S(f)>0$ still always holds. But the proof method for $f(x)=\frac1x$ is hard to generalize to other functions. Can we prove it in some other way?
More generally, is there a theorem out there stating sufficient conditions under which $S(f)>0$ always holds?

REPLY [3 votes]: If $f$ is a polynomial with $\deg f< n$, then $S(f)=f(0)$.

ADDED. More generally, for an analytic function $f(x)$,
$$S(f) = f(0) - h(x),$$
where $h(x)$ is the Hadamard product of $f(x)$ and the function
$$g(x) := \int_0^{\infty} e^{-t} (1-e^{a_1tx})\cdots(1-e^{a_ntx})\,\mathrm{d}t.$$
It can be seen that $[x^k]\ g(x)=0$ for $k<n$, implying the above result for polynomials.