LaTeX Tutorials

Mastering Differential Equations in LaTeX: A Complete Guide

18 min read

Introduction

Mastering differential equations in LaTeX is essential for mathematical typesetting in calculus, physics, engineering, and applied mathematics. Differential equations are fundamental tools for modeling dynamic systems, from simple growth models to complex physical phenomena.

This complete guide covers everything you need to know about typesetting differential equations in LaTeX, from basic ordinary differential equations (ODEs) to complex partial differential equations (PDEs) and systems of equations. Whether you're working on academic papers, research documents, or educational materials, mastering differential equation notation in LaTeX will help you create clear, professional mathematical documents.

Basic Ordinary Differential Equations (ODEs)

Ordinary differential equations involve derivatives of a function with respect to a single variable. The most common notation uses \frac{dy}{dx} for the first derivative.

First-Order ODEs

A first-order ordinary differential equation involves only the first derivative:

Here's a concrete example:

Second-Order ODEs

Second-order differential equations involve the second derivative:

A classic example is the harmonic oscillator:

Higher-Order ODEs

For higher-order derivatives, use superscript notation:

Partial Differential Equations (PDEs)

Partial differential equations involve partial derivatives with respect to multiple variables. Use \partial for partial derivatives instead of d.

Basic PDE Notation

The general form of a PDE:

Common PDEs

Heat Equation

Wave Equation

Laplace's Equation

Schrödinger Equation

Initial Conditions and Boundary Conditions

Differential equations are often accompanied by initial conditions or boundary conditions. Use \quad or \qquad for spacing between conditions.

Initial Conditions

Initial conditions specify values at a particular point:

Boundary Conditions

Boundary conditions specify values at the boundaries:

For Neumann boundary conditions (specifying derivatives):

Systems of Differential Equations

Systems of differential equations involve multiple dependent variables. Use the cases environment for systems.

System of First-Order ODEs

Linear System

A linear system of differential equations:

Matrix Form

Systems can also be written in matrix form:

Expanded matrix form:

Special Notation and Operators

Differential equations often use special operators and notation:

Differential Operator

Laplacian Operator

The Laplacian operator in Cartesian coordinates:

Gradient Operator

Display Mode vs Inline Mode

For standalone equations, use display mode (centered, larger). For equations within text, use inline mode.

Display Mode

Use \[ and \] or $$:

Inline Mode

Use $ or \( and \):

The equation $ \frac{dy}{dx} = f(x, y) $ is a first-order ODE.

Practical Examples

Here are some real-world examples of differential equations:

Exponential Growth/Decay

Logistic Growth

Damped Harmonic Oscillator

Forced Oscillator

Diffusion Equation

Burgers' Equation

Best Practices

Consistent Notation

Use consistent variable names and notation throughout your document. For example, if you use t for time in one equation, use it consistently throughout.

Proper Spacing

Use \quad or \qquad for spacing between equations and conditions:

y(0) = y_0, \quad \frac{dy}{dx}\Big|_{x=0} = y_0'

Alignment for Multiple Equations

Use align or aligned environments for multiple related equations:

\begin{align} \frac{dx}{dt} &= f(x, y) \\ \frac{dy}{dt} &= g(x, y) \end{align}

Equation Numbering

Number important equations using \tag or automatic numbering:

\frac{d^2y}{dx^2} + p(x)\frac{dy}{dx} + q(x)y = 0 \tag{1}

Vector Notation

Use \mathbf or \boldsymbol for vector quantities:

\frac{d\mathbf{x}}{dt} = A\mathbf{x} + \mathbf{b}

Common Mistakes to Avoid

  • Mixing d and \partial: Use \frac{d}{dx} for ordinary derivatives and \frac{\partial}{\partial x} for partial derivatives.
  • Incorrect spacing: Don't forget spaces around operators and between terms. Use \quad or \qquad for spacing.
  • Wrong bracket sizes: Use \left and \right for automatically sized brackets.
  • Inconsistent formatting: Keep the same style for similar equations throughout your document.
  • Missing conditions: Always include initial or boundary conditions when they're part of the problem.

Related Topics