We have
$$ F(x,y)= \frac{Q}{x} \frac{\partial P}{\partial x} - \frac{P}{x} \frac{\partial Q}{\partial x} - \frac{Q}{y} \frac{\partial P}{\partial y} + \frac{P}{y} \frac{\partial Q}{\partial y} $$
where
$$P = \sum_{i=1}^{N}(a_i x + b_i y)^2 $$ $$Q = \sum_{i=1}^{N}(c_{i} x + d_{i} y)^2$$
and $a_i, b_i, c_{i}, d_{i}$ are constant parameters defined for $1\leq i,j \leq N$.
We want to find the solutions of equation $F(x,y)=0$. For a simpler case, where $P$ is defined as above and $Q=1$, by using a change of variable $m=\frac{y}{x}$, we get a quadratic equation for $m$ that could be simply solved and give the two solutions for $m$. I wonder if using same change of variable, one could obtain the solutions for the more general case (with $Q$ of the form given above or similar form).
Some background: $x,y$ are coordinates of a point in a two dimensional space and define a line that passes through $(x,y)$ and the origin $(0,0)$. $P$ and $Q$ are derived from projection of some other points on this line. Using $m=y/x$ makes sense since the projections only depend on the slope of the line and not the actual values of $(x,y)$. Our goal is to find the line (defined by its slope $m$) that satisfies $F(x,y)=0$.
EDIT: This problem is the special case for a more general problem to find the mapping from an $N$ dimensional space to an $M$ dimensional space that would minimize sum of distances of pairs of similar points ($P$) normalized to sum of distances of pairs of dissimilar points ($Q$). The solution given here solves it for mapping from 2D to 1D. I also posted a new question for the case mapping from 3D to 1D here which I expect to be solvable in a similar way.
Using some help from Mathematica I came to this answer:
$F(x,y)=0$ for $m= \frac{y}{x} = \frac{-B\pm\sqrt{B^2-4AC}}{2A}$
where
$A = (\sum_{i=1}^{N}b_i^2)(\sum_{i=1}^{N}c_i d_i)-(\sum_{i=1}^{N}d_i^2)(\sum_{i=1}^{N}a_i b_i)$
$B = (\sum_{i=1}^{N}b_i^2)(\sum_{i=1}^{N}c_i^2)-(\sum_{i=1}^{N}a_i^2)(\sum_{i=1}^{N}d_i^2)$
$C = (\sum_{i=1}^{N}c_i^2)(\sum_{i=1}^{N}a_i b_i)-(\sum_{i=1}^{N}a_i^2)(\sum_{i=1}^{N}c_i d_i)$
Any idea for a simple derivation, verification or interpretation?