First-Order Differential Equations

What you will be able to do

Given a first-order ordinary differential equation, the learner can classify it as separable, linear or both, apply the corresponding method to obtain the general solution, use an initial condition to determine the constant, and verify the result by substitution.

Orientation

An equation whose unknown is a function

Every equation so far has constrained a number. x 2 − 3 x − 10 = 0 asks which values of x make it true, and the answer is a list.

d y d x = 2 x y asks something different. It constrains a function by relating it to its own rate of change, and the answer is a function, here y = 3 e x 2 , which can be checked: differentiating gives y ′ = 6 x e x 2 , and 2 x y = 2 x ⋅ 3 e x 2 is the same thing.

That shift matters because rates are how most quantitative laws are stated. "Grows at a rate proportional to its size", "cools at a rate proportional to the temperature difference", "the current adjusts until the voltage balances". Each is a sentence about a derivative, and writing it down produces a differential equation rather than an algebraic one.

The answer is a family rather than a single function, because knowing how fast something changes does not say where it started. The general solution carries an arbitrary constant, and an initial condition picks out one member.

Two methods handle the first-order cases. If the rate factors into an x -part and a y -part, the variables separate onto opposite sides and each integrates on its own. If the equation is linear in y , multiplying by a chosen factor turns the left side into a product's derivative, which collapses under integration.

Both reduce the problem to integration, so the techniques from that unit do the real work, and every answer can be verified by differentiating it back.

Why this matters

Why the answer is a family

Start from the simplest case: d y d x = 2 x . This asks which functions have derivative 2 x , and the integration unit already answered it: y = x 2 + C , a family with one arbitrary constant.

That constant is not a loose end. The equation specifies the slope at every point and says nothing about height, so translating a solution vertically produces another solution. The family is the set of all those translates, and picking one requires information the equation does not contain.

An initial condition supplies it. Requiring y ( 0 ) = 3 forces C = 3 , selecting one curve from infinitely many. One arbitrary constant, one condition, which is why a first-order equation needs exactly one.

Why the general case is harder. d y d x = 2 x y cannot be integrated directly, because the right side involves the unknown y . Antidifferentiating requires knowing y , which is what is being sought.

Separation is the move that breaks the circle. Dividing by y puts every y on one side and every x on the other:

d y y = 2 x d x ,

and now each side integrates in its own variable, giving ln ⁡ | y | = x 2 + C and hence y = A e x 2 . With y ( 0 ) = 3 the constant is A = 3 , and the solution checks: y ′ / y evaluated numerically at x = 0 , 0.5 , 1 gives 0 , 1.000000 , 2.000000 , exactly 2 x .

What separation costs. Dividing by y assumed y ≠ 0 . But y = 0 is itself a solution, since the zero function has zero derivative and 2 x ⋅ 0 = 0 , and the division discarded it. The general form y = A e x 2 recovers it at A = 0 in this case, but that is luck rather than method: the constant solutions where the divisor vanishes must be checked separately.

Why the second method exists. d y d x = x + y resists separation entirely, since x + y cannot be written as f ( x ) g ( y ) . Rearranged as y ′ − y = x it is linear, and multiplying by e − x makes the left side ( e − x y ) ′ , a single derivative, which integration undoes. The two methods answer two different shapes, and neither subsumes the other.

Figure

A slope field with two solution curves through it

the equation fixes the slope; the condition picks the curve

The grey segments are the slope field of y ′ = 2 x : at each point, a direction of slope 2 x . The equation says nothing about height, only about steepness, so it specifies this field and nothing more.

Two solution curves are drawn, y = x 2 and y = x 2 + 1.5 . Both follow the field exactly — that is what solving means — and they are vertical translates of one another, which is why the general solution carries an arbitrary constant.

An initial condition selects one of them. Requiring y ( 0 ) = 1.5 picks the upper curve and discards the rest of the family, which is the whole content of the phrase initial value problem.

Definition

Why each method requires the form it does

Why separation needs a product f ( x ) g ( y ) . The step that makes the method work is writing d y g ( y ) = f ( x ) d x , with every y on the left and every x on the right. That is possible exactly when the right-hand side factors. A sum such as x + y cannot be split this way, because dividing by y leaves x y + 1 , which still mixes the variables.

Testing for separability is therefore a question about factoring, not about difficulty: 2 x y factors as ( 2 x ) ( y ) , y / x factors as ( 1 / x ) ( y ) , y 2 factors as ( 1 ) ( y 2 ) , and x + y does not.

