LatexNotes

Lesson 7 of 12

Functions and derivatives

Upright function names, your own names, and every common way to write a derivative. About ten minutes.

Function names such as sin and log are printed upright, so they never read as letters multiplied together. This lesson covers the names LaTeX knows, how to make your own, and every common way to write a derivative.

Function names

In maths mode, sin x gives sinxsin x: three italic variables times x. The command \sin x gives sin⁡x\sin x, upright and correctly spaced. Compare them:

sinx+sin⁡xsin x + \sin x

LaTeX knows the usual names:

  • Trigonometry: \sin, \cos, \tan, \sec, \csc, \cot, and \arcsin, \arccos, \arctan.
  • Hyperbolic: \sinh, \cosh, \tanh.
  • Logs and exponentials: \log, \ln, \exp.
  • Others: \lim, \max, \min, \sup, \inf, \det, \gcd.

Powers, bases and brackets

A power on a function name goes straight after it: \sin^2 x gives sin⁡2x\sin^2 x. A base goes in a subscript: \log_2 x gives log⁡2x\log_2 x. Brackets are typed as usual: \ln(x + 1).

sin⁡2x+cos⁡2x=1\sin^2 x + \cos^2 x = 1

Names LaTeX does not know

For a function without a command, use \operatorname{...}: \operatorname{sgn}(x) gives sgn⁡(x)\operatorname{sgn}(x), upright and spaced like \sin.

rank⁡(A)=2\operatorname{rank}(A) = 2

Primes

An apostrophe gives a prime: f'(x) gives f′(x)f'(x) and f''(x) gives f′′(x)f''(x). For the nth derivative, put the order in brackets in a power: f^{(n)}(x) gives f(n)(x)f^{(n)}(x).

Leibniz notation

A derivative written as a fraction is just \frac:

dydx=2x\frac{dy}{dx} = 2x

A second derivative puts the 2 on the d at the top and on the x at the bottom: \frac{d^2 y}{dx^2} gives d2ydx2\frac{d^2 y}{dx^2}. Some books print the d upright: \frac{\mathrm{d}y}{\mathrm{d}x}. Either is fine; use one style throughout.

Partial derivatives

\partial gives ∂\partial:

∂f∂x+∂f∂y\frac{\partial f}{\partial x} + \frac{\partial f}{\partial y}

\nabla gives ∇\nabla, for the gradient: \nabla f.

Dots for time derivatives

In mechanics a dot over a letter means its rate of change: \dot{x} gives x˙\dot{x}, and \ddot{x} gives x¨\ddot{x}.

Practise

  1. sin⁡2x+cos⁡2x=1\sin^2 x + \cos^2 x = 1

  2. ln⁡(ex)=x\ln(e^x) = x

  3. log⁡232=5\log_2 32 = 5

  4. f(n)(x)f^{(n)}(x)

  5. ddxsin⁡x=cos⁡x\frac{d}{dx} \sin x = \cos x

  6. d2ydx2+y=0\frac{d^2 y}{dx^2} + y = 0

  7. ∂2f∂x ∂y\frac{\partial^2 f}{\partial x \, \partial y}

  8. sgn⁡(x)\operatorname{sgn}(x)

  9. x¨=−ω2x\ddot{x} = -\omega^2 x

In short

  • Function names are commands: \sin x, never sin x. \operatorname{...} for any other name.
  • Primes are apostrophes; f^{(n)} for the nth derivative.
  • Leibniz notation is \frac{dy}{dx}; \partial and \nabla for partial derivatives and gradients; \dot{x} and \ddot{x} for time derivatives.

Next, in lesson 8: bold vectors, number sets and maths fonts.

Would you rather write it by hand?

LatexNotes turns a photo or PDF of your handwritten maths into LaTeX like this. Free to try, no sign-up.

Convert your handwriting to LaTeX →