How to solve $x + 3^{x} = 4$ using Lambert W Function.

As stated in the title I am trying to solve the equation $$x + 3^{x} = 4$$ using Lambert W Function and which led me to the result $$x = 4 - \frac{W(3^{4} \ln{3})}{\ln{3}}$$ and driven by the belief that Lambert W Function can't be solved, when I entered only the last term in RHS in WolframAlpha the value of $$\frac{W(3^{4} \ln3)}{\ln3}$$ turned out to be 3 which matches with the final result of $$x = 1$$ which can be easily deduced just by looking at the equation long enough. But wasn't able to calculate the value of above expression on my own and that's where I need help because I think if the above expression has exactly the value equalt to 3 there must be some way to solve it. Thus, I am interested to know the way to deduce the value of above term by solving the Lambert W Function.

Thanks for any help.

• The Lambert-W function can only be computed numerically. It solves the equation $ye^y=x$. If you want to solve such equations by hand (to be more precise , only with a table calculator) , use methods like bisection or newton's method. Commented Jun 22, 2023 at 9:34
• Hint: $$3^{x+3^x} = 3^{x}3^{3^x}=3^4$$ Commented Jun 22, 2023 at 11:15
• @Mostafa Do you mind writing out the full solution?
– user1003852
Commented Jun 22, 2023 at 11:18
• Well I will write solution Commented Jun 22, 2023 at 12:12
• Notice $x+3^x=1+3^1=4\implies x=1$ Commented Jun 22, 2023 at 13:29

Observe that ,

\begin{align}W\left(3^4\ln 3\right)&=W\left(3^3\cdot 3\ln 3\right)\\ &=W\left(3^3\ln 3^3\right)\\ &=W\left(\color{#c00}{\ln 3^3}\cdot e^{\color{#c00}{\ln 3^3}}\right)\\ &=\ln 3^3=3\ln 3\end{align}

Therefore, you obtain that :

\begin{align}x&=4-\frac{W\left(3^4\ln 3\right)}{\ln 3}\\ &=4-\frac {3\ln 3}{\ln 3}\\ &=4-3=1\thinspace .\end{align}

$$\rm{Construction :}$$

Substituting $$\thinspace 3^x=u\thinspace$$, you get $$\thinspace x=4-u\thinspace$$ or $$\thinspace x=\dfrac {\ln u}{\ln 3}\thinspace$$, which leads to the following :

\begin{align}x+3^{x}&=4\\ \frac{\ln u}{\ln 3}+u&=4\\ \ln u+u\ln 3&=4\ln 3\\ \ln \left(u\cdot e^{u\ln 3}\right)&=4\ln 3\\ u\ln 3\cdot e^{u\ln 3}&=e^{4\ln 3}\cdot \ln 3\\ u\ln 3&=W\left(3^4\ln 3\right)\end{align}

Then, the exact value becomes :

$$x=4-\frac{W\left(3^4\ln 3\right)}{\ln 3}\thinspace .$$

$$\newcommand{\W}{\mathfrak{W}}$$I'm not entirely sure what your question is. Say you want to solve: $$x+a^x=b$$Recall to use $$\W$$ we would like to have terms of the form $$xe^x$$. Rearrange to: $$\ln(a)\cdot a^b=\ln(a)(b-x)a^{b-x}$$It follows that: $$\W(\ln(a)\cdot a^b)=\ln(a)(b-x)$$So: $$x=b-\frac{1}{\ln a}\W(\ln(a)\cdot a^b)$$

Are you asking how to recognise that: $$\frac{\W(3^4\ln 3)}{\ln 3}=3$$? In which case, define $$a=\frac{1}{\ln 3}\W(3^4\ln 3)$$ and note: $$a\ln(3)\cdot e^{a\ln 3}=\W(3^4\ln 3)\cdot e^{\W(3^4\ln 3)}=3^4\ln 3$$So it follows that: $$a\cdot 3^a=3^4$$And from there you just have to solve by inspection that $$a=3$$. More generally we have the result: $$\frac{\W(x^{x+1}\ln x)}{\ln x}=x$$

• as you suggested that at the end I will have to solve the equation by inspection but isn't there any way to solve it formally. Maybe there is some way to solve this in the proof of the general result you gave. Commented Jun 22, 2023 at 10:15

$$x＋3^x＝4\implies3^{x＋3^x}＝3^4\implies3^x3^{3^x}＝3^4\\~\\\text{let :}y＝3^x\;\implies\;y3^y＝3^4\implies\;y＝W_3\left({3^4}\right)\implies3^x＝W_3\left({3^4}\right)\implies\;x＝\frac {\ln(W_3\left({3^4}\right))}{\ln(3)}$$ and therfore $$\implies\;x＝\log_3(3^4)-\frac {W(3^4\ln(3))}{\ln(3)}＝4-\frac {W(3^4\ln(3))}{\ln(3)}\\~\\$$ let t:=$$\frac {W(3^4\ln(3))}{\ln(3)}$$ $$\implies\;t\ln(3)＝W(3^4\ln(3))\implies\;e^{t\ln(3)}＝e^{W(3^4\ln(3))}\\~\\\implies\;t\ln(3)e^{t\ln(3)}＝W(3^4\ln(3))e^{W(3^4\ln(3))}＝3^4\ln(3)\\~\\\implies\;t\ln(3)e^{t\ln(3)}＝3^4\ln(3)\implies\;t＝3$$ Finally: $$x＝4-\frac{W(3^4\ln(3))}{\ln(3)}＝4-3＝1\implies\;x＝1$$

• Why is the equal sign so weird? A bug?
– user1003852
Commented Jun 23, 2023 at 3:13

Let $$y=4-x$$

$$3^{4-y}=y\Longrightarrow 3^4=y\cdot 3^y=y\cdot e^{y\ln3}\Longrightarrow 3^4\ln3=(y\ln3)\cdot e^{y\ln3}$$

Use Lambert W-function,

$$y\ln3=W(3^4\ln3)$$

Finally, go back to $$x$$

$$x=4-\frac{W(3^4\ln3)}{\ln3}$$