How to Find a General Solution to the Differential Equation

A general solution to a differential equation is a family of functions that satisfies the equation for every possible value of one or more arbitrary constants. You find it by classifying the equation, applying the matching solution method, then adding those constants and verifying by substitution. For example, the first-order equation dy/dx = 2x has the general solution y = x² + C, where C is an arbitrary constant. The sections below walk through the process step by step, from identifying the type of equation to checking your answer.
Identify the Equation Type
Classification comes first because the structure of an equation determines which technique applies. A differential equation is any equation containing derivatives of an unknown function. The order is the highest derivative present: first-order equations contain only dy/dx (or y′), while second-order equations contain d²y/dx² (or y″).
The key distinctions to check:
- Linear vs. nonlinear — a linear equation has the unknown function and its derivatives appearing only to the first power, not multiplied together or inside functions like sin(y).
- Separable — a first-order equation is separable if it can be written as dy/dx = f(x)·g(y), so the x and y terms can be moved to opposite sides.
- Homogeneous — the term has two common meanings: a first-order equation where f(x, y) depends only on the ratio y/x, or a linear equation whose right-hand side equals zero.
- Constant coefficients — second-order linear equations like ay″ + by′ + cy = 0 have constant a, b, c and are solved with the characteristic equation.
According to Paul’s Online Math Notes, correctly identifying the type is the single most important step, because each class has a standard method. If you misclassify, the technique will not work no matter how carefully you compute.
Why Order Matters Most
Order usually narrows your options fastest. First-order equations are typically handled by separation of variables, integrating factors, or exactness. Second-order linear equations with constant coefficients are handled by the characteristic equation. MIT OpenCourseWare presents this same classification-first approach in its introductory differential equations course.
Solve First-Order Equations
Three standard methods cover most first-order problems, and each yields a general solution containing one arbitrary constant.
Separation of Variables
Use this when the equation is separable. Move all y terms to one side and all x terms to the other, then integrate both sides.
Worked example: Solve dy/dx = 2xy.
- Separate: (1/y) dy = 2x dx
- Integrate both sides: ln|y| = x² + C
- Solve for y: y = Ae^(x²), where A = ±e^C
The result y = Ae^(x²) is the general solution, with A an arbitrary constant.
Integrating Factors
For a linear first-order equation written as dy/dx + P(x)y = Q(x), multiply through by the integrating factor μ(x) = e^∫P(x)dx. This makes the left side collapse into the derivative of a product, so you can integrate directly.
The general solution form is:
y = (1/μ(x)) · ∫ μ(x)Q(x) dx + C/μ(x)
Exact Equations
An equation M(x, y)dx + N(x, y)dy = 0 is exact when ∂M/∂y = ∂N/∂x. If that condition holds, there exists a potential function F(x, y) with ∂F/∂x = M and ∂F/∂y = N. The general solution is F(x, y) = C. Khan Academy covers the intuition behind exactness in its differential equations unit.
| Method | Best Used When | General Solution Form |
|---|---|---|
| Separation of variables | dy/dx = f(x)g(y) | Implicit or explicit with one constant |
| Integrating factor | Linear: y′ + P(x)y = Q(x) | y = (1/μ)∫μQ dx + C/μ |
| Exact equations | ∂M/∂y = ∂N/∂x | F(x, y) = C |
Solve Second-Order Equations
For a linear second-order equation with constant coefficients, ay″ + by′ + cy = g(x), the general solution is the sum of two parts: the complementary solution y_c (from the homogeneous equation g(x) = 0) and a particular solution y_p (any single solution to the full equation). So y = y_c + y_p.
Finding the Complementary Solution
Solve the associated characteristic equation ar² + br + c = 0. The roots r determine y_c:
- Two distinct real roots r₁, r₂: y_c = C₁e^(r₁x) + C₂e^(r₂x)
- One repeated root r: y_c = (C₁ + C₂x)e^(rx)
- Complex roots α ± βi: y_c = e^(αx)(C₁cos βx + C₂sin βx)
Finding the Particular Solution
For common right-hand sides, use the method of undetermined coefficients — guess a form matching g(x), substitute it in, and solve for the coefficients. For a constant g(x) = k, try y_p = A; for g(x) = e^(mx), try y_p = Ae^(mx). If your guess duplicates a term in y_c, multiply it by x.
Example: Solve y″ − y = 2. The characteristic equation r² − 1 = 0 gives r = ±1, so y_c = C₁e^x + C₂e^(−x). Guessing y_p = A gives −A = 2, so A = −2. The general solution is y = C₁e^x + C₂e^(−x) − 2.
Notice there are exactly two arbitrary constants — matching the order of the equation.
Include Constants and Verify
A general solution must contain as many arbitrary constants as the order of the equation: one for first-order, two for second-order. Dropping a constant turns a general solution into a particular solution, which satisfies only one specific case.
Verify by Substitution
Differentiate your candidate solution the required number of times, substitute the results back into the original equation, and confirm both sides match. The arbitrary constants should cancel out — if they do not, your solution is wrong. This check catches sign errors, missed constants, and incorrect particular-solution guesses.
For the earlier example, y = C₁e^x + C₂e^(−x) − 2 gives y″ = C₁e^x + C₂e^(−x). Then y″ − y = (C₁e^x + C₂e^(−x)) − (C₁e^x + C₂e^(−x) − 2) = 2, which matches the original equation. Verification confirms the family is correct.
Key Takeaways
- A general solution is a family of functions containing one arbitrary constant per order of the equation.
- Classify the equation first — order, linearity, separability, homogeneity — because the type dictates the method.
- First-order equations use separation of variables, integrating factors, or exactness.
- Second-order linear constant-coefficient equations combine a complementary solution and a particular solution.
- Always verify by substituting back; the constants should cancel and both sides should match.
- Never drop arbitrary constants — they distinguish the general solution from a particular one.