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}$. $F$ is injective, since if $F \vec{a} = 0$ then $p(x) A(r(x)) = 0$, so $p(x) = r(x) = 0$. Since its rows are finite, this means that it 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.