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: 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]$.
A: 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. 
A: I owe the inspiration for this answer to Martin R.
Assume the existence of two relatively prime real polynomials $f, g \in \mathbb{R}[X], g \neq 0$ and of two real numbers $a<b$ such that $g(x)\neq 0$ for any $x \in [a, b]$ and such that $\mathrm{arctg}\hspace{1pt} x=\frac{f(x)}{g(x)}$ for any $x \in [a, b]$. By taking derivatives one reaches the conclusion that the rational functions associated to the rational fractions $\frac{1}{X^2+1}$ respectively $\frac{\dot{f}g-f\dot{g}}{g^2}$ agree on $[a, b]$ and therefore we must have equality between the rational fractions themselves, $\frac{1}{X^2+1}=\frac{\dot{f}g-f\dot{g}}{g^2}$ (by virtue of the principle of extending algebraic identities, since under the indispensible assumption $a<b$ we gather that $[a, b]$ is an infinite set).
Let $A$ denote the (finite) set of roots of the polynomial $g$. We first show that $A=\varnothing$ by assuming the contrary. Since $[a, b] \subseteq \mathbb{R} \setminus A$, by reasons of convexity we must have that $[a, b] \subseteq I$, where $I$ is one of the connected components of $\mathbb{R} \setminus A$, which is necessarily of the form $(c, d)$ with $c<d$ or $(c, \infty)$ or $(-\infty, d)$. On $I$ we therefore have agreement between the restrictions of the rational functions associated to the rational fractions mentioned above. These restrictions are on the other hand the derivatives of the restrictions to $I$ of the arctangent respectively of the rational function associated to the rational fraction $\frac{f}{g}$, which means that these latter restrictions must differ by a constant, since their derivatives agree on an interval. However, these restrictions agree on the entire interval $\varnothing \neq [a, b] \subseteq I$ and therefore are equal (as functions). This means explicitly that $\mathrm{arctg}\hspace{1pt} x=\frac{f(x)}{g(x)}$ for every $x \in I$ and leads to the following contradiction: regardless of which of the three types (mentioned above) the interval $I$ is of, it (the interval $I$) will possess at least a finite extremity $c \in A$, hence a root of $g$ but not of $f$ (since by hypothesis $f$ and $g$ are coprime). This means that the respective lateral limit of $\frac{f(x)}{g(x)}$ in $c$ will be infinite, yet on the other hand this must also equal the lateral limit of the arctangent in $c$ which is finite and equal to $\mathrm{arctg}\hspace{1pt} c$ (since the arctangent is continous on the whole real axis). The contradiction stems from the fact that the connected component $I$ is compelled to be of one of the three types listed above, which in turn is entailed by the hypothesis that $A \neq \varnothing$.
We thus conclude that with necessity $A=\varnothing$, hence the rational functions associated to the rational fractions $\frac{\dot{f}g-f\dot{g}}{g^2}$ respectively $\frac{f}{g}$ are defined on $\mathbb{R}$ in its entirety. By the same token (involving the agreement of derivatives) as above, we gather that $\mathrm{arctg}\hspace{1pt} x=\frac{f(x)}{g(x)}$ for all $x \in \mathbb{R}$. This situation is also untenable however, for the simple reason that if a rational function has finite nonzero limit at $\infty$ it must have the same limit at $-\infty$, a property that the arctangent does not have.
A: If $$e^z=\frac{p(z)}{q(z)},$$
by differentiation we get
$$\frac pq=\frac{p'q-pq'}{q^2}$$
or
$$pq=p'q-pq'.$$
The left and right degrees cannot match so this is not possible (the polynomials can only agree on a finite number of points). This settles the case of the exponential, the sine, cosine and tangent.
A: I like Martin R's argument.
Here is an alternative using the existence and uniqueness of the partial fraction decomposition of a rational function.
Any rational function $R(z)$ over $C$ can be written uniquely as the sum of a polynomial and terms of the form $\frac{k}{(z-a)^n}$.
Diffrentiating this expression and applying uniqueness, it is clear that a rational function is a derivative of some other rational function if and only if it has no terms of the form $\frac{k}{z-a}$ in its decomposition.
Since $\frac{1}{z^2 + 1}$ has two simple poles, at $i$ and $-i$, it can't be a derivative of a rational function.
