Prove that $\arctan x$ cannot be expressed as a rational function

In my Calculus class the teacher proposed as an exercise to prove that $\arctan(x)$ cannot be expressed as a rational function (fraction of polynomials) in any closed interval $[a,b]$. I've been thinking on the problem and I haven't been able to prove it by "analysis" arguments but using some concepts of an abstract algebra course I took last semester. I've done it this way:

Suppose there exist $p(x),q(x)$ such that $\arctan(x) = \frac{p(x)}{q(x)}$ in the interval $[a,b]$, where $\gcd(p,q)=1$. Thus, $\left(\frac{p(x)}{q(x)}\right)' = \frac{1}{1+x^2}$. If we expand the expression of the derivative of a quotient and manipulate the equality, we end up with: $$(1+x^2)(p'(x)q(x)-p(x)q'(x))=q^2(x)$$

Thus, $1+x^2$ divides $q^2(x)$ and as $1+x^2$ is irreducible over $\mathbb R[x]$, $1+x^2$ divides $q(x)$. Let $q(x)$ have the prime factor $1+x^2$ "n" times. From the equation above, we know that $q^2(x)$ has the factor $(1+x^2)$ "2n" times; hence $(p'(x)q(x)-p(x)q'(x))$ has the factor $1+x^2$ exactly "2n-1" times. Note that for $n\geq 1$, $2n-1 \geq n$. Hence, the factor $(1+x^2)^n$ must divide $(p'(x)q(x)-p(x)q'(x))$ and it also divides $q(x)$; thus $(1+x^2)^n$ must divide $p(x)q'(x)$.

Suppose that $1+x^2$ is not a factor of $p(x)$. Thus, $(1+x^2)^n$ must divide $q'(x)$. However, note that: $$ q'(x) = ((x^2+1)^n \cdot r(x))' = 2nx(x^2 + 1)^{n-1} r(x) + (x^2+1)^n r'(x),\ \gcd(r,1+x^2)=1 $$

Therefore, $(x^2+1)^n$ divides $q'(x)$ if and only if $(x^2+1)^n$ divides $n(x^2+1)^{n-1} r(x)$. Then, $x^2 + 1$ must divide $r(x)$ which is a contradiction. Hence, $x^2 +1$ must also be a factor of $p(x)$. However, by hypothesis $\gcd(p,q)=1$ while $x^2+1$ divides both $p,q$. This is a contradiction, hence there do not exist such polynomials.

First of all, I would appreciate if anyone could tell me if this proof has any error. Moreover, I would appreciate any other approach which uses theorems of elementary one-variable calculus instead of divisibility.

NOTE: In the case of $\mathbb R$, this problem is (almost) trivial. As the arctangent has a horizontal asymptote in both $\pm \infty$, it follows that if $\arctan(x) = \frac{p(x)}{q(x)}$ for certain $p,q$, they must verify that $deg(p) = deg (q)$. Moreover, $x=0$ is a unique real root of $p(x)$ with multiplicity 1 as $\arctan(0) = p(0)/q(0) = 0$ and $\arctan(0)' = 1/(1+0^2) = 1 \not = 0$. Thus, $deg(p)$ must be odd. However, all the roots of $q(x)$ are complex as $\arctan(x)$ must be continuous on $\mathbb R$. As complex roots on a real polynomial come in conjugate pairs, it follows that $deg(q)$ must be even. Then $deg(p) \not = deg(q)$ which is a contradiction.

Conclusions:

I have already proposed a solution to my Calculus professor based on some arguments given in this page and adding some details:

Suppose there exist $p,q$ such that $\arctan(x) = p(x)/q(x)$ and $gcd(p,q)=1$ in the interval $[a,b]$. Therefore, they must have the same derivative, hence: $$ (1+x^2)(p'q-pq') = q^2, \forall x \in [a,b]$$

As an equality of polynomials in an interval $[a,b], a<b$ must hold also in $\mathbb R$, then if $q(x) /not = 0$, the equality above holds. We are going to prove that q(x) has no real roots hence $p(x)/q(x)$ is continuous in $\mathbb R$.

Suppose $\alpha \in \mathbb R$ is a root of $q$. As there are finitely many roots of $q(x)$ as is a non-zero polynomial, there exists $\delta > 0$ such that for any point in $[\alpha - \delta,\alpha + \delta]$ except for $x= \alpha$, the equality $(\arctan x)' - (\frac{p}{q})' = 0$ holds. Thus, there exists a constant $c \in \mathbb R$ such that $\frac{p}{q} = \arctan + c$. Thus,

$$ \lim_{x \to \alpha} \frac{p}{q} = \lim_{x \to \alpha} (\arctan (x) + c) = arctan(\alpha) + c $$

As arctan is a continuous function. Thus, $\alpha$ must be a root also of $p(x)$ (if not, $\lim_{x \to \alpha} \frac{p}{q} = \infty$). But as we suppose that $p,q$ are prime polynomials, this is a contradiction. Hence, there cannot exists any root of q(x). Hence, $p(x)/q(x)$ is continuous in $\mathbb R$ and the equality $(\arctan x)' = (\frac{p}{q})'$ holds in $\mathbb R$. Therefore, in $\mathbb R$, $\frac{p}{q} = \arctan x + c$ and in $[a,b]$, $\arctan = \frac{p}{q}$. Thus $c = 0$, and we get that $\forall x \in \mathbb, \arctan = \frac{p}{q}$. But we have already proved that this is a contradiction, as desired.

Further Questions:

The same procedure can be used to prove that $log x$ cannot be expressed as a rational function. Moreover, I have come up with two questions I would try to solve:

  • Can the argument applied here be generalised to an arbitrary function under certain hypothesis ($f$ continuous and $f'$ a rational function, for example)?

  • Can we find a similar argument to prove that $\sin x$ and $\cos x$ cannot be expressed in any interval as a rational function?

I would try to publish as soon as possible the conclusions of these questions.


A possible variant which does not use divisibility: Both sides of $$ \tag{*} (1+x^2)(p'(x)q(x)+p(x)q'(x))=q^2(x) $$ are polynomials, which means that if the identity holds on an interval $[a,b]$ of positive length then it holds for all $x \in \Bbb R$.

It follows that (see below) $$ \arctan(x) = \frac{p(x)}{q(x)} $$ holds for all $x \in \Bbb R$ as well.

That is impossible because $$\lim_{x \to - \infty } \arctan x \ne \lim_{x \to + \infty } \arctan x \,.$$


More details in response to the comments:

The difference between left-hand side and ride-hand side is a polynomial, and zero for all $x \in [a, b]$. It follows that the difference is identically zero, i.e. equation $(*)$ holds not only on $[a, b]$ but for all real $x$.

$(*)$ shows that $q(x) \ne 0$ for all $x \in \Bbb R$ (if $q(x_0) = 0$ with multiplicity $n > 0$ then the right-hand side has a zero of multiplicity $2n$, and the left-hand side has a zero of multiplicity at most $n-1$).

Therefore the function $$ f(x) = \arctan(x) - \frac{p(x)}{q(x)} $$ is defined for all $x \in \Bbb R$. $f$ is differentiable, and $(*)$ shows that $f'(x) = 0$ for all $x \in \Bbb R$.

It follows that $f$ is constant in $\Bbb R$. That constant is zero because $f(x) = 0$ for all $x \in [a, b]$.