TITLE: Deceptive linear algebra problem
QUESTION [6 upvotes]: Does anyone recognize this problem? There are $2p$ equations and $2p$ unknowns, and it feels like a classic, but I've never encountered it before:
Given $d_1, d_2, \ldots d_p$, find $a_1, a_2, \ldots a_p$ and $n_1, n_2, \ldots n_p$:
$$ \left[ \begin{array}{ccc}
d_1\\
d_2\\
d_3\\
\vdots\\
d_{2p}
\end{array} \right]
= \left[ \begin{array}{ccc}
a_1, ~a_2, \cdots ~a_p\\
a_1^2, ~a_2^2, \cdots ~a_p^2\\
a_1^3, ~a_2^3, \cdots ~a_p^3\\
\vdots\\
a_1^{2p}, ~a_2^{2p}, \cdots ~a_p^{2p}
\end{array} \right] \cdot
\left[ \begin{array}{c} 
n_1\\
n_2\\
\vdots\\
n_p
\end{array} \right] $$
(and where $a \succeq 0$ and $n \succeq 0$ and only real values are considered, so wherever there can be positive and negative roots for the values of $a_i$, only the positive roots need be considered). 
It seems straightforward to solve with elimination: From the first row, let $a_1 = \frac{d_1-\sum_{i>1} a_i n_i}{n_1}$. Then from the second row, solve for $a_2$ (which will now involve a quadratic, etc.). Because the polynomials get larger, solving it with elimination in this manner can be quite slow (I crashed sage doing this on a fairly small problem).
Has this family of problems been characterized well in the literature and can it be solved efficiently in practice? Even a numerical solution would suffice, as long as it will converge certainly (no multi-start Levenberg-Marquardt, etc.)...

REPLY [6 votes]: Actually, the problem precisely as you've stated it can't be solved: you can't write $(1,0,0,0)$ as a sum of multiples of two vectors $(a,a^2,a^3,a^4)$ and $(b,b^2,b^3,b^4)$, but this is easily fixed by starting with the zeroth power instead of the first. (Even more degenerately, $(1,0)$ isn't a multiple of $(a,a^2)$ for any $a$.)
Dongryul Kim's answer is basically correct, but let me expand a little bit on it: the span of the vectors $(1,a,\dots, a^{n-1})$ for $a\in A$ for some finite subset $A$ in any field has dimension equal to the size of $A$ if $\# A< n$, and spans the whole space otherwise (note how important it is that we start at the zeroth power to make this work).  If $\# A< n$, then the orthogonal to this space is spanned by vectors of the form $(0,\dots,0,e_{\# A},\dots, e_1,1,0\dots,0)$ where $\prod_{a\in A}(X-a)=X^{\# A}+e_1X^{\# A-1}+\cdots+e_{\# A}$ (these are obviously orthogonal to the vectors, and have the correct dimensional span).  Thus, if we want to write $(d_1,\dots, d_n)$ as a sum of these vectors, we have to find numbers $1,e_1,\dots,e_q$ such that $(d_1,\dots, d_n)$ is orthogonal to all of these vectors.  That is, we want to consider the equation 
\begin{equation} \begin{bmatrix} d_{q+1} & d_{q} & \cdots & d_1 \\ d_{q+2} & d_{q+1} & \cdots & d_2 \\ \vdots & \vdots & \ddots & \vdots \\ d_{n} & d_{n-1} & \cdots & d_{n-q} \end{bmatrix} \begin{bmatrix} 1 \\ e_1 \\ \vdots \\ e_q \end{bmatrix} = \begin{bmatrix} 0 \\ 0 \\ \vdots \\ 0 \end{bmatrix}. \end{equation}
For $q=1$, this will only have a non-trivial solution if all the $d_i$'s are 0.  Otherwise, there will be a unique smallest integer $q>1$ such that this equation has a non-trivial solution.  In that case, we have that $(d_1,\dots, d_n)$ is in the span of the vectors $(1,a,\dots, a^{n-1})$, for $a$ ranging over the roots of $X^{q}+e_1X^{q-1}+\cdots+e_q$, and one can easily solve for the $n_i$'s; by construction, we've seen that these roots are the unique minimal set such that $(d_1,\dots, d_n)$ is in the span.  By basic linear algebra, we must have  $q\leq \lceil n/2\rceil$, since at that point, the matrix has more columns than rows, and must have a non-trivial solution. Obviously, generically, we'll have equality there.