Why the integrating factor is e ∫ P and nothing else. Multiplying y ′ + P y = Q by μ gives μ y ′ + μ P y , and the aim is for that to be ( μ y ) ′ = μ y ′ + μ ′ y . Matching the two requires

μ ′ = μ P ,

which is itself a separable equation with solution μ = e ∫ P d x . The factor is not guessed. It is forced by the requirement that the product rule apply.

The constant of integration in ∫ P is omitted deliberately: including it multiplies μ by a constant, which cancels when both sides are later divided by μ .

Why standard form matters. μ is built from P , the coefficient of y when the coefficient of y ′ is 1. For 2 y ′ + 4 y = 8 the correct P is 2, obtained after dividing through, using 4 gives μ = e 4 x , which does not satisfy μ ′ = μ P and collapses nothing.

Why the constant enters at integration. Writing ln ⁡ | y | = x 2 and appending a constant afterwards gives y = e x 2 + C , which does not solve the equation: differentiating gives 2 x e x 2 , while 2 x y = 2 x e x 2 + 2 x C . The constant must be introduced where it arises, inside the logarithm's argument after exponentiating, yielding y = A e x 2 .

Why constant solutions can be lost. Separation divides by g ( y ) , which is invalid where g ( y ) = 0 . Each root y = c of g gives a constant function with y ′ = 0 = f ( x ) g ( c ) . A genuine solution that the division removed. For y ′ = y ( 1 − y ) the roots y = 0 and y = 1 are both solutions, and neither is produced by the separated integral.

Why verification is always available. A solution is a function making the equation an identity, so substituting it and differentiating settles the matter without reference to how it was found. For y = 3 − 2 e − 2 x and y ′ + 2 y = 6 , evaluating at x = 0 , 0.5 , 1 , 3 gives 6.000000 each time. No other kind of equation offers so direct a check.

Procedure

Classify, then solve

Step 1 — classify before solving. Look at the right-hand side of d y d x = F ( x , y ) :

F ( x , y ) ClassMethod
factors as f ( x ) g ( y ) separableStep 2
rearranges to y ′ + P ( x ) y = Q ( x ) linearStep 3
botheither workspick the easier
neitheroutside this unit—

An equation can be both: 2 x y is ( 2 x ) ( y ) and also y ′ − 2 x y = 0 . It can be one and not the other: x + y is linear only; y 2 is separable only.

Step 2 — separate and integrate.

  1. Write d y g ( y ) = f ( x ) d x .
  2. Note the roots of g before dividing. Each y = c with g ( c ) = 0 is a constant solution.
  3. Integrate both sides, adding one constant on the right.
  4. Solve for y , absorbing the constant into its final form, so that e x 2 + C becomes A e x 2 .
  5. Restore any constant solutions from step 2 that the general form does not already include.

Step 3 — integrating factor.

  1. Put it in standard form: divide until the coefficient of y ′ is 1, giving y ′ + P ( x ) y = Q ( x ) .
  2. Compute μ = e ∫ P d x , omitting the constant of integration.
  3. Multiply through. The left side is now ( μ y ) ′ ; verify this if in doubt by differentiating the product.
  4. Integrate: μ y = ∫ μ Q d x + C .
  5. Divide by μ to isolate y .

Step 4 — apply the initial condition. Only after the general solution is complete. Substitute x 0 and y 0 , solve for the constant, and write the particular solution.

Applying the condition to an intermediate expression fixes the wrong constant.

Step 5 — verify. Differentiate the answer and substitute it into the original equation; it must reduce to an identity. Check the initial condition separately by evaluating at x 0 .

This check is decisive and cheap. For y = 3 − 2 e − 2 x solving y ′ + 2 y = 6 , the left side evaluates to 6.000000 at x = 0 , 0.5 , 1 , 3 , and y ( 0 ) = 1 .

For a linear equation with constant coefficients, the solution splits into a steady state and a transient that decays. In y = 3 + C e − 2 x the 3 is what remains as x grows, reaching 2.995 by x = 3 , and the exponential is what the initial condition controls.

Worked example

Four equations, classified then solved

1. Separable: d y d x = 2 x y with y ( 0 ) = 3 .

Classify. The right side factors as ( 2 x ) ( y ) , so it is separable. (It is also linear, as y ′ − 2 x y = 0 , either method works.)

Note the constant solution. g ( y ) = y vanishes at y = 0 , so y = 0 is a solution that the division will discard.

Separate and integrate.

d y y = 2 x d x ⟹ ln ⁡ | y | = x 2 + C ⟹ y = A e x 2 .

The constant entered at the integration and was absorbed as A = ± e C . Note A = 0 recovers the discarded y = 0 , so nothing is lost here.

