Logarithms are one command family with three names: \log, \ln, \lg. All three are upright operators with the spacing already correct; the base is a subscript and the argument is whatever follows — which is why brackets appear as soon as the argument is more than one token. The subscript rule is Sub & Sup again, and a change of base is an ordinary Fractions question.
Which one to use
\log_2 n\log_{10} n\ln x\log_e x\ln.\frac{\log_b x}{\log_b a}\log(x^2)The commands
\log_2 8
\log_{10} x
\log with an n attached. \ln e = 1
\lg for base ten; LaTeX has no \lg, so define it or spell the base out. \log_{10} 1000 = 3
\log_b x = y \iff b^{y} = x
\log_a b = \frac{\log_c b}{\log_c a}
\log(xy) = \log x + \log y
\ln\frac{a}{b} = \ln a - \ln b
\log(x^n) = n\log x
e^{\ln x} = x
Worked examples
Solving a logarithmic equation
\log_2(x+1) = 3 \iff x+1 = 2^{3} \iff x = 7
Chained equivalences on one displayed line; the argument keeps its parentheses throughout.
Sum of logs
\log_2 8 + \log_2 4 = \log_2 32 = 5
Same base throughout, which is the precondition for merging them.
Square of a log versus log of a square
\log^2 x \neq \log x^2
The left is (log x)², the right is log(x²). Position of the exponent carries the whole difference.
Order-of-magnitude statement
\log_{10}(6.02 \times 10^{23}) \approx 23.78
Scientific notation nests inside a log argument without extra syntax.
Common mistakes
\log_10 xwhen\log_{10} xwas meant: only the 1 lands under the operator and the 0 escapes.- Writing
lnorlogwithout the backslash, which sets them as italic products of variables. - Omitting brackets on a compound argument:
\log x + 1is log(x) + 1, not log(x + 1). - Assuming
\ln^2 xis self-explanatory. It is conventional but ambiguous next to\ln(x^2); spell out which you mean in prose.
Questions about this notation
What is the LaTeX command for natural log?
\ln. It takes the argument the same way \log does, so \ln 2 and \ln(x+1) are both valid, and there is no separate base subscript because the base is always e.Does \log need brackets around its argument?
\log x, \log 2 and \log n work bare; \log(x+1) or \log\frac{x}{y} needs delimiting, otherwise the addition falls outside the function.How do I write log base e minus one?
\log_{e-1} x braces the whole base. Without braces the subscript stops at the e and the rest prints at normal height, which reads as an entirely different expression.How do I write a logarithm whose base is an expression, or a squared logarithm?
\log_{a+b} x, \log_{10} x. A squared logarithm is \log^2 x, following the convention shared with trig functions, and it means (\log x)^2; write the parentheses out if your readers may take it as \log(x^2). \ln is built in and means base e.Keep reading
Three ways into the same idea: the notation itself, the lesson that teaches it, and an article that applies it.