An equation like dxdy+2y=ex can’t be separated: the y and the ex are added, not multiplied. But it is linear in y, and every linear first-order equation can be solved the same way: multiply through by a carefully chosen function, the integrating factor, and the left side becomes the derivative of a product. This is the last of the exact methods in IB Mathematics AA HL, alongside separation of variables and homogeneous equations.
A first-order differential equation is linear if it can be written in the standard form
dxdy+P(x)y=Q(x)
where P and Q are functions of x only. The coefficient of dxdy must be 1. If it isn’t, divide through first. For example, xdxdy+2y=x2 becomes dxdy+x2y=x, so P(x)=x2 and Q(x)=x.
A tank holds 50 L of pure water. Brine containing 2 g of salt per litre flows in at 3 L/min, and the well-mixed solution flows out at 2 L/min. Let S be the mass of salt (in grams) in the tank after t minutes.
(a) Explain why dtdS=6−50+t2S.
(b) Solve the differential equation, and find the concentration of salt after 50 minutes.
Solution.
(a) Salt flows in at (2 g/L)(3 L/min)=6 g/min. The volume grows by 1 L each minute, so it is 50+t litres, and the concentration is 50+tS g/L. Salt flows out at 50+tS×2 g/min. Rate of change = rate in − rate out.
(b) Standard form: dtdS+50+t2S=6. The integrating factor is
I(t)=e∫50+t2dt=e2ln(50+t)=(50+t)2
So
dtd((50+t)2S)(50+t)2S=6(50+t)2=2(50+t)3+C
At t=0 the water is pure, so S=0: 0=2(50)3+C, giving C=−250000. Then
S=2(50+t)−(50+t)2250000
At t=50: S=2(100)−10000250000=200−25=175 g, in 100 L of solution. The concentration is 1.75 g/L. (In the long run it approaches the inflow concentration of 2 g/L, which makes sense.)
Not dividing by the coefficient of dy/dx first. The integrating factor formula only works when the equation starts dxdy+…. For xdxdy+2y=x2, the P(x) is x2, not 2.
Getting the sign of P wrong. For dxdy−x2y=…, P(x)=−x2 and I(x)=e−2lnx=x−2. Move every y term to the left before reading off P.
Forgetting to multiply the right side by I(x). Both sides get multiplied. The left side becomes dxd(Iy) automatically; the right side becomes I(x)Q(x), which is what you integrate.
Dividing only part of the answer by I(x). From e2xy=31e3x+C, the solution is y=31ex+Ce−2x, not 31ex+C. The constant gets divided too, and that’s what makes the solution curves different shapes.
Not simplifying the integrating factor. Leaving I(x)=e2lnx makes the next step messy. Use log laws: e2lnx=x2.
Adding the constant too late. The +C belongs on the right as soon as you integrate. Adding it after dividing by I(x) gives the wrong family of solutions.
1. (Warm-up) For each equation, state P(x) and Q(x) and find the integrating factor, simplified.
(a) dxdy+3y=x
(b) dxdy−x1y=x2, x>0
(c) dxdy+2xy=x
Solution
(a) P(x)=3, Q(x)=x, I(x)=e3x.
(b) P(x)=−x1, Q(x)=x2, I(x)=e−lnx=x1.
(c) P(x)=2x, Q(x)=x, I(x)=ex2.
2. (Warm-up) Find the general solution of dxdy−y=e2x.
Solution
P(x)=−1, so I(x)=e−x.
dxd(e−xy)=e−xe2x=ex⇒e−xy=ex+C⇒y=e2x+Cex
3. (Warm-up) Find the general solution of dxdy+2xy=2x.
Solution
I(x)=ex2.
dxd(ex2y)=2xex2⇒ex2y=ex2+C⇒y=1+Ce−x2
(The integral ∫2xex2dx=ex2+C uses the substitution u=x2. This equation is also separable; try it that way too.)
4. (Core) Solve xdxdy−2y=x3ex, x>0, given that y=0 when x=1.
Solution
Divide by x: dxdy−x2y=x2ex. Then I(x)=e−2lnx=x−2.
dxd(x2y)=x−2⋅x2ex=ex⇒x2y=ex+C
At (1,0): 0=e+C, so C=−e and
y=x2(ex−e)
5. (Core) Solve dxdy=x−y with y(0)=2, and find y(1) to 3 s.f.
Solution
Rearrange: dxdy+y=x, so I(x)=ex.
dxd(exy)=xex
By parts, ∫xexdx=xex−ex+C. So exy=(x−1)ex+C and y=x−1+Ce−x.
At x=0: 2=−1+C, so C=3 and y=x−1+3e−x. Then y(1)=3e−1≈1.10 (3 s.f.).
(Compare with the rough estimate of 0.75 from two steps of Euler’s method for the same equation.)
6. (Core) Solve cosxdxdy+ysinx=1 for 0≤x<2π, given that y(0)=3.
Solution
Divide by cosx: dxdy+ytanx=secx. As in Example 3, I(x)=secx.
dxd(ysecx)=sec2x⇒ysecx=tanx+C⇒y=sinx+Ccosx
At x=0: 3=0+C. So y=sinx+3cosx.
7. (Core) A pollutant enters a lake, and the mass P kg of pollutant in the lake after t days satisfies
dtdP+0.1P=5e−0.05t,P(0)=0
(a) Find P in terms of t.
(b) Find the maximum mass of pollutant in the lake, and when it occurs (to 3 s.f.).
Solution
(a) I(t)=e0.1t.
dtd(e0.1tP)=5e0.05t⇒e0.1tP=100e0.05t+C
At t=0: 0=100+C, so C=−100 and
P=100(e−0.05t−e−0.1t)
(b) dtdP=100(−0.05e−0.05t+0.1e−0.1t)=0 gives e−0.05t=2e−0.1t, so e0.05t=2 and t=20ln2≈13.9 days. Then e−0.05t=21 and e−0.1t=41, so P=100(21−41)=25 kg. (It is a maximum: P starts at 0, rises, and tends to 0 again.)
8. (Challenge) Solve dxdy+xy=sinx, x>0, given that y=1 when x=π.
Solution
I(x)=elnx=x.
dxd(xy)=xsinx
By parts, with u=x and dv=sinxdx: ∫xsinxdx=−xcosx+∫cosxdx=sinx−xcosx+C. So
xy=sinx−xcosx+C
At (π,1): π=0−π(−1)+C=π+C, so C=0 and
y=xsinx−cosx
9. (Challenge) Solve (x2+1)dxdy+4xy=x, given that y(0)=0, and describe what happens to y as x→∞.
Solution
Divide by x2+1: dxdy+x2+14xy=x2+1x. Then
I(x)=e∫x2+14xdx=e2ln(x2+1)=(x2+1)2
Multiply through:
dxd((x2+1)2y)=x(x2+1)
With u=x2+1, ∫x(x2+1)dx=4(x2+1)2+C. So (x2+1)2y=4(x2+1)2+C, and
y=41+(x2+1)2C
At x=0: 0=41+C, so C=−41 and y=41−4(x2+1)21.
As x→∞, the second term tends to 0, so y→41 (from below).
Try these independently after the practice questions. Show your setup and explain your reasoning. Use exact answers where possible, and check that your answers fit the question. Homework solutions are not provided on the published site.
Any trig in these questions uses radians. Give calculator answers to 3 significant figures.
H3. (Core) Solve xdxdy+3y=5x2 for x>0, given that y=2 when x=1. Check your answer by substituting it back into the equation.
H4. (Core) Without a calculator, solve dxdy−2y=4x given that y(0)=1. Then find the exact value of y(21).
H5. (Core) Solve sinxdxdy+ycosx=sin2x for 0<x<π, given that y=3 when x=2π.
H6. (Core) A tank holds 400 L of salt water containing 30 kg of dissolved salt. Brine with a concentration of 0.05 kg/L flows in at 8 L/min, and the well-mixed solution drains out at 10 L/min. Let S be the mass of salt (in kg) in the tank after t minutes, for 0≤t<200.
(a) Explain why dtdS=0.4−200−t5S.
(b) Show that an integrating factor is (200−t)−5, and solve the differential equation.
(c) Find the mass of salt, and its concentration, when 100 L of solution remain in the tank.
(d) Show that the concentration approaches 0.05 kg/L as the tank empties, and explain why that makes sense.
H7. (Challenge) On a spring morning, the air outside an unheated shed warms steadily: t hours after 6 a.m., the outside temperature is 5+2t degrees Celsius. The temperature T °C inside the shed changes at a rate proportional to the difference between the outside and inside temperatures, and a hypothetical model is
dtdT=0.5(5+2t−T),T(0)=15
for 0≤t≤6.
(a) Solve the differential equation.
(b) Find the lowest temperature inside the shed and the time it occurs. Give the exact time and the temperature to 3 significant figures.
(c) Find the limit of the difference between the outside and inside temperatures as t→∞, and explain in words what it says about the shed later in the morning.
H8. (Challenge)(IB style) Consider dxdy=2x(1+y) with y(0)=2.
(a) Solve the equation by separation of variables.
(b) Write the equation in standard form and solve it again with an integrating factor. Confirm that you get the same answer.
A student separating the variables wrote ln∣1+y∣=x2+C, and then 1+y=ex2+C.
(c) Explain the error, and show how the general solution should look.
H9. (Challenge) Consider xdxdy+2y=3x for x>0.
(a) Find the general solution.
(b) Show that exactly one solution has a finite limit as x→0+, and state it.
(c) Find all values of the constant C in your general solution for which the solution curve has a stationary point with x>0. Give the x-coordinate of that point in terms of C.
H10. (Challenge) Let k be a constant, and consider dxdy+ky=6e2x.
(a) Find the general solution when k=−2.
(b) Explain why your method in (a) fails when k=−2, and find the general solution in that case.
(c) Find the value of k for which y=2e2x is a solution. Check it by substitution.