Achievable logoAchievable logo
AP Calculus AB
Sign in
Sign up
Purchase
Textbook
Practice exams
Support
How it works
Exam catalog
Mountain with a flag at the peak
Textbook
Introduction
1. Limits
2. Derivative basics
3. Advanced differentiation
4. Contextual uses
5. Analytical uses
6. Integration
7. Differential equations
7.1 Modeling & verifying solutions
7.2 Slope fields
7.3 Separation of variables
7.4 Exponential models
8. Applications of integrals
9. Testing details tag
Wrapping up
Achievable logoAchievable logo
7.3 Separation of variables
Achievable AP Calculus AB
7. Differential equations
Our AP Calculus AB course is currently in development and is a work-in-progress.

Separation of variables

7 min read
Font
Discuss
Share
Feedback

What you’ll learn:

  • How to solve first-order differential equations using separation of variables
  • How to apply initial conditions to find a particular solution

So far, you’ve seen differential equations like

dxdy​=2x

which you can solve by integrating both sides with respect to x. When the right-hand side depends on both x and y, a common method is separation of variables.

The idea is to rewrite the equation so that:

  • all y-terms (and dy) are on one side
  • all x-terms (and dx) are on the other side

This works when the differential equation can be written in the form

dxdy​=f(x)⋅g(y)

If you can’t rewrite it as a product of a function of x and a function of y, then separation of variables won’t apply.

Find the particular solution to the differential equation

dxdy​=ex−y

With initial condition: y(0)=ln(5)

Step 1: Rewrite the equation to separate the variables

Start by rewriting the exponential so the x and y parts are separated:

dxdy​=ex−y=eyex​

A reliable way to separate variables is:

  • multiply both sides by dx
  • move the y-expression to the side with dy

Multiply both sides by ey:

eydy=exdx

Step 2: Integrate both sides

∫eydy=∫exdx

ey=ex+C

Step 3: Apply the initial condition if given

If no initial condition is given, you would solve for y to get a general solution. Here, the initial condition is (x,y)=(0,ln(5)), so substitute it to find C:

eln(5)=e0+C

5=1+C

C=4

So the equation becomes

ey=ex+4

Now solve for y by taking the natural log of both sides:

ln(ey)=ln(ex+4)

y=ln(ex+4)​

Examples

  1. Find the general solution to

dxdy​=y+yx2

Solution

(spoiler)

First, factor the right-hand side so it’s written as a product:

dxdy​=y(1+x2)

Now separate the variables. Multiply by dx, then divide by y:

y1​dy=(1+x2)dx

Integrate both sides:

∫y1​dy=∫(1+x2)dx

ln∣y∣=x+3x3​+C

Solve for y by exponentiating both sides:

eln∣y∣=ex+x3/3+C

∣y∣=ex+x3/3+C

Absorb the sign into the constant (since ±eC is still an arbitrary nonzero constant). This gives the standard general-solution form:

y=Cex+x3/3​

  1. Find the particular solution to

dxdy​=xy2

with y(0)=1.

Solution

(spoiler)

Separate the variables:

y21​dy=xdx

Integrate both sides:

∫y21​dy=∫xdx

−y1​=2x2​+C

Use the initial condition (x,y)=(0,1) to find C:

−11​=202​+C

C=−1

Substitute C=−1 and solve for y:

−y1​=2x2​−1

Multiply both sides by y:

−1=(2x2​−1)y

Divide:

y=2x2​−1−1​=2x2−2​−1​

y=−x2−22​​

  1. Find the particular solution to

dxdy​=y+1

with y(2)=0

Solution

(spoiler)

Separate the variables:

y+11​dy=dx

Integrate both sides. (On the left, you can use u-substitution with u=y+1.)

∫y+11​dy=∫1dx

ln(y+1)=x+C

Use the initial condition (x,y)=(2,0) to find C:

ln(0+1)=2+C

0=2+C

C=−2

Substitute C=−2 and solve for y:

ln(y+1)=x−2

eln(y+1)=ex−2

y+1=ex−2

y=ex−2−1​

  1. If

dtdy​=y2t+1​

and y=2 when t=0, find y when t=1.

Solution

(spoiler)

Even though the variables are y and t (instead of y and x), the separation steps are the same.

Separate the variables:

ydy=(2t+1)dt

Integrate both sides:

∫ydy=∫(2t+1)dt

