Skip to main content

Separable differential equations: separating variables, integrating both sides, and initial conditions

Syllabus dot point

“Solve separable first-order differential equations of the form dydx=f(x)g(y)\frac{dy}{dx} = f(x) g(y) by separating variables and integrating both sides”

HSCMaths Extension 1Calculus (ME-C1, C2, C3)12 min read

Quick answer

A separable ODE dydx=f(x)g(y)\frac{dy}{dx} = f(x) g(y) is solved by writing dyg(y)=f(x) dx\frac{dy}{g(y)} = f(x) \, dx, integrating both sides, applying the initial condition to find the constant, and solving for yy (explicitly when possible, implicitly when not).

Jump to a section
  1. What this dot point is asking
  2. The answer
  3. Exam-style questions

What this dot point is asking

NESA wants you to solve a first-order differential equation of the form dydx=f(x)g(y)\frac{dy}{dx} = f(x) g(y) by separating the variables, integrating each side, and applying any given initial condition to find the constant of integration.

The conceptual leap is that dydx\frac{dy}{dx}, though it is really a single limit, can be manipulated like a fraction here: you gather all the yy-stuff with dydy on one side and all the xx-stuff with dxdx on the other, then integrate each side with respect to its own variable. This works precisely because the right-hand side factorises into a part in xx times a part in yy - which is what "separable" means.

The answer

The separation method

For an equation dydx=f(x)g(y)\frac{dy}{dx} = f(x) g(y):

  1. Rewrite as dyg(y)=f(x) dx\frac{dy}{g(y)} = f(x) \, dx.
  2. Integrate both sides: ∫dyg(y)=∫f(x) dx+C\int \frac{dy}{g(y)} = \int f(x) \, dx + C.
  3. Solve for yy in terms of xx (or leave in implicit form if cleaner).
  4. Apply any initial condition y(x0)=y0y(x_0) = y_0 to determine CC.

If g(y0)=0g(y_0) = 0 for some value y0y_0, then y=y0y = y_0 is a constant solution (an equilibrium of the equation). This must be checked separately, because the separation step divides by g(y)g(y) and so silently throws it away.

Key fact

A first-order ODE is separable exactly when the right-hand side factorises as dydx=f(x) g(y)\dfrac{dy}{dx} = f(x)\,g(y) - a function of xx alone times a function of yy alone. Then dyg(y)=f(x) dx\dfrac{dy}{g(y)} = f(x)\,dx and you integrate each side. Two things are easy to lose: the constant of integration (one +C+C, gathered on the right, stands for a whole family of solutions) and any constant solution y=y0y = y_0 where g(y0)=0g(y_0) = 0, which the division by g(y)g(y) removes.

Reading the equation geometrically, stage by stage

A first-order ODE assigns a gradient to every point of the plane, and a solution is a curve that follows those gradients. Seeing this picture makes the algebra meaningful: separating and integrating is just finding the curves that thread through the gradient field. The figures below use dydx=−xy\dfrac{dy}{dx} = -\dfrac{x}{y}, whose solutions turn out to be circles.

Stage 1, the slope field. The equation gives a slope at every point: at (x,y)(x, y) the gradient is −xy-\dfrac{x}{y}. Drawing a short segment of that slope at a grid of points produces the slope field, which already hints at a circular pattern.

Stage 1: the equation gives a slope everywhereFor dy by dx equals minus x over y, every point of the plane is given a small line segment of that slope. The segments form a circular pattern around the origin.xydy/dx = -x/y1

Stage 2, separate and integrate. Gather the variables: y dy=−x dxy\,dy = -x\,dx. Integrating both sides gives 12y2=−12x2+C\tfrac12 y^2 = -\tfrac12 x^2 + C, which tidies to x2+y2=Cx^2 + y^2 = C. The algebra has produced the equation of the curves the slope field was tracing.

Stage 2: separate the variables, then integrateMove all y terms to the left and all x terms to the right: y dy equals minus x dx. Integrating both sides gives one half y squared equals minus one half x squared plus a constant.y dy = -x dx∫ both sides½y² = -½x² + C ⇒ x² + y² = C2

