# Solving equations with natural logarithms

#### dcbingaman

Joined Jun 30, 2021
798
Does anyone know how you go about solving the following equation for x:

ln(x)+k1*x=k2

where k1 and k2 are constants?

#### ericgibbs

Joined Jan 29, 2010
16,784
hi dc,
Take natural log of K's
E

#### Attachments

• 56.2 KB Views: 9

#### Papabravo

Joined Feb 24, 2006
19,575
I think you need to raise both sides to the power e. Then the obvious solution is that x = K2/K1 =1

#### dcbingaman

Joined Jun 30, 2021
798
ok:

ln(x)+k1*x=k2

Rewrite:
k2-k1*x=ln(x)

Raising both sides to e:
e^(k2-k1*x)=x

We got rid of the natural log, but it seems to me we just transferred the problem to the other side?

#### Ian0

Joined Aug 7, 2020
6,696
Get all the logarithms on one side of the equation:
$$\ln (x)= k_2-k_1 x$$
and take the exponent
$$x = e^{k_2-k_1 x}$$
 corrected the following. . .
$$x=\frac{e^{k_2}}{e^{k_1 x}}$$
$$e^{k_2}$$ is a constant, so call it K
$$x=\frac{K}{ e^{k_1 x}}$$
$$\frac{K}{x}=e^{k_1 x}$$
and I don't think it has an algebraic solution.

Last edited:

#### Papabravo

Joined Feb 24, 2006
19,575
Get all the logarithms on one side of the equation:
$$\ln (x)= k_2-k_1 x$$
and take the exponent
$$x = e^{k_2-k_1 x}$$
$$x=\frac{e^{k_2}}{e^{k_1 x}}$$
$$e^{k_2}$$ is a constant, so call it K
$$x=\frac{K}{ e^{k_1 x}}$$
and I don't think it has an algebraic solution.
x = K2/K1 =1 is an algebraic solution

#### MrChips

Joined Oct 2, 2009
27,679
I don't know how to do this algebraically.
I would do it graphically.

#### Ian0

Joined Aug 7, 2020
6,696
You dropped a minus sign
I know - I hit "Post Reply" instead of "Preview". I've edited it now, and I'll put "" when I've checked it.

#### Papabravo

Joined Feb 24, 2006
19,575
I know - I hit "Post Reply" instead of "Preview". I've edited it now, and I'll put "" when I've checked it.
I realized that as I was trying to show the correction

#### ericgibbs

Joined Jan 29, 2010
16,784
Hi dc,
This is what Microsoft Maths shows.
It cannot solve for x..

E

#### dcbingaman

Joined Jun 30, 2021
798
Thanks for everyone's input! So it appears the consensus is you cannot algebraically solve this for x:

e^(k2-k1*x)=x

x=e^k2/e^k1x

xe^k1x=e^k2

natural log of both sides, back where we started:

ln(x)+k1*x=k2

So I am going in circles, cannot isolate x.

#### MrSalts

Joined Apr 2, 2020
2,604
Does anyone know how you go about solving the following equation for x:

ln(x)+k1*x=k2

where k1 and k2 are constants?
What are the values of k1 and k2? If they are unknown constants, then they are variables. With three variables, you can get to any value.

#### dcbingaman

Joined Jun 30, 2021
798
x = K2/K1 =1 is an algebraic solution
What are the values of k1 and k2? If they are unknown constants, then they are variables.
They are unknown 'constants' where we are trying to solve for x. That is true.

#### dcbingaman

Joined Jun 30, 2021
798
x = K2/K1 =1 is an algebraic solution
k1=k2=k:

ln(x)+kx=k

ln(1)+k=k

ln(1)=0

Yep, that is a solution. Nice observation.

#### ZCochran98

Joined Jul 24, 2018
221
For a more general solution, this appears to be an instance where the Lambert W function is useful. The Lambert W function is a non-algebraic (or, rather, non-elementary) function defined as the solution to:
$xe^x = \beta \rightarrow x = W_\alpha(\beta)$
Here, $$\alpha$$ is some integer. For real numbers, we can set them to 0 or -1 (I'll explain what they mean eventually).
So, for this problem, we can solve it this way:
$\ln x+k_1x = k_2$
$xe^{k_1x} = e^{k_2}$
Let $$y\equiv k_1x$$
$ye^y=k_1e^{k_2}$
Using Lambert W, because this fits the form exactly, we get:
$y = W_\alpha\left(k_1e^{k_2}\right)\rightarrow x = \frac{1}{k_1}W_\alpha\left(k_1e^{k_2}\right)$

For all of these, $$\alpha$$ refers to a "branch" index of the function in the complex plane (as it splits off and has several discontinuities, and each separate section is a "branch."). For real numbers only, however, we have the -1 branch (corresponding to $$-e^{-1}\leq x < 0$$) and the 0 branch (the "principal branch," corresponding to $$x\geq 0$$). So the solution will vary, given whatever $$k_{1,2}$$ are.

There are a few ways to analyze the function, but generally, the series methods have a small radius of convergence, so it's usually just calculated numerically using something akin to a root-finding algorithm (like Newton or faster). For instance, Newton's method:
$x = W_0(\beta) \rightarrow x_{j+1} = x_j - \frac{x_je^{x_j}-\beta}{e^{x_j}+x_je^{x_j}}$

That's probably more information than necessary, but it's a way to solve it numerically, at least (assuming $$k_1e^{k_2}\geq 0$$).

Tl;dr: the general solution hurts, but there is a way to represent it non-algebraically.