# How can i solve $\frac{x^2}{a}-\frac{x}{b}-\ln(x)=0$

How can i solve: $$\frac{x^2}{a}-\frac{x}{b}-\ln(x)=0$$ for any pair $(a,b)$?

For example, if $a=29$ and $b=7$, wolframalpha gives me: $$x= 0.903969\ldots$$ $$x= 10.6013\ldots$$ but it wont show me how the calculation is done.

http://www.wolframalpha.com/input/?i=x%5E2%2F29-x%2F7-ln(x)%3D0

• The calculation is done numerically. There is no known "closed form" solution in general. – Robert Israel Jun 12 '18 at 1:48
• @RobertIsrael that would explain why calculation is not shown... – François Huppé Jun 12 '18 at 1:53
• can we solve it by linearizing the equation? like expanding $\ln x$ in a Taylor Series and then considering the first term of the series only? – Sujit Bhattacharyya Jun 12 '18 at 2:08
• @SujitBhattacharyya That would not "solve" it, but will provide an approximation. – Erik M Jun 12 '18 at 2:38

Consider that you look ffor the zero(s) of function $$f(x)=\frac{x^2}{a}-\frac{x}{b}-\ln(x)$$ for which $$f'(x)=\frac{2 x}{a}-\frac{1}{b}-\frac{1}{x}\qquad \text{and} \qquad f''(x)=\frac{2}{a}+\frac{1}{x^2}$$ As in your case, let us assume $a$ and $b$ to be positive.

This makes $f''(x)>0 \,\, \forall x$ and the first derivative cancels at a point $x_*$ given by $$x_*=\frac{a+\sqrt{a(a+8 b^2)}}{4 b}$$ $$f(x_*)=\frac 12-\frac{a +\sqrt{a(a+8 b^2)}}{8 b^2}-\log \left(\frac{a+ \sqrt{a(a+8 b^2)}}{4 b}\right)$$ If $f(x_*) <0$, there will be two roots such that $0 < x_1 < x_*$ and $x_2 > x_*$; otherwise, no real root to the problem..

With this information, we can now consider using Newton method using, for example, as starting points $x_0=\frac{x_*}4$ and $x_0=4x_*$.

Trying for your specific example, for the first root, the iterates will be $$\left( \begin{array}{cc} n & x_n \\ 0 & 1.2454852120 \\ 1 & 0.8454663552 \\ 2 & 0.9020694730 \\ 3 & 0.9039667915 \\ 4 & 0.9039687574 \end{array} \right)$$ and, for the second root $$\left( \begin{array}{cc} n & x_n \\ 0 & 19.92776339 \\ 1 & 13.27849976 \\ 2 & 10.98937363 \\ 3 & 10.61245701 \\ 4 & 10.60133991 \\ 5 & 10.60133017 \end{array} \right)$$ which are the solution for ten significant figures.

For sure, you can have much better estimates if you start graphing the function.

Update

At least for the largest root (when it does exist), we can have a good estimation using a Taylor series around $x_*$. Ignoring the higher order terms, this would give $$f(x)=f(x_*)+\frac 12 f''(x_*) (x-x_*)^2+O((x-x_*)^2)$$ from which $$x_{est}=x_* +\sqrt{-\frac{2f(x_*)}{f''(x_*)}}$$

Applied to the example, this would give $x_{est}\approx 10.1546$ and the following iterates for Newton method

$$\left( \begin{array}{cc} n & x_n \\ 0 & 10.15464106 \\ 1 & 10.61836864 \\ 2 & 10.60135298 \\ 3 & 10.60133017 \end{array} \right)$$