Stage 3, the general solution. x2+y2=Cx^2 + y^2 = C is a family of concentric circles, one for each value of the constant C>0C > 0. Every member of the family is a solution; the slope-field segments are tangent to these circles, which is the visual meaning of "the curve follows the gradients".

Stage 3: the general solution is a family of curvesThe integrated equation x squared plus y squared equals C is a family of concentric circles, one for each value of the constant C. The slope-field segments are tangent to these circles.xyx² + y² = C3

Stage 4, apply the initial condition. A condition such as y=2y = 2 when x=0x = 0 fixes the constant: 0+4=C0 + 4 = C, so C=4C = 4. That selects the single circle x2+y2=4x^2 + y^2 = 4 from the family - the particular solution through the given point.

Stage 4: the initial condition picks one curveAn initial condition such as y equals 2 when x equals 0 fixes the constant, here C equals 4, selecting the single circle of radius 2 from the family as the particular solution.xy(0, 2)x² + y² = 44

When separation is possible

A first-order ODE separates if and only if you can write dydx=f(x)g(y)\frac{dy}{dx} = f(x) g(y) for some functions ff and gg. Examples that separate:

  • dydx=xy\frac{dy}{dx} = x y.
  • dydx=exsin⁡y\frac{dy}{dx} = e^x \sin y.
  • dydx=y+1x−1\frac{dy}{dx} = \frac{y + 1}{x - 1}.

Examples that do not separate:

  • dydx=x+y\frac{dy}{dx} = x + y (a sum, not a product).
  • dydx=yx+y\frac{dy}{dx} = \frac{y}{x + y} (cannot be factored cleanly).

Extension 1 problems are always separable; non-separable equations belong to Extension 2.

The constant of integration

Always include a constant after integration. It is cleaner to combine the constants from both sides into one CC on the right.

If the question gives an initial condition, substitute to find CC. If not, leave the answer in terms of CC. A favourite simplification is to relabel a messy constant: after exponentiating ln⁡∣y∣=x3+C\ln|y| = x^3 + C, the factor eCe^C becomes a single new constant AA, and you should say so explicitly.

Newton's law of cooling

A body cools toward an ambient temperature TaT_a at a rate proportional to the temperature difference:

dTdt=−k(T−Ta),\frac{dT}{dt} = -k (T - T_a),

where k>0k > 0.

Separate: dTT−Ta=−k dt\frac{dT}{T - T_a} = -k \, dt.

Integrate: ln⁡∣T−Ta∣=−kt+C\ln |T - T_a| = -k t + C.

So T−Ta=Ae−ktT - T_a = A e^{-k t} for some constant AA, giving

T(t)=Ta+(T0−Ta)e−kt.T(t) = T_a + (T_0 - T_a) e^{-k t}.

The temperature approaches TaT_a as t→∞t \to \infty. Note that T=TaT = T_a is the equilibrium (constant) solution, the case A=0A = 0: a body already at room temperature stays there.

Implicit versus explicit solutions

Sometimes the integrated equation cannot be solved cleanly for yy. In that case, leave it implicit. For example,

dydx=−xy  ⟹  y dy=−x dx  ⟹  y2+x2=C.\frac{dy}{dx} = -\frac{x}{y} \implies y \, dy = -x \, dx \implies y^2 + x^2 = C.

This is the family of circles x2+y2=Cx^2 + y^2 = C, the implicit solution - and the one drawn in the stage figures above.

How exam questions ask about separable ODEs

  • "Solve the differential equation ..." (with an initial condition). Separate, integrate, apply the condition to find the constant, and give yy explicitly (choosing the correct sign of any root from the initial condition).
  • "Find the general solution." Same, but stop at the family with +C+C; no initial condition is given.
  • "Show that y=…y = \ldots satisfies / is a solution." You can verify by differentiating, but a "solve" instruction wants the separation method shown.
  • "A body cools / a population grows ..." A modelling problem: set up the proportionality as a differential equation, separate and solve, then use the data points to find the constants kk and AA.
  • "Find the constant solution / equilibrium." Set dydx=0\frac{dy}{dx} = 0, i.e. solve g(y)=0g(y) = 0; this is the solution the separation step hides.
  • "Leave your answer in implicit form." Do not force an explicit yy; the integrated equation is the answer.
