# Plotting $\frac{1}{\ln x}$

I need assistance in plotting the graph of $\frac{1}{\ln x}$. wolframalpha gives this.

How to plot this function (both real and imaginary part) using calculus?

-

Using this software you should get following graph for $\frac{1}{\ln x}$ ,when $x>0$

-

I don't know what alpha is doing for negative values of $x$. Usually, we take $\log x$ to be undefined for $x\le0$ - certainly, this is what is generally done at the level of introductory Calculus classes. For $x\gt0$, $\log x$ is real, so the question of plotting the imaginary part does not arise - there is no imaginary part. To plot the "real part", imagine the graph of $y=\log x$ - every student should have a picture of this graph in her head - and take the reciprocal. So it approaches 0 through the negative numbers as $x$ approaches zero from the right; it has $x=1$ as an asymptote; it goes to zero as $x\to\infty$; and so on.

-

The results from WolframAlpha do make sense (EDIT: though admittedly they only consider a limited case, see the edit below). To start at the beginning:

You know that, for some $a$, we define a number $b = ln(a)$ to be the number which solves this equation:

$$e^b = a$$

For positive $a$, it's not too difficult to see that this makes sense, when $a = e$, $b = 1$; when $a = 6$, $b \approx 1.792$. Cool

But what about $a = -1$? There's no real number $b$ such that $e^b = -1$. However, if we suppose $b$ is complex, and in particular

$$b = x + yi$$

Then we can solve this equation. By Euler's formula:

$$e^{(x+yi)} = e^x \times e^y = e^x (\cos y + i \sin y)$$

So our problem now is to find x and y such that:

$$a = e^x (\cos y + i \sin y)$$

When $a$ is positive, this is easy. We set $y = 0$, and the problem reduces to solving $a = e^x$, which we can do in the positive case.

When $a$ is negative, what we can do is set $y = \pi$. In this case, $\sin \pi = 0$, but $\cos \pi = -1$, so we get the equation:

$$a = -e^x$$

which is solvable as a is negative.

Combining what we know about x and y, we get a formula for $ln(a)$ when a is negative:

$$ln(a) = x + y i = ln(-a) + \pi i$$

Then, for $1/ln(a)$, you just need to re-arrange the expression above:

$$\frac{1}{ln(a)} = \frac{1}{ln(-a)+\pi i} = \frac{ln(-a) - \pi}{ln(-a)^2+\pi^2} = \frac{ln(-a)}{ln(-a)^2+\pi^2} - \frac{\pi}{ln(-a)^2+\pi^2} i$$

I stress again, this only holds when a is negative. Plotting the real and imaginary parts of this expression in WolframAlpha gives the same curves as it originally plotted whenever a is negative (c.f. here and here). For positive a, it's just a normal, real, $ln(a)$ graph.

EDIT: While Wolfram's answer does indeed 'make sense', it was correctly brought up in the comments that there are many other solutions to this problem. When we let $y = \pi$, we found that $e^{x+y i}$ was a negative real number. However, we could just have easily let $y = 3 \pi$ or in general $y = (2k+1)\pi$ for any integer $k$. These values will all lead to legitimate curves, and in general we will have: $$\frac{1}{ln(a)}= \frac{ln(-a)}{ln(-a)^2+(2k+1)^2\pi^2} - \frac{(2k+1)\pi}{ln(-a)^2+(2k+1)^2\pi^2} i$$

Which will give different real and imaginary curves for different integer values of k.

To get a range of these curves, you could use any CAS or graphing software capable of plotting multiple functions on the same axes.

-
You have given one formula for $\log a$ when $a\lt0$, but of course there are many, all differing by multiples of $2\pi i$, and no one of them any better than any other. You got the one that alpha uses, but that just means that alpha is sweeping the problem under the rug. –  Gerry Myerson Oct 31 '11 at 11:33
Thanks, you're right of course. Probably a reason I shouldn't be doing this late at night :) I hope the edit doesn't introduce any new silly errors :) –  tom Oct 31 '11 at 12:10