2y2​=t2+t+C

Use the initial condition y=2 when t=0 to find C:

222​=02+0+C

2=C

So

2y2​=t2+t+2

y2=2t2+2t+4

y=±2t2+2t+4​

Note: The initial condition y(0)=2 tells you y is positive at t=0, so you take the positive branch:

y=2t2+2t+4​

Now evaluate at t=1:

y=2(1)2+2(1)+4​

=2+2+4​

=22​

Lastly, here is a problem similar to a multi-part free-response question from the 2022 AB exam:

Consider the differential equation

dxdy​=πcos(πx)y​

Let y=f(x) be the particular solution to the differential equation with initial condition f(1)=4.

a) Write an equation for the line tangent to the solution curve at the point (1,4) and use it to approximate f(0.9).

b) Given f′′(x)<0 for −1≤x≤1, is the approximation from part a) an overestimate or underestimate for f(0.9)?

c) Use separation of variables to find the particular solution to the differential equation with initial condition f(1)=4.

Solutions

a) Equation of tangent line at (1,4)

(spoiler)

The equation of the tangent line to y=f(x) at (a,f(a)) is

y−f(a)=f′(a)(x−a)

Here, (a,f(a))=(1,4). To find f′(1), evaluate the differential equation at x=1 and y=4:

dxdy​​x=1,y=4​=πcos(π⋅1)4​

=π(−1)(2)

=−2π

So the tangent line is

y−4=−2π(x−1)​

To approximate f(0.9), plug x=0.9 into the tangent line:

y−4=−2π(0.9−1)

y=−2π(−0.1)+4

f(0.9)≈0.2π+4​

b) Underapproximate or overapproximate?

(spoiler)

Since f′′(x)<0 on −1≤x≤1, the graph is concave down on that interval.

For a concave down function, the tangent line lies above the curve. That means the tangent-line (linear) approximation from part (a) is an overestimate of f(0.9).

c) Particular solution with f(1)=4

(spoiler)

Separate the variables:

y​1​dy=πcos(πx)dx

Integrate both sides:

∫y​1​dy=∫πcos(πx)dx

Rewrite the left integrand as a power:

∫y−1/2dy=sin(πx)+C

2y1/2=sin(πx)+C

Use the initial condition (1,4) to find C:

24​=sin(π⋅1)+C

4=0+C

C=4

Now solve for y:

2y1/2=sin(πx)+4

y1/2=21​sin(πx)+2

y=(21​sin(πx)+2)2​

Separation of variables

  • Used for first-order differential equations of the form dxdy​=f(x)g(y)
  • Rearrange to isolate y-terms with dy and x-terms with dx
  • Integrate both sides to solve

Applying initial conditions

  • Substitute given (x,y) values after integrating to solve for the constant C
  • Plug C back into the general solution for the particular solution

Example 1: dxdy​=ex−y, y(0)=ln(5)

  • Separate: eydy=exdx
  • Integrate: ey=ex+C
  • Apply initial condition: C=4
  • Solution: y=ln(ex+4)

Example 2: dxdy​=y+yx2

  • Factor: y(1+x2)
  • Separate: y1​dy=(1+x2)dx
  • Integrate: ln∣y∣=x+3x3​+C
  • General solution: y=Cex+x3/3

Example 3: dxdy​=xy2, y(0)=1

  • Separate: y21​dy=xdx
  • Integrate: −y1​=2x2​+C
  • Apply initial condition: C=−1
  • Solution: y=−x2−22​

Example 4: dxdy​=y+1, y(2)=0

  • Separate: y+11​dy=dx
  • Integrate: ln(y+1)=x+C
  • Apply initial condition: C=−2
  • Solution: y=ex−2−1

Example 5: dtdy​=y2t+1​, y(0)=2

  • Separate: ydy=(2t+1)dt
  • Integrate: 2y2​=t2+t+C
  • Apply initial condition: C=2
  • Solution: y=2t2+2t+4​
  • At t=1: y=22​

Tangent line approximation and concavity

  • Tangent line at (x0​,y0​): y−y0​=f′(x0​)(x−x0​)
  • If f′′(x)<0, function is concave down
    • Tangent line overestimates function near x0​