Worked example

Solve a basic separable equation

To solve dydx=3x2y\frac{dy}{dx} = 3x^2 y, divide both sides by yy and multiply by dxdx to get all yy-terms on the left and xx-terms on the right.

dyy=3x2 dx.\frac{dy}{y} = 3x^2 \, dx.

Integrate both sides: ln⁡∣y∣=x3+C\ln |y| = x^3 + C.

Solve for yy:

Exponentiate both sides: ∣y∣=ex3+C=eCex3|y| = e^{x^3 + C} = e^C e^{x^3}. Writing A=±eCA = \pm e^C absorbs the sign and the constant.

y=Aex3.y = A e^{x^3}.

Final answer: y=Aex3y = A e^{x^3} for an arbitrary constant AA. (The case A=0A = 0 recovers the constant solution y=0y = 0, which the division by yy had removed.)


Solve with an initial condition

To solve dydx=−2xy2\frac{dy}{dx} = -2xy^2 with y(0)=1y(0) = 1, separate: dyy2=−2x dx\frac{dy}{y^2} = -2x \, dx. Integrate both sides:

−1y=−x2+C.-\frac{1}{y} = -x^2 + C.

Apply the initial condition and solve for yy:

Substitute x=0x = 0, y=1y = 1: −1=0+C-1 = 0 + C, so C=−1C = -1. The equation becomes −1y=−x2−1-\frac{1}{y} = -x^2 - 1, so 1y=x2+1\frac{1}{y} = x^2 + 1.

y=1x2+1.y = \frac{1}{x^2 + 1}.

Final answer: y=1x2+1y = \dfrac{1}{x^2 + 1}.


Solve a trigonometric separable equation

To solve dydx=sin⁡xy\frac{dy}{dx} = \frac{\sin x}{y}, multiply both sides by yy and by dxdx:

y dy=sin⁡x dx.y \, dy = \sin x \, dx.

Integrate both sides: y22=−cos⁡x+C\frac{y^2}{2} = -\cos x + C.

Simplify the constant:

Multiply through by 22, writing C′=2CC' = 2C for the new constant:

y2=−2cos⁡x+C′.y^2 = -2\cos x + C'.

Final answer: y2=−2cos⁡x+C′y^2 = -2\cos x + C' (implicit form; an initial condition would fix C′C' and the sign of the root).


Solve a Newton's law of cooling problem

A cup of coffee at 90∘90^\circC is left in a 20∘20^\circC room and cools to 60∘60^\circC after 1010 minutes. Newton's law of cooling gives T(t)=20+70e−ktT(t) = 20 + 70 e^{-kt}, where T0=90T_0 = 90 and Ta=20T_a = 20. At t=10t = 10, T=60T = 60:

60=20+70e−10k  ⟹  e−10k=4070=47  ⟹  k=−110ln⁡47≈0.0560.60 = 20 + 70 e^{-10k} \implies e^{-10k} = \frac{40}{70} = \frac{4}{7} \implies k = -\frac{1}{10}\ln\frac{4}{7} \approx 0.0560.

Evaluate at t=30t = 30:

T(30)=20+70e−0.0560⋅30=20+70e−1.68≈20+70⋅0.186≈33∘C.T(30) = 20 + 70 e^{-0.0560 \cdot 30} = 20 + 70 e^{-1.68} \approx 20 + 70 \cdot 0.186 \approx 33^\circ\text{C}.

Final answer: approximately 33∘33^\circC after 3030 minutes. The coffee never quite reaches 20∘20^\circC; it approaches room temperature as t→∞t \to \infty.


Solve the logistic equation with partial fractions

To solve dydx=y(1−y)\frac{dy}{dx} = y(1 - y), separate: dyy(1−y)=dx\frac{dy}{y(1-y)} = dx. Decompose the left-side fraction by partial fractions: 1y(1−y)=1y+11−y\frac{1}{y(1-y)} = \frac{1}{y} + \frac{1}{1-y}.

