Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have equations for two lines, one of which is linear and the other is logarithmic, ie:

$$y = m_1 x + c_1$$

$$y = m_2 \cdot \ln(x) + c_2$$

..and I need to find out where (if at all) these lines intersect. I realise that I need to solve:

$$ m_1 \cdot x + c_1 = m_2 \cdot \ln(x) + c_2$$

..for $x$, but apart from shuffling the constants around I'm not sure how to do this.

Is there a general solution to this problem?


share|cite|improve this question
up vote 2 down vote accepted

There is no algebraic solution. You can solve this numerically. As log changes so slowly, iterative methods converge quickly.

share|cite|improve this answer
Thanks for this. I put together a numeric solution which works fine. It's good to know I wasn't missing an easy way to do this algebraically. – Simon Andrews Mar 9 '11 at 11:00

The general solution involves the Lambert W function, whose defining equation is $z = W(z)e^{W(z)}$ for complex numbers $z$. If either $m_1$ or $m_2$ is zero in the given problem, then the solution is elementary, so suppose $m_1,m_2 \neq 0$. Then $$ m_1 x + c_1 = m_2 \ln x + c_2 $$ can be rewritten as $$ -\frac{m_1}{m_2}e^{(c_1-c_2)/m_2} = -\frac{m_1 x}{m_2} e^{-m_1 x / m_2}, $$ which has the solution $$ -\frac{m_1 x}{m_2} = W\left(-\frac{m_1}{m_2}e^{(c_1-c_2)/m_2}\right), $$ or $$ x = -\frac{m_2}{m_1} W\left(-\frac{m_1}{m_2}e^{(c_1-c_2)/m_2}\right). $$ For instance, if $m_1=1$, $m_2=-1$, and $c_1=c_2=0$, this gives $x=W(1)=\Omega=0.56714329...$ (the Omega constant), which is correct, since $\Omega = -\ln\Omega$.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.