Example 6: dxdy​=πcos(πx)y​, f(1)=4

  • Tangent line at (1,4): y−4=−2π(x−1)
  • Approximate f(0.9): f(0.9)≈0.2π+4
  • Concavity: f′′(x)<0 implies tangent overestimates f(0.9)
  • Separate: y​1​dy=πcos(πx)dx
  • Integrate: 2y1/2=sin(πx)+C
  • Apply initial condition: C=4
  • Solution: y=(21​sin(πx)+2)2

Sign up for free to take 5 quiz questions on this topic

All rights reserved ©2016 - 2026 Achievable, Inc.

Separation of variables

What you’ll learn:

  • How to solve first-order differential equations using separation of variables
  • How to apply initial conditions to find a particular solution

So far, you’ve seen differential equations like

dxdy​=2x

which you can solve by integrating both sides with respect to x. When the right-hand side depends on both x and y, a common method is separation of variables.

The idea is to rewrite the equation so that:

  • all y-terms (and dy) are on one side
  • all x-terms (and dx) are on the other side

This works when the differential equation can be written in the form

dxdy​=f(x)⋅g(y)

If you can’t rewrite it as a product of a function of x and a function of y, then separation of variables won’t apply.

Find the particular solution to the differential equation

dxdy​=ex−y

With initial condition: y(0)=ln(5)

Step 1: Rewrite the equation to separate the variables

Start by rewriting the exponential so the x and y parts are separated:

dxdy​=ex−y=eyex​

A reliable way to separate variables is:

  • multiply both sides by dx
  • move the y-expression to the side with dy

Multiply both sides by ey:

eydy=exdx

Step 2: Integrate both sides

∫eydy=∫exdx

ey=ex+C

Step 3: Apply the initial condition if given

If no initial condition is given, you would solve for y to get a general solution. Here, the initial condition is (x,y)=(0,ln(5)), so substitute it to find C:

eln(5)=e0+C

5=1+C

C=4

So the equation becomes

ey=ex+4

Now solve for y by taking the natural log of both sides:

ln(ey)=ln(ex+4)

y=ln(ex+4)​

Examples

  1. Find the general solution to

dxdy​=y+yx2

Solution

(spoiler)

First, factor the right-hand side so it’s written as a product:

dxdy​=y(1+x2)

Now separate the variables. Multiply by dx, then divide by y:

y1​dy=(1+x2)dx

Integrate both sides:

∫y1​dy=∫(1+x2)dx

ln∣y∣=x+3x3​+C

Solve for y by exponentiating both sides:

eln∣y∣=ex+x3/3+C

∣y∣=ex+x3/3+C

Absorb the sign into the constant (since ±eC is still an arbitrary nonzero constant). This gives the standard general-solution form:

y=Cex+x3/3​

  1. Find the particular solution to

dxdy​=xy2

with y(0)=1.

Solution

(spoiler)

Separate the variables:

y21​dy=xdx

Integrate both sides:

∫y21​dy=∫xdx

−y1​=2x2​+C

Use the initial condition (x,y)=(0,1) to find C:

−11​=202​+C

C=−1

Substitute C=−1 and solve for y:

−y1​=2x2​−1

Multiply both sides by y:

−1=(2x2​−1)y

Divide:

y=2x2​−1−1​=2x2−2​−1​

y=−x2−22​​

  1. Find the particular solution to

dxdy​=y+1

with y(2)=0

Solution

(spoiler)

Separate the variables:

y+11​dy=dx

Integrate both sides. (On the left, you can use u-substitution with u=y+1.)

∫y+11​dy=∫1dx

ln(y+1)=x+C

Use the initial condition (x,y)=(2,0) to find C:

ln(0+1)=2+C

0=2+C

C=−2

Substitute C=−2 and solve for y:

ln(y+1)=x−2

eln(y+1)=ex−2

y+1=ex−2

y=ex−2−1​

  1. If

dtdy​=y2t+1​

and y=2 when t=0, find y when t=1.

Solution

(spoiler)

Even though the variables are y and t (instead of y and x), the separation steps are the same.

Separate the variables:

ydy=(2t+1)dt

Integrate both sides:

∫ydy=∫(2t+1)dt

2y2​=t2+t+C

Use the initial condition y=2 when t=0 to find C:

222​=02+0+C

2=C

So

2y2​=t2+t+2

y2=2t2+2t+4

y=±2t2+2t+4​

Note: The initial condition y(0)=2 tells you y is positive at t=0, so you take the positive branch:

y=2t2+2t+4​