Apply the condition. y ( 0 ) = A = 3 , giving y = 3 e x 2 .

Verify. Numerically y ′ / y at x = 0 , 0.5 , 1 gives 0 , 1.000000 , 2.000000 , exactly 2 x . And y ( 0 ) = 3 .

2. Separable: d y d x = y x with y ( 1 ) = 4 .

The right side factors as ( 1 x ) ( y ) .

d y y = d x x ⟹ ln ⁡ | y | = ln ⁡ | x | + C ⟹ y = A x .

With y ( 1 ) = 4 : A = 4 , so y = 4 x .

Verify. y ′ = 4 and y x = 4 x x = 4 at x = 1 , 2 , 5 . The solutions are lines through the origin, which the equation predicts, since the slope equals the ratio y / x .

3. Linear: y ′ + 2 y = 6 with y ( 0 ) = 1 .

Classify. Already in standard form, with P = 2 and Q = 6 . Not separable as written, but 6 − 2 y does factor, so it happens to be both; the linear route is shown.

Integrating factor. μ = e ∫ 2 d x = e 2 x . Multiplying through:

e 2 x y ′ + 2 e 2 x y = 6 e 2 x ⟹ ( e 2 x y ) ′ = 6 e 2 x .

Integrate and divide. e 2 x y = 3 e 2 x + C , so y = 3 + C e − 2 x .

Apply the condition. y ( 0 ) = 3 + C = 1 gives C = − 2 , so y = 3 − 2 e − 2 x .

Verify. y ′ + 2 y evaluates to 6.000000 at x = 0 , 0.5 , 1 , 3 , and y ( 0 ) = 1 .

Read it. The solution is a steady state 3 plus a transient − 2 e − 2 x that decays: at x = 3 the value is already 2.995 , and as x grows it approaches 3 exactly.

4. Linear but not separable: d y d x = x + y with y ( 0 ) = 0 .

Classify. x + y does not factor as f ( x ) g ( y ) , separation is unavailable. Rearranged, y ′ − y = x , which is linear with P = − 1 .

Integrating factor. μ = e ∫ ( − 1 ) d x = e − x :

( e − x y ) ′ = x e − x .

Integrate. The right side needs parts, with u = x and d v = e − x d x :

∫ x e − x d x = − x e − x − e − x + C ,

so e − x y = − x e − x − e − x + C and y = C e x − x − 1 .

Apply the condition. y ( 0 ) = C − 1 = 0 gives C = 1 , so y = e x − x − 1 .

Verify. At x = 0 , 1 , 2 the derivative is 0 , 1.718282 , 6.389056 , and x + y is 0 , 1.718282 .

This is the case that shows why two methods are needed: no amount of rearranging makes x + y separable.

Example

The equations that keep appearing

d y d t = k y : exponential growth and decay. Separable, with solution y = y 0 e k t . Positive k grows, negative k decays. For a half-life of 5, k = − ln ⁡ 2 5 = − 0.13862944 , and the ratio y / y 0 reads 1 , 0.5 , 0.25 at t = 0 , 5 , 10 .

Radioactive decay, continuously compounded interest, unconstrained population growth and first-order chemical kinetics are all this equation.

d y d x = y x : solutions are lines through the origin. y = A x , since the equation says the slope equals the ratio y / x , which is exactly the property of a line through the origin. With y ( 1 ) = 4 , the solution y = 4 x has y ′ = 4 = y / x at x = 1 , 2 , 5 .

y ′ + 2 y = 6 : steady state plus transient. Solution y = 3 + C e − 2 x . Whatever the initial value, the solution approaches 3: at x = 3 it is 2.995 . The constant 3 is where y ′ = 0 , the equilibrium the system settles into, and C e − 2 x is the memory of the start, decaying away.

Newton's law of cooling has this shape, with 3 replaced by the ambient temperature.

d y d x = x + y : linear, not separable. Solution y = C e x − x − 1 . The particular part − x − 1 tracks the forcing term and the C e x is the homogeneous solution. Verified at x = 0 , 1 , 2 : the derivative and x + y agree at 0 , 1.718282 .

y ′ = y ( 1 − y ) : the logistic equation. Separable, with general solution y = 1 1 + A e − x . Checked at A = 1 and A = 4 across x = 0 , 2 , 5 , the derivative matches y ( 1 − y ) to eight decimals.

It has two constant solutions, y = 0 and y = 1 , both found by inspection rather than by the method: separation divides by y ( 1 − y ) , which vanishes at both. The general form recovers y = 1 at A = 0 but never reaches y = 0 for any finite A , so that solution must be restored by hand.

