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.

Write $p(x)=q(x)\arctan x$ and consider power expansions. Since $p(x),q(x)$ are polynomials, the Taylor series of $\arctan x$ must be a power series, so $|x|\le1$. This proves that $\arctan x$ is not a rational function on $|x|>1$.
Since $\arctan x$ is a strictly increasing, bounded function over the reals, we must have $\deg p=\deg q=n$. (*) Thus $$p_0+\cdots+p_nx^n=(q_0+\cdots+q_nx^n)\left(x-\frac{x^3}3+\frac{x^5}5-\cdots\right).$$ Equating $x^{n+1}$ terms yields $$0=q_n-\frac13q_{n-2}+\frac15q_{n-4}-\cdots_f$$ where $\cdots_f$ denotes a finite continuation (up to either $q_1$ or $q_0$ depending on the parity of $n$). Equating $x^{n+3}$ terms yields $$0=-\frac13q_n+\frac15q_{n-2}-\frac17q_{n-4}+\cdots_f.$$ Going indefinitely, we obtain $$\begin{bmatrix}1&-1/3&1/5&\cdots_f\\-1/3&1/5&-1/7&\cdots_f\\1/5&-1/7&1/9&\cdots_f\\\vdots_i&\vdots_i&\vdots_i&\ddots_{i,f}\end{bmatrix}\begin{bmatrix}q_n\\q_{n-2}\\q_{n-4}\\\vdots_f\end{bmatrix}={\bf 0}.$$ where $\cdots_i$ denotes an infinite continuation. Since each row is linearly independent of any other row, we obtain a contradiction as there are infinitely many such equations defining a finite number of variables. Thus $\arctan x$ is not a rational function on $|x|\le1$.
 (*) The deduction $\deg p=\deg q=n$ is actually not needed, but only used to make the calculations convenient. To equate the terms such that the LHS is zero, we can take $x^{\ge m+n-1}$ terms and the same conclusion follows. 
