How to Write Derivatives, Integrals, and Partial Derivatives in LaTeX
Calculus notation is central to virtually every STEM paper. LaTeX handles derivatives, integrals, and partial derivatives elegantly, but getting the spacing and formatting right requires some know-how. This guide covers everything from basic dy/dx notation to multiple integrals and mixed partials. Bibby AI's intelligent math autocomplete predicts differential operators as you type, saving significant time compared to Overleaf.
Derivatives and Differential Notation
Write ordinary derivatives using \frac{d}{dx} notation. For upright 'd' (ISO standard), use a custom command or the physics package:
\documentclass{article}
\usepackage{amsmath}
\begin{document}
% Basic derivative
\[
\frac{dy}{dx} = 2x
\]
% Second derivative
\[
\frac{d^2 y}{dx^2} = 2
\]
% Leibniz notation for evaluated derivative
\[
\left. \frac{dy}{dx} \right|_{x=1} = 2
\]
% Newton's dot notation (physics)
$\dot{x}$, $\ddot{x}$
% Prime notation
$f'(x)$, $f''(x)$, $f^{(n)}(x)$
\end{document}Integrals — Single, Double, and Triple
Use \int for single integrals, \iint and \iiint for multiple integrals. Control limits placement with \limits:
% Definite integral
\[
\int_0^\infty e^{-x^2} \, dx = \frac{\sqrt{\pi}}{2}
\]
% Double integral
\[
\iint_D f(x, y) \, dA
\]
% Triple integral
\[
\iiint_V \rho(x,y,z) \, dV
\]
% Contour integral
\[
\oint_C \mathbf{F} \cdot d\mathbf{r}
\]Partial Derivatives
Use \partial for partial derivative notation. For mixed partials, stack the operators in the numerator:
% First-order partial derivative
\[
\frac{\partial f}{\partial x}
\]
% Second-order partial derivative
\[
\frac{\partial^2 f}{\partial x^2}
\]
% Mixed partial derivatives
\[
\frac{\partial^2 f}{\partial x \, \partial y}
\]
% Gradient, divergence, Laplacian
\[
\nabla f, \quad \nabla \cdot \mathbf{F}, \quad \nabla^2 f
\]💡 Tips
- •Always add a thin space (\,) before dx, dy, etc. — it's standard typographic practice: \int f(x) \, dx.
- •For upright 'd' in differentials (ISO standard), define \newcommand{\dd}{\mathrm{d}} and use \dd x.
- •Use \limits on \int in display mode if limits appear beside instead of above/below the integral sign.
- •Bibby AI auto-inserts the \, spacing before differentials, a subtle but important detail that Overleaf doesn't handle.
Try This in Bibby AI
Write LaTeX faster with AI auto-complete and instant compilation.
Start Writing Free