Tips to solve equation with square root

65 Views Asked by At

I have a quite complex (at least for me) equation that is driving me a bit insane this days... I tried to solve it for two days but no way, so I'm asking for tips (not necessarily solve it) on how to solve it.

So, I start from this expressions (where $n$ it's a variable, and the rest are known values):

$ \frac{-qn -p +\sqrt{q^2n^2+bn+a}}{c} $

$ \frac{-qn -p -\sqrt{q^2n^2+bn+a}}{c} $

This expressions come from an algorithm that, given a number $m$ will return these with fixed values for $p, q, a, b, c$, and also two additional parameters $k_1$ and $k_2$.

Giving real values they give a concrete result for each value of $n$. As an example:

for m = 4723891, algotihm will return:

p = 44100
q = 1000
a = 39410000
b = 87840000
c = -200

Then, for "n = 127" (found using brute force, incrementing n from 1 by 1)

first result: 29 (x)
second result: 1682 (y)

Then, I can apply

$ (10(x-1))+k_1 = 281 (k_1 = 1);(10(y-1))+k_2 = 16811 (k_2 = 1) $

and finally

$ 281*16811=4723891 = m $

So, the full equation will be:

$ (10(x-1))+k_1*(10(y-1))+k_2=m $

So, when applying the general solution (the expressions given by my algorithm), I have the following equation:

$ (10(\frac{-qn -p +\sqrt{q^2n^2+bn+a}}{c}-1))+k_1*(10(\frac{-qn -p -\sqrt{q^2n^2+bn+a}}{c}-1))+k_2=m $

So, here I'm trying to calculate $n$ (in this example, will be $127$) for the general form of the equation (I mean, for any set of fixed values that the algorithm will return for any possible input $m$), but I'm not succeding. First thing I did, for simplicity, was rename the square root as

$ \sqrt{q^2n^2+bn+a} = R $

so it will be a bit easier to solve, but I'm still stuck. After some calculations I have

$ \frac{(-10qn-10p-10c+k_1c+10R)(-10qn-10p-10c+k_2c-10R)}{c^2}=m; $ $ (-10qn-10p-10c+k_1c+10R)(-10qn-10p-10c+k_2c-10R)=mc^2; $

After developing the product, I'm still having some $R$ (that mean, the square root), after a rearrange, it looks like

$ (10q^2n^2+20qpn+20qcn-qk_2cn-qk_1cn-k_1cR+k_2cR+10R=((\frac{mc^2}{10})+(10p^2-20pc-pk_2+10c-k_2c-k_1pc-k_1k_2c) $

And I don't know how to get rid of $R$ (I mean, don't having $n$ inside of the square root) Did I forgot something on the way that can make this easier?

Thanks.