The original question is: How many solutions does a given equation have.
I understand that we can quickly draw graphs of both equations and see how many times they cross, but how would you solve this equation algebraically.
$\ln(x)=\frac{x^2}{2}-1$
The original question is: How many solutions does a given equation have.
I understand that we can quickly draw graphs of both equations and see how many times they cross, but how would you solve this equation algebraically.
$\ln(x)=\frac{x^2}{2}-1$
Lambert W solution $$ \log(x) = \frac{x^2}{2}-1 \\ x = e^{(x^2/2)-1} \\ x^2 = e^{x^2-2} \\ x^2 e^{-x^2}=e^{-2} \\ -x^2 e^{-x^2} = -e^{-2} \\ -x^2 = W\left(-e^{-2}\right) \\ x = \left(-W(-e^{-2})\right)^{1/2} $$ Two real solutions from branches of $W$: $$ (-W_0(-e^{-2})\big)^{1/2} \approx 0.3982390482,\qquad (-W_{-1}(-e^{-2})\big)^{1/2} \approx 1.773751172 $$
Solving $\ln x=x^2/2-1$ is same as solving $\ln x^2-x^2+2=0$ which is same as solving $\ln u-u+2=0$ and using $x^2=u$ to solve for $x$. Using Newton's method we get the following iteration formula which if you apply a good number of times starting with $u_0=4$ once and $u_0=1.5$ the next time will land you fairly close to the square of the actual solutions.
$$u_{n+1}=u_n-\dfrac{\ln u_n-u_n+2}{1/u_n-1} \land u_0=\{1.5, 4\}$$
Can you carry out the calculations?
Consider that you look for the zero(s) of function $$f(x)=\log(x)-\frac{x^2}{2}+1$$ Then $$f'(x)=\frac{1}{x}-x \qquad \text{and} \qquad f''(x)=-\frac{1}{x^2}-1 <0 \,\, \forall x$$ The first derivative cancels at $x=\pm 1$ but $x >0$ because of the logarithm.
Close to $0$, $f(x) \to -\infty$ and the function increases. For $x=1$, $f(1)=\frac 12$ and it is a maximum. Since $x^2$ grows faster than $\log(x)$, at a point, $f(x)$ will become negative.
So, to summarize, there is one root in $(0,1)$ and another root $>1$.
To get a rough idea about the roots, build a Taylor expansion around $x=1$; this would give $$f(x)=\frac{1}{2}-(x-1)^2+O\left((x-1)^3\right)$$ Ignoring the higher order terms, this gives, as estimates, $x_1=\frac{2-\sqrt{2}}{2} $ and $x_2=\frac{2+\sqrt{2}}{2}$.
Now, you can start Newton method and get the following iterates $$\left( \begin{array}{cc} n & x_n \\ 0 & 0.292893 \\ 1 & 0.379664 \\ 2 & 0.397648 \\ 3 & 0.398238 \\ 4 & 0.398239 \end{array} \right)$$ $$\left( \begin{array}{cc} n & x_n \\ 0 & 1.70711 \\ 1 & 1.77639 \\ 2 & 1.77375 \end{array} \right)$$ wich are the solutions for six significant figures.
You can not solve this equation algebraically. But you can solve it with numerical methods, like the Newton method or maybe the Lambert W-function.