Number of real solutions.

Hint: the LHS is continuous in each $(a_i,a_{i+1})$ interval. Note that for a small enough $\varepsilon$, $\dfrac{a_i}{a_i-x} \ll 0$ for an $x\in (a_i,a_i+\varepsilon)$ and $\dfrac{a_{i+1}}{a_{i+1}-x} \gg 0$ for an $x\in (a_{i+1}-\varepsilon,a_{i+1})$.

Hint2: The fact that the RHS is nonzero and the fact that the LHS gets close to $0$ for $x \ll a_1$ or $x\gg a_n$ should yield the last real solution.


We see that the original equation is equal to

$$2015\prod_{i=1}^n(a_i-x)$$

Now define

$$P(x)=\left(\sum_{k=1}^n\frac{a_k}{a_k-x}\prod_{i=1}^n(a_i-x)\right)-2015\prod_{i=1}^n(a_i-x)$$

We need to show that $P$ has exactly $n$ real roots. We can compute $P(a_l)$ to see that

$$P(a_l)=\sum_{k=1}^n\frac{a_k}{a_k-a_l}\prod_{i=1}^n(a_i-a_l)$$

which is

$$P(a_l)=a_l\prod_{1\leq i\leq n, i\neq l}(a_i-a_l)$$

(note that $P(a_l)\neq 0$. This is important, because if $a_l$ would've been a root, it wouldn't have been a solution to the original equation). Since $a_i<a_l$ iff $i<l$, we know all the terms $(a_i-a_l)$ with $i<l$ are negative, and all other factors are positive (also the $a_l$), so the sign of this is $(-1)^{l-1}$. This means $P$ is wobbling up and down, crossing the x-axis between every $a_i$ and $a_{i+1}$. This gives us $n-1$ roots (one between $a_1$ and $a_2$, one between $a_2$ and $a_3$, ..., one between $a_{n-1}$ and $a_n$). But where is the last root? No worries! If we have a complex root $\alpha$, then $\bar{\alpha}$ is also a (different and complex) root (this only holds if $P$ has real coefficients, but it does, so we're good). This means, if we have $n-1$ real roots of a polynomial degree $n$, then we can't have the last root complex, because complex roots come in pairs.