∫(1y+11−y)dy=∫dx  ⟹  ln⁡∣y∣−ln⁡∣1−y∣=x+C.\int \left(\frac{1}{y} + \frac{1}{1 - y}\right) dy = \int dx \implies \ln|y| - \ln|1 - y| = x + C.

Solve for yy explicitly:

The left side is ln⁡∣y1−y∣\ln\left|\frac{y}{1-y}\right|, so y1−y=Aex\frac{y}{1-y} = Ae^x. Solve for yy: y=Aex(1−y)y = Ae^x(1-y), giving y(1+Aex)=Aexy(1 + Ae^x) = Ae^x.

y=Aex1+Aex.y = \frac{Ae^x}{1 + Ae^x}.

Final answer: y=Aex1+Aexy = \dfrac{Ae^x}{1 + Ae^x}, the logistic curve. Here y=0y = 0 and y=1y = 1 are the two constant solutions (g(y)=y(1−y)=0g(y) = y(1-y) = 0), which bound the family.


Solve via an implicit solution

To solve dydx=−yx\frac{dy}{dx} = -\frac{y}{x} with y(1)=2y(1) = 2, separate: dyy=−dxx\frac{dy}{y} = -\frac{dx}{x}. Integrate both sides:

ln⁡∣y∣=−ln⁡∣x∣+C  ⟹  ln⁡∣xy∣=C  ⟹  xy=A.\ln|y| = -\ln|x| + C \implies \ln|xy| = C \implies xy = A.

Apply the initial condition:

At (x,y)=(1,2)(x, y) = (1, 2): A=1⋅2=2A = 1 \cdot 2 = 2. So xy=2xy = 2.

y=2x.y = \frac{2}{x}.

Final answer: y=2xy = \dfrac{2}{x}.

Common traps
Failing to separate properly
dydx=x+y\frac{dy}{dx} = x + y does not separate. Do not force a sum into a separable shape.
Missing constant solutions
dydx=y2\frac{dy}{dx} = y^2 has y=0y = 0 as a constant solution that the separation step (dividing by y2y^2) would lose. Check g(y)=0g(y) = 0 separately.
Forgetting the constant of integration
Integrating both sides without a +C+ C throws away an entire family of solutions.
Algebra errors when isolating yy
When solving y2=f(x)+Cy^2 = f(x) + C for yy, the sign of the square root is fixed by continuity with the initial condition.
Treating the constant inconsistently
AeCA e^C, AA, and ln⁡C\ln C all stand for arbitrary constants; pick a single name and stick with it.
Exam technique

Show the separation as its own line (dyg(y)=f(x) dx\frac{dy}{g(y)} = f(x)\,dx) - it is where the method mark sits. Put a single +C+C on the right and, if there is an initial condition, substitute to find it before rearranging, which is usually tidier. State which sign of any square root you take and why (continuity with the given point). If the equation has an equilibrium g(y0)=0g(y_0) = 0, mention the constant solution; some questions award a mark for spotting it.

Exam-style questions

Questions in the style of NESA exam questions on this dot point, each with a worked answer. They are written by ExamExplained unless tagged "Past paper"; the year shows the paper a question is modelled on.

HSC-style4 marks
Solve the differential equation dydx=xy\frac{dy}{dx} = \frac{x}{y} with y(0)=2y(0) = 2.
Show worked answer →

Separate variables: y dy=x dxy \, dy = x \, dx.

Integrate both sides: y22=x22+C\frac{y^2}{2} = \frac{x^2}{2} + C, so y2=x2+C′y^2 = x^2 + C' (writing C′C' for 2C2 C).

Apply y(0)=2y(0) = 2: 4=0+C′4 = 0 + C', so C′=4C' = 4.

y2=x2+4y^2 = x^2 + 4, so y=x2+4y = \sqrt{x^2 + 4} (positive root because y(0)=2>0y(0) = 2 > 0 and continuity).

Markers reward the separation, the integration on both sides, applying the initial condition to find the constant, and choosing the correct sign for the square root.

Practise this

Sources & how we know this

ExamExplained