linear solution of curve fitting on multiple linear functions differing by a multiplier I recently posted this question here but I thought this could be of interest also in mathematics, given I found a partially related question here
I am facing the following problem. I know nonlinear least squares can provide a solution but I am wondering if a linear way to solve this data fitting problem may exists.
This is my input dataset:
I've got three different dataset composed of scattered points

I know a linear equation in the form 
$$
y(x) = bx^2 + cx
$$
can be used to explain any of my dataset. I know how to fit this function to a given dataset (e.g the blue one) using linear least square, so I could fit the above function separately for each dataset, but I am looking for something different.
In the specific case I have an additional constrain: I also know that the three functions describing the three dataset share the $b$ and $c$ parameters, while they differ by a multiplier, something like this:
$$
\begin{cases}
y(x) = (bx^2 + cx) \; \text{explains the blue data}\\
y(x) = a'(bx^2 + cx) \; \text{for red data}\\
y(x) = a''(bx^2 + cx) \; \text{for green data}
\end{cases}
$$
I am looking for a (if it exists) linear way to solve this problem globally. Obtaining $a', a'', b$ and $c$
Maybe I am missing something so also having a different point of view on how to correctly formulate the problem could help.
Also approximate solutions are welcome...
 A: I think it is not possible (but I may be wrong) to solve this directly. But I would do following:


*

*Calculate $b,c$ via least squares with the blue dataset only.


Then iterate over those two steps:


*

*Take $b,c$ from previous step and calculate $a',a''$ via least squares.

*Take $a',b'$ from previous step and calculate $b,c$ via least squares.


I think this will converge pretty quickly when the datapoints are not scattered too much.
A: I haven't tried it and see how it looks, but probably look at it as a two stage linear least squares problem. I mean the following:


*

*Stage 1: write down the system of equations $y_i=Px_i$, where $y_i \in R^{3\times 1}$ is a 3-tuple observation across the three data sets, $x_i = [x \ \ x^2]^T$ is the input corresponding to $y_i$ and $P = \left(\begin{array}{cc}p_{0,0} & p_{0,1} \\ p_{1,0} & p_{1,1} \\ p_{2,0} & p_{2,1} \end{array}\right)$, and $i=0, 1, 2, \ldots, $ indicates the observation index. So, denoting $K_{yx} = \sum_i y_ix_i^T$ and $K_{xx} = \sum_i x_ix_i^T$, we can solve for $P$ as $P = K_{yx}K_{xx}^{-1}$. 

*Stage 2: Now we can take $p_{0,0}$ and $p_{0,1}$ as the inputs to a system $y = a'x$, with $p_{1,0}$ and $p_{1,1}$ as the outputs. Solve for $a'$. Repeat this for $a''$. One can probably do this iteratively taking the other rows of $P$ as inputs and solve for either $a'$ or $1/a'$ or $a''$ or $1/a''$ or $a'/a''$ accordingly.
Not sure if this will result in good solutions for $a',a'', b, c$.
