How can I prove that last and first coefficient of a polynomial can determine the number of positive real roots (its parity)? Let $f(x) = a_{n}x^{n} + \ldots + a_{1}x + a_{0}$ and $r$ be the number of positive real roots.
If $a_{n}a_{0} > 0$, then $r$ is an even number.
If $a_{n}a_{0} < 0$, then $r$ is an odd number.
I found this lemma, but I don't know how to prove it.
I am not sure if there is supposed to be "number of real roots" or "number of positive real roots".
Any help is appreciated.
 A: You must assume that $f$ is a polynomial with real coefficients, see below. Then
$$
 f(z) = a_n(z-z_1) (z-z_2) \cdots (z-z_n)
$$
where $z_1, \ldots, z_n$ are the (real or complex) zeros of $f$. Setting $z=0$ and multiplication with $a_n$ gives
$$ \tag{*}
 a_n a_0 =a_n^2 (-z_1) (-z_2) \cdots (-z_n) \, .
$$
If $a_n a_0 \ne 0$ then none of the roots is equal to zero.
The zeros of $f$ are either real, or pairs of conjugate complex numbers $z_k$, $\overline z_k$. In that case $(-z_k)(-\overline z_k) = |z_k|^2$ is positive.
It follows that the sign of the right-hand side in $(*)$ is $(-1)^r$ where $r$ is the number of positive real zeros of $f$.

It also follows from Descartes' rule of signs: The number of sign changes in the coefficients of $f$ is even if $a_na_0 > 0$, and odd if $a_n a_0 < 0$, and the number of positive real roots is equal to that number of sign changes, or less by an even number.

Addendum: Here is an example which shows that the conclusion can fail if the coefficients are not real numbers:
$$
 f(z) = (z-1)(z-i)(z-2i) = z^3 + (-1-3i)z^2 + (-2+3i) z + 2
$$
satisfies $a_na_0 = 2 > 0$, but has exactly one positive real root.
A: WLOG $a_n=1$*. The polynomial varies from $a_0$ (at $x=0$) to infinity. If $a_0>0$, the number of changes of sign can only be even, and conversely.


*If $a_n\ne1$, you divide all coefficients by $a_n$ and what matters is the sign of $\dfrac{a_0}{a_n}$, which is the same as that of $a_0a_n$.
A: Assuming $f(x)$ is a polynomial with real coefficients,
Hint:
WLOG, let $a_n>0$.  Then if $a_0<0$, $f(0)$ is negative, and the polynomial has to cross the positive X axis an odd number of times (counting multiplicity) as it eventually $\displaystyle \lim_{x\to +\infty} f(x) \to +\infty$.
Similarly for the case of $a_0>0$.
