# Inflection points of $(1 - x^k) \mathbin{/} (1 - x^n)$ for $x$ strictly positive

For $$k$$ and $$n$$ reals constants with $$1 \leq k < n$$, consider the function $$f(x) = (1 - x^k) \mathbin{/} (1 - x^n)$$, defined over the strictly positive reals ($$0 < x$$).

I am able to prove that $$f(x)$$ is decreasing and also that, if $$k = 1$$, $$f(x)$$ is convex.

But I cannot handle the case $$1 < k$$: I believe that $$f(x)$$ has exactly one inflection point (for $$x$$ strictly positive), but I am unable to prove it.

Remark: $$f(x)$$ is related to the gambler's ruin problem.

After some more thinking, I can now answer my own question. The key of the proposed solution is Descartes' rule of signs.

Let $$h(x)$$ be the second derivative of the function considered, that is $$h(x) = (d/dx)^2\; (1 - x^k) \mathbin{/} (1 - x^n)$$. After some computations, $$h(x)$$ can be expressed as a generalised (the exponents are not necessarily integers) rational function of $$x$$:$$x^{k - 2} \cdot \frac{ + \;((n - k)^2 + (n - k)) \cdot x^{2 \cdot n} \\ - \;n \cdot (n + 1) \cdot x^{2 \cdot n - k} \\ + \;(n \cdot (n + 1) + 2 \cdot (k - 1) \cdot (n - k)) \cdot x^n \\ - \;n \cdot (n - 1) \cdot x^{n - k} \\ + \;(k - 1) \cdot k }{(x^n - 1)^3}$$

The goal is to show that $$h(x)$$ has, for $$1 < k$$ and $$0 < x$$ (both conditions hold implicitly from now on), exactly one sign change.

The denominator of $$h(x)$$ has exactly one root, at $$x = 1$$, of multiplicity 3. It can be shown, with L'Hospital's rule, that, up to continuous continuation, $$h(1) = k \cdot (n - k) \cdot (n - 2 \cdot k + 3) \mathbin{/} (6 \cdot n)$$. In particular, the numerator of $$h(x)$$ has a root of multiplicity at least 3 at $$x = 1$$.

The ordered coefficients of the numerator of $$h(x)$$ (a generalised polynomial in $$x$$) have 4 sign changes, and thus, according to Descartes' rule of signs, 0, 2 or 4 positive roots, counted with multiplicities. Hence, the numerator of $$h(x)$$ has exactly 4 positive roots, counted with multiplicities: one root of multiplicity 3 at $$x = 1$$, and one more root of multiplicity 1 at $$x = r$$ for some strictly positive $$r$$ (if $$n - 2 \cdot k - 3 = 0$$, then $$r = 1$$ as well).

Since the numerator of $$h(x)$$ has one root of multiplicity 3 (or 4) at $$x = 1$$, thus canceling the root of multiplicity 3 at $$x = 1$$ of its denominator, $$h(x)$$ remains with exactly one positive root, at $$x = r$$, of multiplicity 1. That is, $$h(x)$$ has exactly one sign change (for $$x$$ with $$0 < x$$).

Remark: For $$x$$ strictly positive and big enough, $$h(x)$$ is positive, that is $$(1 - x^k) \mathbin{/} (1 - x^n)$$ is convex.

Remark: If $$k = 1$$, then the ordered coefficients of the numerator of $$h(x)$$ have only 3 sign changes, and thus, by the same device as above, $$h(x)$$ has no sign change, that is $$(1 - x^k) \mathbin{/} (1 - x^n)$$ is convex (for $$x$$ with $$0 < x$$).

Remark: The same method can be used to show that $$(1 - x^k) \mathbin{/} (1 - x^n)$$ is decreasing in $$x$$ (for $$x$$ with $$0 < x$$).