I tried to solve the problem of $x + 3^x = 4$. I know that we can find it that $x = 1$ intuitively. I just want to know how to solve it using mathematic formula.
I have learned a little bit about Lambert W function. I've tried to rewrite the formula to become: \begin{align} 1 &= (4-x) \, e ^{-x \ln(3)} \\ 1 &= 4 \, e ^{-x \ln(3)} - x \, e ^{-x \ln(3)} \\ 1 &- 4 \, e ^{-x \ln(3)} = -x \, e ^{-x \ln(3)} \\ \ln(3) & - 4 \, \ln(3) \, e ^{-x \ln(3)} = -x \ln(3) \, e ^{-x \, \ln(3)} \end{align}
Until that last part, I got confused how to combine the $x$ variables at both sides. That's why I got stuck. Any idea how to combine it? Or is there any part of my solution need to be corrected? Thank you.
By the methods started by the proposer one can show that the equation in question is part of a more general set given by $x + a^{x} = b$ which has the soltion $$x = b - \frac{W_{0}(a^{b} \, \ln(a))}{\ln(a)}.$$
The proof of which can be seen by use of $a^{x} = e^{x \, \ln(a)}$ and $x \, e^{x} = t$ has the solution $t = W(x)$, where $W(z)$ is the Lambert W-function, where $W_{0}(x)$ is defined as th ereal solution for $x \geq -1/e$, and is: \begin{align} x + a^{x} &= b \\ (x - b) &= - a^x = - e^{(x-b) \, \ln(a) + b \, \ln(a)} \\ -(x - b) \, \ln(a) \, e^{- (x-b) \, \ln(a)} &= a^{b} \, \ln(a) \\ - (x-b) \, \ln(a) &= W_{0}(a^{b} \, \ln(a)) \\ x &= b - \frac{W_{0}(a^{b} \, \ln(a))}{\ln(a)}. \end{align}
For this particular problem one can use the property $W(x \, \ln(x)) = \ln(x)$ in such a way that $W(3^{4} \, \ln(3)) = W(27 \, \ln(27)) = \ln(27) = 3 \, \ln(3)$. For the equation $x + 3^{x} = 4$, which from the general solution is $a=3$ and $b=4$ yields \begin{align} x &= 4 - \frac{W_{0}(81 \, \ln(3))}{\ln(3)} \\ &= 4 - \frac{3 \, \ln(3)}{\ln(3)} \\ &= 1. \end{align}