This is constrained population growth, where 1 is the carrying capacity.

y ′ = y 2 : a solution that escapes. Separable, giving y = 1 C − x ; with y ( 0 ) = 1 , y = 1 1 − x . Checked at x = 0 , 0.5 , 0.9 , 0.99 , the derivative matches y 2 , and the values climb 1 , 2 , 10 , 100 .

The solution blows up as x → 1 , in finite x , even though the right-hand side y 2 is perfectly well behaved everywhere. A solution need not exist for all x .

Five of the six are separable and three are also linear. Equilibrium, carrying capacity and finite-time blow-up are visible in the solution rather than in the equation.

Theorem

Existence and uniqueness for first-order equations

Existence and uniqueness (Picard–Lindelöf). Consider the initial value problem

d y d x = F ( x , y ) , y ( x 0 ) = y 0 .

If F is continuous on a rectangle around ( x 0 , y 0 ) , a solution exists on some interval containing x 0 . If in addition ∂ F ∂ y is continuous there, that solution is unique.

What each hypothesis supplies. Continuity alone gives existence; the condition on ∂ F / ∂ y , a Lipschitz condition in y , gives uniqueness. They are separate guarantees, and the second can fail while the first holds.

Where uniqueness fails. Take d y d x = y 1 / 3 with y ( 0 ) = 0 . The right side is continuous, so a solution exists. But ∂ F / ∂ y = 1 3 y − 2 / 3 is unbounded at y = 0 , and uniqueness genuinely fails:

  • y = 0 solves it, since 0 ′ = 0 = 0 1 / 3 ;
  • y = ( 2 x 3 ) 3 / 2 also solves it, checked at x = 0.5 , 1 , 2 , the derivative matches y 1 / 3 to five decimals, and it passes through ( 0 , 0 ) .

Two different solutions through the same point. Nothing has gone wrong in either; the theorem simply does not apply.

Why "on some interval" is not a hedge. Existence is local, and a solution can cease to exist while the equation remains perfectly well behaved. For y ′ = y 2 with y ( 0 ) = 1 the solution is y = 1 1 − x , which satisfies the equation, verified at x = 0 , 0.5 , 0.9 , 0.99 where the derivative matches y 2 , and whose values climb 1 , 2 , 10 , 100 before escaping to infinity as x → 1 .

The right-hand side y 2 is continuous and smooth everywhere. The blow-up is a property of the solution, not a defect in the equation, and no theorem about F can rule it out.

The linear case is better behaved. For y ′ + P ( x ) y = Q ( x ) with P and Q continuous on an interval I , a unique solution exists on all of I for any initial condition in it. Here F = Q − P y has ∂ F / ∂ y = − P , continuous by assumption, so uniqueness holds, and linearity rules out finite-time blow-up.

That is why y ′ + 2 y = 6 with y ( 0 ) = 1 has exactly one solution, y = 3 − 2 e − 2 x , defined for every real x .

Why this matters for the methods. Separation and the integrating factor each produce a solution. The theorem is what licenses calling it the solution once an initial condition is imposed, and its failure cases are a reminder that the licence is conditional. When uniqueness fails, a method that returns one answer has not found them all.

Non-example

Answers and assumptions that fail

A solution is a function, not a number. Asked to solve d y d x = 2 x y , reporting " x = 0 " or " y = 3 " answers a question that was not posed. The unknown is the function itself, and y = 3 e x 2 is a complete answer, verified by differentiating: y ′ = 6 x e x 2 and 2 x y = 6 x e x 2 .

Attempting separation on a sum. d y d x = x + y cannot be separated, because x + y does not factor as f ( x ) g ( y ) . Dividing by y gives x y + 1 , which still contains both variables. The equation is linear and must be solved that way, giving y = C e x − x − 1 at x = 0 , 1 , 2 .

The test is factoring, not effort: 2 x y factors, y / x factors, y 2 factors, x + y does not.

Computing μ from the wrong P . For 2 y ′ + 4 y = 8 , the standard form is y ′ + 2 y = 4 , so P = 2 and μ = e 2 x . Taking P = 4 from the undivided equation gives μ = e 4 x , and the left side then fails to collapse, ( e 4 x y ) ′ = e 4 x y ′ + 4 e 4 x y , which is not what multiplying produced. Dividing to standard form first is not tidying; it is what makes the method work.

Adding the constant after solving for y . From ln ⁡ | y | = x 2 , writing y = e x 2 + C gives a function that does not solve y ′ = 2 x y : its derivative is 2 x e x 2 , while 2 x y = 2 x e x 2 + 2 x C . The constant must enter at the integration and be carried through the exponentiation, giving y = A e x 2 .

