How to solve "impossible" equations using Lambert's W function

I came across this question on Twitter. Questions of this sort are fairly common, but the method of solution is not very well known, so I thought that it was worth a few words of explanation.

The easy answer is that the equation cannot be solved using standard algebraic functions; one must use numerical methods such as Newton's method to approximate the solutions. But it can be solved algebraically if we add some more functions to our repertoire, just as the introduction of the square root function allowed us to solve quadratic equations.

In this case, the "magic" function is called the Lambert W function. It is defined as the inverse of the function f(x) = x * e^x. In order to use this function, we must manipulate the equation into the form x * e^x = y, then we invert to obtain x = W(y).

Let's use this idea to solve x^3/24 - ln(x) = 0. We get rid of the logarithm by substituting x = e^t, yielding the equation e^(3t)/24 - t = 0. This can be rewritten as t * e^(-3t) = 1/24, or -3t * e^(-3t) = -1/8.

Now here is where the magic happens. We use Lambert's W function to invert this equation, and we get -3t = W(-1/8), or t = -W(-1/8)/3. Since x = e^t, our final answer is x = e^(-W(-1/8)/3).

An astute reader might graph the equations y = x^3 / 24 and y = ln(x), and observe that the curves cross in two points. So why did I only give one solution? Well, it turns out that the function f(x) = x * e^x is not one-to-one; it's increasing when x > -1 and decreasing when x is less than -1. So the Lambert W "function" actually has two branches, and the two branches yield the two solutions to the equation. This is similar to the fact that every positive number has two square roots.

What a relief! Thanks, David!

Like
Reply

tank you dear david it is nice

Like
Reply

Ingenious trick! thanks for the insight David

Like
Reply

To view or add a comment, sign in

More articles by David Radcliffe

  • Assessing non-quantum threats to RSA

    The security of the RSA cryptosystem relies on the difficulty of integer factorization. The fastest known algorithms…

  • How to factor 21 with a quantum computer

    In 1994, Peter Shor discovered an efficient quantum algorithm for integer factorization. Unfortunately, we lack…

    1 Comment
  • What you need to know about quantum computing

    The first thing you need to know about quantum computers is that they are not actually computers. It would be more…

    1 Comment
  • Probability vs quantum computing

    I would like share an analogy that helped me to wrap my head around quantum computing. This is all very hand-wavy, and…

    1 Comment
  • Code translation with ChatGPT

    I wanted to explore the ability of ChatGPT to translate computer code from one language to another. (Or more…

    3 Comments
  • Information theory and Wordle

    If you know how to play Wordle then you can skip this paragraph. For everyone else, Wordle is a guessing game with…

  • What can you do with a quantum computer?

    What are the most promising applications of quantum computing in the next 5-10 years? In my opinion, a task is likely…

    3 Comments
  • Solving Sudoku puzzles on a quantum computer

    In this article, I will describe my experiments with using a D-Wave 2000Q quantum computer to solve Sudoku puzzles. I…

    5 Comments
  • Why subtraction is commutative

    When you add two numbers together, it does not matter which order you add them. You will get the same result either way.

    4 Comments
  • Equilateral triangles and complex numbers

    Did you know that complex numbers can be used to solve problems in plane geometry? Here is my favorite example: the…

Others also viewed

Explore content categories