Calculus · Differential equations
A differential equation tells you how something changes, and asks you to figure out what it is. This post walks through the main types of first-order equations, how to recognise each one, and the trick that solves it, with worked examples throughout.
Suppose you know the slope of a curve at every point, but not the curve itself. Writing that down gives a first-order differential equation. If it is solved for the derivative, it has the form
\[ y' = f(x, y), \tag{1} \]where \(y = y(x)\) is the unknown function. You can picture the equation as a slope field: at each point \((x, y)\) of the plane draw a tiny segment of slope \(f(x, y)\). A solution is a curve that follows those segments everywhere.
Why is there one constant? Because solving a first-order equation is "integrating once", and every integration brings in one constant. Geometrically, the general solution is a one-parameter family of curves, one for each \(c\).
Usually we don't want the whole family, but the one curve passing through a given point. Finding the solution of (1) that satisfies the initial condition
\[ y = y_0 \quad \text{for} \quad x = x_0 \tag{2} \]is called the Cauchy problem (initial value problem). If the equation is not defined at \((x_0, y_0)\) itself, but only near it, or if the initial values are infinite, we talk about a singular Cauchy problem: then we ask for a solution with \( y(x) \to y_0 \) as \( x \to x_0 \) (or \( x(y) \to x_0 \) as \( y \to y_0 \)).
Two classical theorems tell us when the Cauchy problem can be solved. Let \(R\) be the rectangle
\[ R:\ |x - x_0| < a, \quad |y - y_0| < b. \]Where does \( h = \min(a, b/M) \) come from? The slope of the solution never exceeds \(M\) in absolute value. Starting at \((x_0, y_0)\), the curve can therefore climb at most \(M\cdot|x - x_0|\), so it is guaranteed to stay inside the rectangle as long as \(M|x - x_0| < b\), that is, \(|x - x_0| < b/M\). It also cannot leave the rectangle sideways, which gives the bound \(a\).
This is the simplest type and the one every other method tries to reduce to. An equation of the form
\[ P(x)\,dx + Q(y)\,dy = 0 \]is called separable: everything with \(x\) is on one side, everything with \(y\) on the other. Integrate both:
\[ \int P(x)\,dx + \int Q(y)\,dy = c. \]An equation \( y' = g(x)h(y) \) is separable too: write \( \frac{dy}{h(y)} = g(x)\,dx \).
An equation of the form
\[ y' = f\Big(\frac{y}{x}\Big), \quad \text{or equivalently} \quad M(x, y)\,dx + N(x, y)\,dy = 0 \]with \(M\) and \(N\) homogeneous functions of the same degree, is called homogeneous. The slope depends only on the ratio \(y/x\), so it is the same along every ray through the origin.
The trick: substitute \( y = ux \), where \(u\) is a new unknown function. Then \( y' = u + xu' \), and the equation becomes \( u + xu' = f(u) \), which is separable:
\[ \int \frac{du}{f(u) - u} = \ln|x| + c. \]An equation of the form
\[ y' = f\left(\frac{a_1x + b_1y + c_1}{ax + by + c}\right) \]is not homogeneous because of the constants \(c, c_1\). The fix is geometric:
Some equations become homogeneous after the substitution \( y = z^m \). The number \(m\) is not known in advance: substitute, then choose \(m\) so that all terms have the same total degree in \(x\) and \(z\) (the derivative \(z'\) counts as degree 0, since \(z'\) behaves like \(z/x\)).
An equation of the form
\[ y' + p(x)\,y = q(x) \]is called linear (linear in \(y\) and \(y'\), the coefficients can be any functions of \(x\)). Its general solution is
\[ y = e^{-\int p(x)\,dx}\left(c + \int q(x)\,e^{\int p(x)\,dx}\,dx\right). \]Where does the formula come from? Multiply the equation by \( \mu(x) = e^{\int p\,dx} \). Since \( \mu' = p\mu \), the left side becomes a perfect derivative:
\[ (\mu y)' = \mu q \quad\Longrightarrow\quad \mu y = \int \mu q\,dx + c. \]You don't need to memorise the formula if you remember this step. In many courses the same result is reached with the substitution \( y = uv \): choose \(v\) so that the terms with \(u\) cancel (\(v' + pv = 0\)), then find \(u\) from \(u'v = q\).
For \(\alpha = 0\) or \(1\) it is already linear. Otherwise, divide by \(y^\alpha\) and substitute \( z = y^{1-\alpha} \); the equation becomes linear in \(z\):
\[ \frac{1}{1-\alpha}\,z' + p(x)\,z = q(x). \](It can also be solved directly with \( y = uv \).)
In general, Riccati's equation cannot be solved by elementary integration. But if you know (or can guess) one particular solution \(y_1\), the substitution
\[ y = y_1 + \frac{1}{z} \]turns it into a linear equation for \(z\).
Recall from multivariable calculus: the total differential of \(F(x, y)\) is \( dF = F_x\,dx + F_y\,dy \). If an equation
\[ P(x, y)\,dx + Q(x, y)\,dy = 0 \]happens to be \(dF = 0\) for some \(F\), then its solutions are simply the level curves \(F(x, y) = C\). Such an equation is called exact (an equation of the total differential), and the test is
\[ \frac{\partial P}{\partial y} = \frac{\partial Q}{\partial x}. \]The general integral can be found from
\[ \int P(x, y)\,dx + \int\left[Q(x, y) - \frac{\partial}{\partial y}\int P(x, y)\,dx\right]dy = C, \]or, if \(P\) and \(Q\) are defined at a point \((x_0, y_0)\), from the line-integral form
\[ \int_{x_0}^{x} P(x, y)\,dx + \int_{y_0}^{y} Q(x_0, y)\,dy = C. \]In practice it's easiest to proceed step by step: integrate \(P\) with respect to \(x\) (adding an unknown \(g(y)\) instead of a constant), then differentiate with respect to \(y\) and compare with \(Q\) to find \(g\).
\( F = \int (2xy + 3)\,dx = x^2y + 3x + g(y) \). Then \( F_y = x^2 + g'(y) = x^2 + 4y \), so \( g(y) = 2y^2 \). The general integral is
\[ x^2y + 3x + 2y^2 = C. \]Most equations are not exact, but some become exact after multiplying by a suitable function \(\mu(x, y)\), an integrating factor. The condition \( \frac{\partial(\mu P)}{\partial y} = \frac{\partial(\mu Q)}{\partial x} \) expands to
\[ P\frac{\partial\mu}{\partial y} - Q\frac{\partial\mu}{\partial x} = \mu\left(Q_x' - P_y'\right). \]This is a partial differential equation, generally harder than the original problem. It becomes easy when \(\mu\) depends on only one variable:
Sometimes the equation comes in the general form \( F(x, y, y') = 0 \), and solving for \(y'\) is impossible or ugly. The key idea in this section: treat \(y' = p\) as a parameter and describe the solution curves parametrically.
If from \( f(x, y') = 0 \) we can express \( x = \varphi(p) \), where \(p = y'\), then \( dx = \varphi'(p)\,dp \), and since \( dy = p\,dx \),
\[ x = \varphi(p), \qquad y + c = \int p\,\varphi'(p)\,dp. \]This is the solution in parametric form. The equation \(f(y, y') = 0\) is handled the same way, using \( dx = \frac{dy}{p} \).
For the general equation \(F(x, y, y') = 0\), it often helps to solve it for \(y\) first. When this gives \( y = \varphi(y')\,x + \psi(y') \), linear in \(x\), the equation can always be integrated. Two cases matter:
Its general solution is obtained by simply replacing \(y'\) with \(c\):
\[ y = cx + \psi(c), \]a family of straight lines. In addition, the equation can have a singular integral, obtained by eliminating \(p\) from
\[ y = px + \psi(p) \qquad \text{and} \qquad x + \psi'(p) = 0. \]Put \(y' = p\), differentiate with respect to \(x\), and treat \(x\) as a function of \(p\). Since \(dy = p\,dx\), you get a linear equation for \(x(p)\):
\[ \big[\varphi(p) - p\big]\frac{dx}{dp} + x\,\varphi'(p) + \psi'(p) = 0. \]Solve it for \(x(p)\), then \(y\) follows from the original equation. Additionally, the equation may have singular solutions of the form \( y = \varphi(c)\,x + \psi(c) \), where \(c\) is a root of \( c = \varphi(c) \) (these straight lines are lost when dividing by \(\varphi(p) - p\)).
Suppose \(F(x, y, y')\) and its partial derivatives \(\frac{\partial F}{\partial y}\), \(\frac{\partial F}{\partial y'}\) are continuous. Then every singular solution of
\[ F(x, y, y') = 0 \tag{6} \]also satisfies
\[ \frac{\partial F(x, y, y')}{\partial y'} = 0. \tag{7} \]So, to find candidates, eliminate \(y'\) from (6) and (7). The resulting curve \(\psi(x, y) = 0\) is the discriminant curve.
An envelope of a family of curves is a curve that touches every member of the family. If the general solution \( \Phi(x, y, c) = 0 \) has an envelope \(y = \varphi(x)\), that envelope is a singular solution: at each of its points the envelope and a family member share the same point and the same slope, so two different solutions pass through it and uniqueness fails.
If \(\Phi\) has continuous first derivatives, the envelope is found by eliminating \(c\) from
\[ \Phi(x, y, c) = 0 \qquad \text{and} \qquad \frac{\partial \Phi(x, y, c)}{\partial c} = 0, \]after which you must check that the obtained curve really is an envelope (again, it could instead be a locus of singular points of the curves).
p-discriminant: \(F = p^2 - 4y\), \(F_p = 2p = 0\), so \(p = 0\) and \(y = 0\). It is a solution (\(0 = 0\)).
General solution: \( y' = \pm 2\sqrt{y} \Rightarrow \sqrt{y} = \pm(x - c) \Rightarrow y = (x - c)^2 \), a family of parabolas.
c-discriminant: \( \Phi = (x - c)^2 - y \), \( \Phi_c = -2(x - c) = 0 \Rightarrow c = x \Rightarrow y = 0 \).
Each parabola \(y = (x - c)^2\) touches the \(x\)-axis at \((c, 0)\). So \(y = 0\) is the envelope, and through every one of its points two solutions pass: \(y = 0\) itself and a parabola. Hence \(y = 0\) is a singular solution.
Here is a lovely geometric application. Given a family of curves \(f(x, y, a) = 0\), an isogonal trajectory is a curve that crosses every member of the family at the same angle \(\alpha\). When \(\alpha = \frac{\pi}{2}\), the trajectories are called orthogonal. Think of field lines crossing equipotential curves, or the lines of steepest descent crossing the contour lines on a map.
The slope of the family curve through \((x, y)\) is \( k = -\frac{f_x}{f_y} \). If the trajectory has slope \(y'\), the angle between them satisfies \( \operatorname{tg}\alpha = \frac{y' - k}{1 + ky'} \). Substituting \(k\), the differential equation of the trajectories is obtained by eliminating \(a\) from
\[ f(x, y, a) = 0 \qquad \text{and} \qquad \operatorname{tg}\alpha = \frac{\dfrac{\partial f}{\partial y}\,y' + \dfrac{\partial f}{\partial x}}{\dfrac{\partial f}{\partial y} - \dfrac{\partial f}{\partial x}\,y'}. \]Solving first-order equations is mostly about recognition. Run through this list:
| Type | Form | Method |
|---|---|---|
| Separable | \(P(x)\,dx + Q(y)\,dy = 0\) | integrate each side |
| Homogeneous | \(y' = f(y/x)\) | \(y = ux\) |
| Linear fractional | \(y' = f\big(\frac{a_1x+b_1y+c_1}{ax+by+c}\big)\) | shift origin, or \(z = ax + by\) |
| Linear | \(y' + p(x)y = q(x)\) | \(\mu = e^{\int p\,dx}\) or \(y = uv\) |
| Bernoulli | \(y' + py = qy^\alpha\) | \(z = y^{1-\alpha}\) |
| Riccati | \(y' + py^2 + qy = r\) | \(y = y_1 + 1/z\) |
| Exact | \(P\,dx + Q\,dy = 0,\ P_y = Q_x\) | find \(F\), answer \(F = C\) |
| Clairaut | \(y = xy' + \psi(y')\) | \(y = cx + \psi(c)\) + singular |
| Lagrange | \(y = x\varphi(y') + \psi(y')\) | linear equation for \(x(p)\) |
Identify the type first, then solve. Solutions are hidden. More solved problems from this topic are in First-Order Differential Equations.
Separable: \( \frac{dy}{1+y^2} = \frac{dx}{1+x^2} \Rightarrow \arctan y = \arctan x + c \). Taking tangents: \( y = \dfrac{x + C}{1 - Cx} \).
Homogeneous: \( y' = u + \sqrt{1 + u^2} \). With \(y = ux\): \( xu' = \sqrt{1+u^2} \Rightarrow \ln\big(u + \sqrt{1+u^2}\big) = \ln x + c \Rightarrow u + \sqrt{1+u^2} = Cx \). Solving for \(u\): \( y = \dfrac{Cx^2}{2} - \dfrac{1}{2C} \), a family of parabolas.
Linear, \( \mu = e^{-x^2} \): \( (ye^{-x^2})' = xe^{-x^2} \Rightarrow ye^{-x^2} = -\frac12e^{-x^2} + c \Rightarrow y = Ce^{x^2} - \frac12 \).
Bernoulli with \(\alpha = 2\), \(z = y^{-1}\): \( z' - z = -e^x \). With \(\mu = e^{-x}\): \( (ze^{-x})' = -1 \Rightarrow z = (c - x)e^x \). So \( y = \dfrac{e^{-x}}{c - x} \) (and \(y = 0\)).
\( P_y = \cos x = Q_x \): exact. \( F = x^3 + y\sin x + g(y) \), \( F_y = \sin x + g'(y) = \sin x - 4y^3 \Rightarrow g = -y^4 \). Answer: \( x^3 + y\sin x - y^4 = C \).
Clairaut with \(\psi(p) = \frac1p\). General solution: \( y = cx + \frac1c \). Singular: \( x - \frac{1}{p^2} = 0 \Rightarrow p = \pm\frac{1}{\sqrt x} \), and \( y = px + \frac1p = \pm 2\sqrt{x} \), i.e. \( y^2 = 4x \), the envelope of the family of lines.
Differentiate: \( 2x + 2yy' = 2a \), with \( 2a = \frac{x^2 + y^2}{x} \): \( y' = \frac{y^2 - x^2}{2xy} \). Replace \(y'\) by \(-\frac{1}{y'}\): \( y' = \frac{2xy}{x^2 - y^2} \), a homogeneous equation. Its solution is \( x^2 + y^2 = 2by \): circles tangent to the \(x\)-axis at the origin.
All the methods here share one strategy: transform the equation into one you can already solve. Homogeneous equations become separable; Bernoulli and Riccati equations become linear; multiplying by an integrating factor makes an equation exact; Lagrange's equation turns into a linear one for \(x(p)\). When you meet a new equation, the question to ask isn't "what's the formula?" but "which substitution brings it back to familiar ground?"
Next in the series: higher-order equations, reducing the order, and linear equations with constant coefficients.