How to solve log(x)-x+2=0 for x?

  • Thread starter rukawakaede
  • Start date
In summary, the conversation discusses the equation log(x) - x + c = 0 and whether there are any general methods to obtain an exact solution for equations of this type. It is mentioned that there are no elementary solutions, and the easiest way to solve it is by graphing. The use of the Product Log function is suggested for a closed form solution, and it is noted that there are two solutions to the equation. The conversation also touches on the fact that the W-function has infinitely many complex solutions but only two real solutions, and that fixed point iteration can be used to find the real solutions. Finally, there is a mention of the beauty and complexity of the problem, comparing it to an upside-down Christmas tree.
  • #1
rukawakaede
59
0
Hi,

Could anyone give me some ideas on how to solve the following question:

log (x) - x + 2 = 0

or generally

log (x) -x + c = 0 where c is a constant.

I know how to approximate this by graphing but is there any general method(s) to obtain an exact solution for equations of this type?

Thanks!
 
Mathematics news on Phys.org
  • #2
There are no elementary solutions for this problem. The easiest thing to do is to graph it. To get a "closed" form solution will require the Product Log function:

http://mathworld.wolfram.com/LambertW-Function.html

Also note that there are two solutions to your equation.
 
  • #3
Nevermind...
 
  • #4
DivisionByZro said:
There are no elementary solutions for this problem. The easiest thing to do is to graph it. To get a "closed" form solution will require the Product Log function:

http://mathworld.wolfram.com/LambertW-Function.html

Also note that there are two solutions to your equation.

Yes, there are two solutions if c > 1.
Thanks, I will look at the product log function stuff.
 
  • #5
JG89 said:
Nevermind...

No worries.
 
  • #6
rukawakaede said:
but is there any general method(s) to obtain an exact solution for equations of this type?

Thanks!

[tex]\log(x)=x-2[/tex]

[tex]x e^{2-x}=1[/tex]

[tex]-xe^{-x}=-\frac{1}{e^2}[/tex]

Now take the W function of both sides:

[tex]x=-W(-\frac{1}{e^2})[/tex]

Now, the W-function is infinitely valued and so there are an infinite number of solutions to this equation.
 
  • #7
jackmell said:
[tex]Now, the W-function is infinitely valued and so there are an infinite number of solutions to this equation.
While there an infinite number of solutions in the complex numbers, there are only two solutions in the reals.
 
  • #8
Hi rukawukaede. The W(x) function has infinitely many complex solutions, but only zero, one or two real solutions (x,W(x) real).

- For -1/e < x < 0 it has two real solutions (your case).

- For x < -1/e it has no real solutions.

- otherwise it has a unique real solution.
 
  • #9
Without use of the Lambert W function (you will be hard put to find implementations outside of Mathematica, Maple, or Matlab) there is a very simple technique you can use to find the real solutions to

[tex]x - \log x = c,\,\,c>=1[/tex]

Fixed point iteration can be used to find both solutions. Note that the above is equivalent to [itex]x=\log x + c[/itex]. Writing this as a fixed point iteration scheme,

[tex]x_{n+1} = \log x_n + c[/tex]

Simply start with some initial guess [itex]x_0[/itex] and iteratively generate [itex]x_1, x_2,[/itex] etc. using the above. If the sequence [itex]{x_0, x_1, x_2, \cdots}[/itex] does converge, it will converge at one of the solution points. An initial guess of 1 will always converge. It will take a while if c is fairly close to 1. Fixed point iteration is very simple but it can be very slow to converge.

In fact, this will only find the larger of the two solutions. So how to find the other solution? Since exp(x) is a bijection, we can go from [itex]x-\log x = c[/itex] to [itex]\exp(x)/x = \exp(c)[/itex], or [itex]x = \exp(x-c)[/itex]. This suggests another fixed point iteration scheme,

[tex]x_{n+1} = \exp(x_n-c)[/tex]

If this sequence converges it will converge to the smaller of the two solutions, and once again, an initial value of 1 will always result in a convergent sequence. Once again the convergence is rather slow when c is just slightly larger than 1.
 
  • Like
Likes Ian Heath
  • #10
Oh man, you guys are missin' the beauty of this problem by using "real" blinders and he didn't say anything about real solutions neither. It's like just the tip of the iceberg; whole nother world down below the surface which makes crystal-clear many problems above. I say not only solve it, but draw it, then pick out the (complex) solutions like ornaments on an (upside-down) christmas tree. That to me is one of the real beauties of mathematics. Yeah, that's the assignment then, figure out how this problem is like a christmas tree turned upside-down.
 

1. How do I solve log(x)-x+2=0 for x?

To solve this equation, we can use the substitution method. Let y = log(x). Then, the equation becomes y - x + 2 = 0. Rearrange the equation to get x = y + 2. Substitute back in the original equation to get log(x) - (y + 2) + 2 = 0. Simplify to get log(x) - y = 0. Using the definition of logarithms, we know that x = 10^y. Substitute this into the equation and solve for y. Then, plug the value of y back into x = y + 2 to get the final solution.

2. What is the domain of the equation log(x)-x+2=0?

The domain of this equation is all real numbers greater than 0. This is because the logarithm function is only defined for positive numbers, and the equation cannot be solved if x is negative or 0.

3. Is there more than one solution to log(x)-x+2=0?

Yes, there are two solutions to this equation. This can be seen by graphing the equation, which will show two points of intersection with the x-axis. Additionally, using the substitution method, we can see that there are two values of y that satisfy the equation, which correspond to two values of x.

4. Can this equation be solved algebraically?

Yes, this equation can be solved algebraically using the substitution method. However, it is not possible to solve this equation using basic algebraic operations such as factoring or isolating the variable.

5. What is the numerical approximation for the solutions to log(x)-x+2=0?

The numerical approximations for the solutions to this equation are x = 0.232 and x = 5.346. These values can be found using a graphing calculator or by using a numerical root-finding method such as the bisection method or Newton's method.

Similar threads

  • General Math
Replies
13
Views
1K
  • General Math
Replies
3
Views
1K
  • General Math
Replies
1
Views
657
  • General Math
Replies
1
Views
741
  • General Math
Replies
2
Views
869
Replies
4
Views
1K
  • General Math
Replies
9
Views
2K
  • General Math
Replies
7
Views
979
Replies
4
Views
839
  • General Math
Replies
5
Views
2K
Back
Top