There are different ways of showing that a given sequence $a\_0,a\_1,a\_2,\dots$
of integers, say, is nonnegative. For example, one can show that $a\_n$ count
something, or express $a\_n$ as a (multiple) sum of obviously positive numbers.
Another recipe is manipulating with the corresponding generating series
$A(x)=\sum\_{n=0}^\infty a\_nx^n$ and showing that $A(x)\ge0$ (this is the
notation for a series which has all coefficients nonnegative, and this extends
to formal power series in as many variables as needed).


An example of criterion in this direction is
$$
(\*) \qquad
A(xy)\ge0 \iff \frac1{(1-x)(1-y)}A\biggl(\frac{xy}{(1-x)(1-y)}\biggr)\ge0
$$
(the multiple $1/(1-x)(1-y)$ is introduced for cosmetic purposes only and, of course, both $A(x)\ge0$ and $A(xy)\ge0$ are by definition equivalent to the nonnegativity of the sequence $a\_n$).
The latter can be verified by comparing the corresponding coefficients
in the power series expansion
$$
\frac1{(1-x)(1-y)}A\biggl(\frac{xy}{(1-x)(1-y)}\biggr)
=\sum\_{n=0}^\infty a\_n\sum\_{k,m=0}^\infty\binom{n+k}n\binom{n+m}nx^{n+k}y^{n+m}.
$$


On the other hand, the one-dimensional version of $( \* )$,
$$
A(x)\ge0 \iff \frac1{1-x}A\biggl(\frac{x}{1-x}\biggr)\ge0,
$$
is simply false.


My question is whether it is possible to find two *nontrivial* rational functions
$p(x)\in\mathbb Q[[x]]$ and $r(x)\in x\mathbb Q[[x]]$ in *one* variable $x$
such that
$$
A(x)\ge0 \iff p(x)A\bigl(r(x)\bigr)\ge0.
$$
Although I am not supposed to put several problems in one question, I
would also ask about a more direct proof of $( \* )$ and about general ways
of constructing such $p$ and $r$ in more than one variable.


**Motivation.** Basically I am interested in proving nonnegativity of certain
$q$-series sequences $a\_0(q),a\_1(q),a\_2(q),\dots$ by manipulating with the
corresponding generating series $A\_q(x)=\sum\_{n=0}^\infty a\_n(q)x^n$. Some
of them can be "guessed" from non-$q$-versions, for example there is a neat
$q$-analogue of the criterion $( \* )$.



Positivity of sequences via generating series
It is impossible, and not just for rational functions. To see this, let's consider the coefficients $b\_n$ of $p(x) A(r(x))$ as functions of the $a\_n$, the coefficients of $A(x)$. Since $r(0) = 0$ (as it must be) we see that:


* Each $b\_n$ is a linear combination of $a\_0, \dots, a\_n$; i.e. we have an upper-triangular infinite matrix $F$, not depending on $a\_n$, such that (writing $\vec{a} = (a\_n), \vec{b} = (b\_n)$) $\vec{b} = F \vec{a}$. Suppose for now that $p(0), r'(0) \neq 0$; then $F$ has a nonzero diagonal, and so is invertible.
* If $\vec{b} \geq 0$ for all $\vec{a} \geq 0$, then in particular this is true of the columns of $F$, taking $\vec{a}$ to be infinite "basis" vectors. Conversely, we have equivalently that $\vec{a} = F^{-1} \vec{b}$, so if $\vec{a} \geq 0$ for all $\vec{b} \geq 0$ this must be true of the columns of $F^{-1}$. We conclude that both $F$ and $F^{-1}$ have nonnegative entries.
* Lemma in linear algebra: if $F$ is upper-triangular and both it and $F^{-1}$ have nonnegative real entries, then $F$ is diagonal. Proof by induction: true for $1 \times 1$ matrices vacuously. In general, by induction we may assume that the upper-left and lower-right $(n - 1) \times (n - 1)$ blocks of $F$ are diagonal, so only the $(1,n)$ entry of $F$ is nonzero off the diagonal. Then we have $(F^{-1})\_{1n} = -F\_{1n} F\_{nn}/F\_{11}$. Since $F\_{11}$ and $F\_{nn}$ are both positive, $F\_{1n}, (F^{-1})\_{1n} \geq 0$ implies $F\_{1n} = 0$.
* This is also true of infinite matrices, since we can compute the finite upper-left blocks independently of the rest of the matrix.
* However, if $F$ is diagonal then we see that $p(x)A(r(x)) = \sum a\_n p(x) r(x)^n = \sum F\_{nn} a\_n x^n$ for all choices of $a\_n$, so (for example, taking $a\_n = t^n$ for a new variable $t$ and rewriting both sides as power series in $t$) we have $p(x) r(x)^n = F\_{nn} x^n$ for all $n$ (and some $F\_{nn} > 0$). That is, $(r(x)/x)^n = F\_{nn} p(x)^{-1}$ for all $n$, so in fact $r(x)/x = F\_{11}/F\_{00}$ is constant, and finally, $p(x)$ is constant as well.
* Now we remove the assumptions that $p(0), r'(0) \neq 0$. If $x^k$ divides $p(x)$, then replacing $p(x)$ by $p(x)/x^k$ does not change positivity of the coefficients. Now suppose the bottom exponent of $r(x)$ is $x^m$ with positive coefficient; then in $\mathbb{R}[[x]]$ we can write $r(x) = s(x)^m$, and if we denote $A\_m(x) = A(x^m)$, we have $A(r(x)) = A\_m(s(x))$. Clearly, $A\_m$ has nonnegative coefficients if and only if $A$ does, and $s'(0) \neq 0$, so the previous proof applies and $s(x)$ is a multiple of $x$, i.e. $r(x)$ is a multiple of $x^m$, and $p(x)$ is a multiple of $x^k$.


