# Ways to find the sum of complex roots with only positive imaginary parts?

I have an $$n$$-th order polynomial which has either 1 real root with $$(n-1)$$ complex roots for $$n$$ odd, or only complex roots for $$n$$ even. Is there a way to obtain the sum of all positive imaginary roots?

For example, here is a method to attempt to get there:

Let $$r_1,...,r_n$$ be be the roots of the polynomial $$f(x)=(x-r_1)...(x-r_n)=\sum_{k=0}^{n} c_k x^k$$.

Using vieta's formulas, $$\sum_{k=1}^{n} r_k = -c_{n-1}/c_n$$. Since the complex roots are conjugate, and the real parts repeat in the conjugate roots, it can be derived that the real positives which show up twice while the imaginary parts cancel out, for $$n$$ even sum up to $$\frac{1}{2}\sum_{k=1}^{n}r_k=-\frac{c_{n-1}}{2c_n}$$. If $$n$$ is odd, then the additional real root is excluded from this sum. Is there a way to obtain something like this with a fairly simple formula but only for the imaginary parts? Or can this not be done? This is what i'm asking in summary

$$\sum_{k=1}^{n}\{r_k|Im(r_k)>0\}=?$$

This is pretty much as hard as finding the roots individually, for the following reason. Suppose there was some simple procedure (say some simple function of the coefficients) which produced, from a polynomial $$f(x)$$, the sum of the roots of $$f$$ with positive imaginary part. Then if we apply the procedure to $$f(x - bi)$$, we'd get the sum of the complex roots of $$f$$ with imaginary part greater than $$b$$. This already shows that the procedure can't be a continuous function of the coefficients, since this sum changes discontinuously as $$b$$ increases and crosses the imaginary part of a root. By varying $$b$$ and watching where the sum changes we can isolate the imaginary parts of every root (either exactly or to arbitrary precision depending on how "simple" the simple procedure is). This already gets us every root generically, although not if multiple roots share exactly the same imaginary part. But in that case we can consider modifications like $$f(e^{i \theta} (x - bi))$$ which have the effect of rotating the roots.
• @Dustan: this isn't a big deal. If somehow the procedure works but only for polynomials with real coefficients then given an arbitrary polynomial $g(x)$ we can apply it to $g(x) \overline{g(x)}$ where the second expression means take the complex conjugate of every coefficient. $\overline{g(x)}$ has roots which are the complex conjugate of $g$'s so now you are extracting the sum of the roots of $g$ whose imaginary part is either positive, plus the sum of the complex conjugates of the roots of $g$ whose imaginary part is negative. Now... Jun 29 at 21:34
• ...apply this procedure to $g(x - bi)$ as above and you'll get discontinuities every time a root has imaginary part exactly $b$ since those roots will get omitted from the sum as they transition from contributing to the first vs. the second part. Jun 29 at 21:34