# How to solve differential equation dy/dx = k(c - y)?

Just wondering how you would solve this kind of a differential equation.

Relevance

Assuming that k and c are just constants, the equation is separable, divide both sides by (c - y) and multiply the differential across:

1/(c - y) * dy = k * dx

Integrate both sides:

-ln(c - y) = kx + C

Make y the subject, divide both sides by -1 and raise both sides to the base of e:

c - y = e^(-kx) * e^-C

As e^-C represents a constant, we can just replace it with another constant placeholder:

c - y = C₁e^(-kx)

y = c - C₁e^(-kx)

• dy/dx = k(c - y)

dy/(c-y) = k dx for y≠c (because this would cause division by zero)

∫ dy/(c-y) = ∫k dx

-ln|c-y| = kx + c_1 where c_1 is a real constant

ln|c-y| = -kx + c_2 where c_2 = -c_1

|c-y| = e^(-kx + c_2) = c_3*e^(-kx) where c_3 = e^c_2 (c_3 is a positive number)

c-y = ±c_3*e^(-kx) = c_4 e^-(kx) where c_4 = ± c_3 (c_4 can't be zero)

y = -c_4 e^(-kx)+c

If we let c_4 = 0 we also get the valid solution y = c (you can check this by plugging it into the differential equation.)

final solution:

y = m e^(-kx) + c where m is a real constant

• dy/dx = k(c-y)

dy/(c-y) = kdx

Integrate both sides.

-ln(c-y) = kx + C

ln(1/(c-y)) = kx + C

You can then re-arrange as you wish.

Cheers!