All guides

Derivative in LaTeX

Updated:

You can write a derivative with a prime, f'(x), or in Leibniz notation as a fraction of differentials. Partial derivatives use the \partial symbol.

Prime notation

f'(x) = 2x
f′(x)=2xf'(x) = 2x

A keyboard apostrophe turns into a prime in math mode. The second derivative is two apostrophes, f''(x), not a double quote.

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

Leibniz notation

\frac{dy}{dx}
dydx\frac{dy}{dx}

The ISO standard recommends an upright d: \frac{\mathrm{d}y}{\mathrm{d}x}. Many journals use italic d. Pick one and keep it throughout the document.

Second-order derivative

\frac{d^2 x}{dt^2} = -\omega^2 x
d2xdt2=−ω2x\frac{d^2 x}{dt^2} = -\omega^2 x

The 2 goes on the d in the numerator and on the t in the denominator. This is the harmonic oscillator equation: acceleration is proportional to displacement.

Partial derivative

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

\partial draws the curly d. Use it when a function depends on several variables and you differentiate with respect to one while holding the others fixed.

Time derivative

\dot{x} = v, \quad \ddot{x} = a
x˙=v,x¨=a\dot{x} = v, \quad \ddot{x} = a

A dot over a variable is a time derivative, common in mechanics. \dot gives one dot and \ddot two, which is the second derivative.

Derivative at a point

\left. \frac{df}{dx} \right|_{x=0}
dfdx∣x=0\left. \frac{df}{dx} \right|_{x=0}

A vertical bar with a subscript marks the value of the derivative at a point. \left. opens an invisible delimiter, and \right| draws the bar to the full height of the fraction.

Gradient

\nabla f = \left( \frac{\partial f}{\partial x}, \frac{\partial f}{\partial y} \right)
∇f=(∂f∂x,∂f∂y)\nabla f = \left( \frac{\partial f}{\partial x}, \frac{\partial f}{\partial y} \right)

\nabla is the nabla operator. Wrapping the vector of partial derivatives in \left and \right keeps it readable even with tall fractions.

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