All guides

Logarithms and exponentials in LaTeX

Updated:

The natural logarithm is \ln x, the common logarithm is \log x or \log_{10} x, and any other base goes in a subscript: \log_b x. A long exponent of e is easier to read when written with \exp and parentheses.

Logarithms

\ln e = 1, \quad \log_{2} 8 = 3
ln⁡e=1,log⁡28=3\ln e = 1, \quad \log_{2} 8 = 3

\ln and \log are operator names: set upright, with a thin space before the argument. The base is an ordinary subscript, so a base with more than one character needs braces, as in \log_{10}.

Copying this from handwritten notes? Snap a photo of the page and CamteX turns the formulas into LaTeX. Try it free

Change of base

\log_b x = \frac{\ln x}{\ln b}
log⁡bx=ln⁡xln⁡b\log_b x = \frac{\ln x}{\ln b}

The ratio of two natural logarithms is how you compute any base on a calculator, and \frac keeps both logarithms at a readable size.

Logarithm rules

\log_b (xy) = \log_b x + \log_b y
log⁡b(xy)=log⁡bx+log⁡by\log_b (xy) = \log_b x + \log_b y

Put the argument in brackets as soon as it has more than one factor. LaTeX would typeset \log_b xy without complaint, but a reader cannot tell where the argument ends.

Exponential function

e^{x}, \quad e^{-\lambda t}, \quad \mathrm{e}^{x}
ex,e−λt,exe^{x}, \quad e^{-\lambda t}, \quad \mathrm{e}^{x}

Braces around the exponent are needed once it has more than one character. Some style guides set the constant e upright as \mathrm{e}; choose one style for the whole document.

Radioactive decay

N(t) = N_0 \exp\left(-\frac{t \ln 2}{T_{1/2}}\right)
N(t)=N0exp⁡(−tln⁡2T1/2)N(t) = N_0 \exp\left(-\frac{t \ln 2}{T_{1/2}}\right)

A fraction in the exponent of e would shrink to a tiny size. \exp keeps the argument on the main line, and \left( \right) lets the brackets grow with the fraction.

Derivative of ln

\frac{d}{dx} \ln x = \frac{1}{x}
ddxln⁡x=1x\frac{d}{dx} \ln x = \frac{1}{x}

A line that appears in every set of calculus notes. \frac{d}{dx} works as an operator written directly in front of \ln.

Common mistakes

See also

Don't want to memorize commands?

Draw a formula or paste a screenshot, and CamteX turns it into ready LaTeX.

Try it free