Now evaluate at t=1:

y=2(1)2+2(1)+4​

=2+2+4​

=22​

Lastly, here is a problem similar to a multi-part free-response question from the 2022 AB exam:

Consider the differential equation

dxdy​=πcos(πx)y​

Let y=f(x) be the particular solution to the differential equation with initial condition f(1)=4.

a) Write an equation for the line tangent to the solution curve at the point (1,4) and use it to approximate f(0.9).

b) Given f′′(x)<0 for −1≤x≤1, is the approximation from part a) an overestimate or underestimate for f(0.9)?

c) Use separation of variables to find the particular solution to the differential equation with initial condition f(1)=4.

Solutions

a) Equation of tangent line at (1,4)

(spoiler)

The equation of the tangent line to y=f(x) at (a,f(a)) is

y−f(a)=f′(a)(x−a)

Here, (a,f(a))=(1,4). To find f′(1), evaluate the differential equation at x=1 and y=4:

dxdy​​x=1,y=4​=πcos(π⋅1)4​

=π(−1)(2)

=−2π

So the tangent line is

y−4=−2π(x−1)​

To approximate f(0.9), plug x=0.9 into the tangent line:

y−4=−2π(0.9−1)

y=−2π(−0.1)+4

f(0.9)≈0.2π+4​

b) Underapproximate or overapproximate?

(spoiler)

Since f′′(x)<0 on −1≤x≤1, the graph is concave down on that interval.

For a concave down function, the tangent line lies above the curve. That means the tangent-line (linear) approximation from part (a) is an overestimate of f(0.9).

c) Particular solution with f(1)=4

(spoiler)

Separate the variables:

y​1​dy=πcos(πx)dx

Integrate both sides:

∫y​1​dy=∫πcos(πx)dx

Rewrite the left integrand as a power:

∫y−1/2dy=sin(πx)+C

2y1/2=sin(πx)+C

Use the initial condition (1,4) to find C:

24​=sin(π⋅1)+C

4=0+C

C=4

Now solve for y:

2y1/2=sin(πx)+4

y1/2=21​sin(πx)+2

y=(21​sin(πx)+2)2​

Key points

Separation of variables

  • Used for first-order differential equations of the form dxdy​=f(x)g(y)
  • Rearrange to isolate y-terms with dy and x-terms with dx
  • Integrate both sides to solve

Applying initial conditions

  • Substitute given (x,y) values after integrating to solve for the constant C
  • Plug C back into the general solution for the particular solution

Example 1: dxdy​=ex−y, y(0)=ln(5)

  • Separate: eydy=exdx
  • Integrate: ey=ex+C
  • Apply initial condition: C=4
  • Solution: y=ln(ex+4)

Example 2: dxdy​=y+yx2

  • Factor: y(1+x2)
  • Separate: y1​dy=(1+x2)dx
  • Integrate: ln∣y∣=x+3x3​+C
  • General solution: y=Cex+x3/3

Example 3: dxdy​=xy2, y(0)=1

  • Separate: y21​dy=xdx
  • Integrate: −y1​=2x2​+C
  • Apply initial condition: C=−1
  • Solution: y=−x2−22​

Example 4: dxdy​=y+1, y(2)=0

  • Separate: y+11​dy=dx
  • Integrate: ln(y+1)=x+C
  • Apply initial condition: C=−2
  • Solution: y=ex−2−1

Example 5: dtdy​=y2t+1​, y(0)=2

  • Separate: ydy=(2t+1)dt
  • Integrate: 2y2​=t2+t+C
  • Apply initial condition: C=2
  • Solution: y=2t2+2t+4​
  • At t=1: y=22​

Tangent line approximation and concavity

  • Tangent line at (x0​,y0​): y−y0​=f′(x0​)(x−x0​)
  • If f′′(x)<0, function is concave down
    • Tangent line overestimates function near x0​

Example 6: dxdy​=πcos(πx)y​, f(1)=4

  • Tangent line at (1,4): y−4=−2π(x−1)
  • Approximate f(0.9): f(0.9)≈0.2π+4
  • Concavity: f′′(x)<0 implies tangent overestimates f(0.9)
  • Separate: y​1​dy=πcos(πx)dx
  • Integrate: 2y1/2=sin(πx)+C
  • Apply initial condition: C=4
  • Solution: y=(21​sin(πx)+2)2