1

I often seem to get caught out when integrating $1/x$ to $\log x$, or similar. Here's an example -- solve $$ \frac{\mathrm{d}z}{\mathrm{d}x} + \frac{1}{2}z = \frac{1}{2}$$

My first attempt was using separation of variables, which proceeds as follows: $$ \frac{\mathrm{d}z}{\mathrm{d}x} = - \frac{1}{2} (z-1)$$ $$ \int \frac{1}{z-1}\mathrm{d}x = - \frac{1}{2} $$ $$ \log |z-1| = - \frac{1}{2}x + c_1$$ $$ |z-1| = c_2 e^{- x/2}$$

but the text I'm following has $z = c_2 e^{- \frac{1}{2}x} + 1$. This is found fairly easily through integration by parts, using an integrating factor of $p = \exp(\int \mathrm{d}x/2) = \exp(x/2)$. $$ \frac{\mathrm{d}z}{\mathrm{d}x}e^{x/2} + \frac{1}{2}ze^{x/2} = \frac{1}{2}e^{x/2}$$ $$ \frac{\mathrm{d}}{\mathrm{d}x} (ze^{x/2}) = \frac{1}{2}e^{x/2} $$ $$ ze^{x/2} = e^{x/2} + c_2 $$ $$ z = c_2 e^{-x/2} + 1 $$

Obviously, if I ignore the modulus signs in the first case, the first and second answers are exactly the same. Alternatively if I proceed using the integrating factor approach the issue doesn't arise. Neither approach seem very satisfactory though. What am I missing, and any advice from experience as to how to minimize the pain in addressing these kinds of problems?

TooTone
  • 6,343

1 Answers1

3

You have $|z-1| = c_2 e^{-x/2}$ where $c_2$ is an arbitrary constant. Thus either $z-1 = c_2 e^{-x/2}$ which simplifies to $z = 1 + c_2 e^{-x/2}$ or $1-z = c_2 e^{-x/2}$ which simplifies to $z = 1 - c_2 e^{-x/2}$. Since $c_2$ is arbitrary, both $c_2$ and $-c_2$ represent an unspecified constant. The two solutions are identical.

Umberto P.
  • 52,165
  • thankyou. What I still don't understand is that you have a single arbitrary constant in the second, integrating factor case, $z=c_2e^{-x/2}+1$. How can it take on both a positive and a negative value simultaneously as the constant $c_3$ does in the first, integration by separation case, $z=1+c_3e^{-x/2}$, where $c_3=\pm c_2$? – TooTone Nov 19 '13 at 14:27
  • 1
    The constant only takes one value. When you use an integrating factor the constant can be any real value (in practice it depends on the initial condition). When you separate variables to get $|z-1| = c_2 e^{-x/2}$ the constant $c_2$ must be nonnegative. The solution you choose ($z-1$ vs $1-z$) depends on the initial condition. – Umberto P. Nov 19 '13 at 15:07