Find the real value(s) solution of the equation $3^x = 3(x+6)$ I tried using Lambert W function but I got stuck while trying to set the question in the form $xe^x =y$.
 A: $\require{begingroup} \begingroup$
$\def\e{\mathrm{e}}\def\W{\operatorname{W}}\def\Wp{\operatorname{W_0}}\def\Wm{\operatorname{W_{-1}}}$
Consider 
\begin{align} 
3^x &= 3(x+6)
\tag{1}\label{1}
\end{align}
as a special case of
\begin{align}
a^x&=b\,x+c
,\quad  a=3,b=3,c=18
\tag{2}\label{2}
\end{align} 
and transform it as follows:
\begin{align}
\exp(\ln(a)\,x)&=b\,x+c
,\\
\exp(\tfrac 1b\,\ln(a)\,(b\,x))&=b\,x+c;
,\\
\exp(\tfrac 1b\,\ln(a)\,(b\,x+c-c))&=b\,x+c;
,\\
\exp(\tfrac 1b\,\ln(a)\,(b\,x+c))
\,\exp(-\tfrac cb\,\ln(a))&=b\,x+c;
,\\
\exp(-\tfrac cb\,\ln(a))&=(b\,x+c)\,\exp(-\tfrac 1b\,\ln(a)\,(b\,x+c))
,\\
a^{-c/b}&=(b\,x+c)\,\exp(-\tfrac 1b\,\ln(a)\,(b\,x+c))
,\\
-\tfrac 1b\,\ln(a)\,a^{-c/b}
&=
-\tfrac 1b\,\ln(a)\,(b\,x+c)\,\exp(-\tfrac 1b\,\ln(a)\,(b\,x+c))
.
\end{align}
At this point we have the right-hand side in a proper form $y\e^y$ 
and can apply the Lambert $\W$ function:
\begin{align}
\W\Big(-\tfrac 1b\,\ln(a)\,a^{-c/b}\Big)
&=
\W\Big(-\tfrac 1b\,\ln(a)\,(b\,x+c)\,\exp(-\tfrac 1b\,\ln(a)\,(b\,x+c))\Big)
,\\
-\tfrac 1b\,\ln(a)\,(b\,x+c)
&=
\W\Big(-\tfrac 1b\,\ln(a)\,a^{-c/b}\Big)
,\\
x&=-\frac 1{\ln(a)}\,\W(-\tfrac 1b\,\ln(a)\,a^{-c/b})-\frac cb
.
\end{align}
Substitution of the values from \eqref{2} gives
\begin{align}
x&=-\frac 1{\ln 3}\,\W(-\tfrac 1{2187}\ln 3)-6
.
\end{align}
The argument of $\W$ is
\begin{align}
-\tfrac 1{2187}\ln 3
&\approx -0.0005
\end{align}
fits inside the interval $(-\tfrac1\e,0)$, where the Lambert $\W$ function has two real
branches, $\Wp$ and $\Wm$, so we must have two real solutions to \eqref{1}:
\begin{align}
x_0&=-\frac 1{\ln 3}\,\Wp(-\tfrac 1{2187}\ln 3)-6
\approx -0.5025901139
,\\
x_1&=-\frac 1{\ln 3}\,\Wm(-\tfrac 1{2187}\ln 3)-6
=3.
\end{align}
In the second case the value of $x_1=3$ is exact integer, since the argument of $\W$
can also be represented in a form $y\,\e^y$:
\begin{align}
-\tfrac 1{2187}\ln 3
&=
-\tfrac 1{3^7}\ln 3
=
-\tfrac 9{3^9}\ln 3
=
\tfrac 1{3^9}\,\ln(\tfrac 1{3^9})
\\
&=
\ln(\tfrac 1{3^9})\,\exp\Big(\ln(\tfrac 1{3^9})\Big)
=
-9\,\ln3\,\exp(-9\,\ln3)
.
\end{align}
The numeric value 
\begin{align}
-9\,\ln3&\approx -9.88751
\end{align}
is less than $-1$, and belongs to the range of $\Wm$,
so in this case we have
\begin{align}
x_1&
=-\frac 1{\ln 3}\,\Wm(-9\,\ln3\,\exp(-9\,\ln3))-6
=-\frac 1{\ln 3}\,(-9\,\ln3)-6
=3.
\end{align}
$\endgroup$
A: To solve using generalised logarithm and Lambert-$W$ function, check the image in
https://drive.google.com/file/d/1tw9wiR-q79IVCAQ7fKuXhHQrRtEzwuiD/view?usp=drivesdk
A: Set $y=x+6$. Then we have
$$3^{-6}3^{x+6}= 3(x+6)$$
$$\frac1{729}3^y=3y$$
and you should be able to get to the $ze^z=y$ form now.
A: By inspection, $x=3$ is a solution.
As you have the intersection between an exponential, a convex function, and a straight line, and $x=3$ is not a double root, there must be another root.
Noting that
$$3^{-6}\approx3(-6+6)=0$$ we can start Newton iterations and get
$$6,\\-5.9995425228212,\\-5.9995425227634,\\-5.9995425227634,\\\cdots$$
A: Since you have the answers to your question, let us make the problem more funny searching the solution of
$$3^x=3x+a$$ without Lambert function.
Consider that you look for the zero's of function
$$f(x)=3^x-3x-a$$ the derivatives of which being
$$f'(x)=3^x \log (3)-3\qquad \text{and} \qquad f''(x)=3^x \log ^2(3)\quad > 0\quad \forall x$$
The first derivative cancels at
$$x_{m}=\frac{1}{\log (3)}\log \left(\frac{3}{\log (3)}\right)$$ and $$f(x_{m})=-a+\frac{3 }{\log (3)}\log \left(\frac{e\log (3)}{3}\right)$$ and there will be two solutions if $f(x_{m})<0$ that is to say
$a >- 0.0125$. So, for any positive value of $a$, we shall have two roots such that $x_1< x_{m}$ and $x_2 > x_{m}$.
Planning to use Newton method, we need starting guesses. We can obtain them expanding $f(x)$ as a Taylor series built at $x=x_{m}$ and solving the simple quadratic equation in $(x- x_{m})$ get the estimates
$$x_1^{(0)}=x_{m}-\sqrt{-2 \frac{f(x_{m})}{f''(x_{m})}}\qquad \text{and} \qquad x_2^{(0)}=x_{m}+\sqrt{-2 \frac{f(x_{m})}{f''(x_{m})}}$$ Applied to your case where $a=18$, this would give $x_1^{(0)}=-2.39$ and $x_2^{(0)}=4.22$. This is not fantastic but sufficient. For you case, starting with these crude estimates, the iterates will be
$$\left(
\begin{array}{cc}
n & x_n \\
 0 & -2.39173 \\
 1 & -6.07333 \\
 2 & -5.99954
\end{array}
\right)$$
$$\left(
\begin{array}{cc}
n & x_n \\
 0 & 4.22051 \\
 1 & 3.56331 \\
 2 & 3.15154 \\
 3 & 3.01306 \\
 4 & 3.00010 \\
 5 & 3.00000
\end{array}
\right)$$
All of that can very easily done with Excel or even a pocket calculator. Just for the fun of it, try any other value of $a$.
