How to solve $\ln(x^2)=x$?

138 Views Asked by At

I am struggling to solve the equation $\ln(x^2)=x.$ I can't figure out how to isolate the variable. Exponentiating both sides leaves me with $x=e^{\frac{x}{2}}.$ I would really appreciate any guidance, or first steps.

Also, isn't one of the properties of logs that $\ln(x^2)=2\ln(x)?$ How can these two things be equal if the term on the left hand side can input negative numbers, but the term on the right cannot?

4

There are 4 best solutions below

3
On BEST ANSWER

This solution is not "elementary" as we say. You cannot get it using the operations from high-school algebra.

We can get the solution using the Lambert W function LINK

Definition: $u e^u = t$ iff $u = W(t)$. So reason like this $$ \ln(x^2)=x \\ x^2 = e^x \\ x=\pm e^{x/2} \\ xe^{-x/2} =\pm 1 \\ \frac{-x}{2}e^{-x/2} = \mp\frac{1}{2} \\ \frac{-x}{2} = W(\mp 1/2) \\ x = -2W(\mp 1/2) $$ It turns out that $W(-1/2)$ is not real, but $W(1/2)$ is.
Then we get $x =-2W(1/2) \approx -0.703467$.

0
On

Note: $\ln(x^2) = 2\ln(x)$ assumed $x>0$

For this example, this is not true, root is negative.

Let $f(x) = e^x - x^2 → f'(x) = e^x - 2x$

Solve using Newton's method, $ x = x - \Large{e^x - x^2 \over e^x - 2x}$:

$$Guess = -1 → -0.7330436052 → -0.7038077863 → -0.7034674683 → -0.7034674225$$

1
On

There is a nice approximate algebraic solution as shown below. Let

$$f(x)=e^x-x^2$$

and the root $r=-1+a$. Approximate according to,

$$f(r)=0\approx f(-1)+f'(-1)a+\frac 12 f''(-1) a^2\tag{1}$$

Evaluate,

$$f(-1)=\frac 1e-1, \>\>\> f'(-1)=\frac 1e + 2,\>\>\>f''(-1)=\frac 1e -2$$

Plug above values into (1) to obtain,

$$0=1-e+(1+2e)a+\frac 12 (1-2e)a^2$$

Solve for the root,

$$r = -1+a=\frac{\sqrt{10e-1}-2}{1-2e}=-0.703$$

3
On

Consider that you look for the zero's of function $$f(x)=\log(x^2)-x$$ for which $$f'(x)=\frac 2 x-1 \qquad \text{and} \qquad f''(x)=-\frac 2 {x^2} < 0 \qquad \forall x$$ The first derivative cancels at $x=2$ and $f(2)=\log(4)-2 <0$. By the second derivative test $x=2$ corresponds to a maximum; then, no solution for $x >0$.

By inspection, $f(-1)=1$ making the solution to be between $-1$ and $0$.

Being lazy, build the Taylor series around $x=-1$ to get $$f(x) \sim 1-3 (x+1)-(x+1)^2+O\left((x+1)^3\right)$$ Solving the quadratic and keeping the solution in the range, then $x=\frac{1}{2} \left(\sqrt{13}-5\right)\approx -0.697224$ which is not too bad.

For better approximations, instead of Taylor series, build $[2,n]$ Padé approximants and set the numerator equal to zero. For example, for $n=2$, $$f(x)\sim \frac{1-\frac{23 }{6}(x+1)+\frac{14}{9} (x+1)^2 } {1-\frac{5 }{6}(x+1)+\frac{1}{18} (x+1)^2 }\implies x=-\frac{3 \sqrt{305}-13}{56}\approx -0.703442$$ while the exact solution given by Lambert function would be $\approx -0.703467$.

Using the $[2,4]$ Padé approximant would lead to the exact result (for six significant figures).

Edit

Using @Quanto's answer, we can make amazing approximations building the $[1,n]$ Padé approximant of function $(e^x-x^2)$ around $x=-1$. The problem reduces to a linear equation in $(x+1)$. Below are given the expressions and their decimal values $$\left( \begin{array}{ccc} n & \text{formula} & \text{value} \\ 0 & -\frac{2+e}{1+2 e} & -0.73304361 \\ 1 & -\frac{3+13 e+2 e^2}{1+11 e+6 e^2} & -0.70599412 \\ 2 & -\frac{8+140 e+164 e^2+12 e^3}{2+80 e+194 e^2+48 e^3} & -0.70361456 \\ 3 & -\frac{30+1674 e+6426 e^2+3390 e^3+144 e^4}{6+738 e+5058 e^2+5142 e^3+720 e^4} & -0.70346790 \end{array} \right)$$