Losing the constant solutions. For the logistic equation y ′ = y ( 1 − y ) , separation divides by y ( 1 − y ) , which vanishes at y = 0 and y = 1 . Both are genuine solutions: each is constant, so y ′ = 0 , and y ( 1 − y ) is 0 at both.

The general solution y = 1 1 + A e − x recovers y = 1 at A = 0 , but no finite A gives y = 0 . That solution exists and the method cannot produce it, which is why the roots of the divisor are noted before dividing.

Assuming a solution exists for all x . y ′ = y 2 with y ( 0 ) = 1 has solution y = 1 1 − x , whose values run 1 , 2 , 10 , 100 at x = 0 , 0.5 , 0.9 , 0.99 and which ceases to exist at x = 1 . The equation is smooth everywhere; the solution still escapes in finite x . Existence is local, and "solve the equation" does not come with a guarantee of a global answer.

Assuming uniqueness. y ′ = y 1 / 3 with y ( 0 ) = 0 has both y = 0 and y = ( 2 x / 3 ) 3 / 2 passing through the origin. A method that returns one of them has not found them all, and uniqueness requires the extra hypothesis on ∂ F / ∂ y that fails here.

Applying the initial condition too early. Substituting y ( 0 ) = 3 into ln ⁡ | y | = x 2 + C before exponentiating gives C = ln ⁡ 3 , which is correct, but doing the same to an intermediate expression that is not yet the general solution fixes a constant in the wrong place. The condition belongs at the end, applied to the finished general solution.

Optional enrichment (1)

Application

Laws stated as rates

Radioactive decay and dating. d N d t = − λ N says a sample decays at a rate proportional to what remains, giving N = N 0 e − λ t . A half-life of 5 units means λ = ln ⁡ 2 5 = 0.13862944 , and the remaining fraction is 1 , 0.5 , 0.25 at t = 0 , 5 , 10 . Carbon dating inverts this: measuring N / N 0 and solving for t is the logarithm step from the functions unit.

Newton's law of cooling. d T d t = − k ( T − T a ) . The rate of cooling is proportional to the excess over ambient. This is linear, and its solution T = T a + C e − k t has exactly the steady-state-plus-transient shape of y ′ + 2 y = 6 : the body approaches ambient temperature, and the initial difference decays away. Forensic time-of-death estimates solve this for t .

Continuously compounded interest. d A d t = r A gives A = A 0 e r t , and the limit of discrete compounding that the series unit computed, lim ( 1 + r / n ) n = e r , is the same result reached the other way. The two derivations meeting is a check on both.

Constrained population growth. The logistic equation d P d t = r P ( 1 − P K ) adds a ceiling: growth is proportional to the population and to the room remaining. Its solution is the S-curve P = K 1 + A e − r t , checked here at two values of A across three points. The constant solutions P = 0 and P = K are the extinct and saturated states, equilibria the method discards and inspection restores.

The integration unit met this equation from the other side: its partial-fraction decomposition 1 P + 1 1 − P is the integral that separation produces.

Mixing problems. A tank with inflow and outflow gives d S d t = ( rate in ) − S V ( rate out ) , linear in S and solved by integrating factor. Pharmacokinetics uses the same equation for drug concentration, where the steady state is the therapeutic level and the transient is the loading phase.

RC circuits. R d Q d t + Q C = V is linear with constant coefficients, and its solution charges toward C V with time constant R C . Every exponential approach to equilibrium in engineering has this form, which is why recognising it matters more than the algebra.

Why so many phenomena share so few equations. "Proportional to the amount present" gives exponential behaviour; "proportional to the difference from equilibrium" gives approach to a steady state; "proportional to both the amount and the room left" gives the S-curve. Three sentences, three equations, and most first-order modelling is one of them.

Next step

Practice First-Order Differential Equations

Practice this

Results update as you type. Use the up and down arrow keys to move between results, Enter to open one, and Escape to close.

Type to search.

Settings

Appearance

Interface density

Your record

Your progress is stored in this browser and nowhere else: an identifier, the answers you have given, the mastery states and review schedule derived from them, and the lesson you last opened. Clearing it makes you a new learner on this device. It cannot be undone, and it will not affect your appearance or density settings.

Focus timer

Focus--minutes remaining

Phase

Kept in this browser only, and used to label the session in your own history.

Today

Nothing recorded yet. Finish a focus session and it will appear here.

Settings

Focus sessions between long breaks.

Sessions you are aiming for in a day.

Notifications

Your history

Sessions are stored in this browser and nowhere else. They are not evidence and never reach your mastery record.