# Thread: how to avoid a negative logarithm?

1. ## how to avoid a negative logarithm?

Hi folks,

I am trying to solve a simple separable first order differential equation, but the issue is really algebra.

$\dfrac{dy}{dx} = \dfrac {y(x^2 + 1)}{(x^2 - 1)}$ with the boundary condition $y = 2$, when $x = 0$

so

$\int \dfrac{dy}{y} = \int \dfrac{x^2 + 1}{x^2 - 1} dx$

$\int \dfrac{dy}{y} = \int \dfrac{(x^2 - 1) + 2}{x^2 - 1} dx$

$\int \dfrac{dy}{y} = \int (1 + \dfrac{2}{x^2 - 1)} dx$

$\ln y = x + \int \dfrac{2}{(x + 1)(x - 1)} dx$

using partial fractions

$\dfrac{2}{(x + 1)(x - 1)} = \dfrac{A}{(x + 1)} + \dfrac{B}{(x - 1)}$

A = -1, B = 1

so

$\int \dfrac{2}{(x - 1)(x + 1)} dx = \int \dfrac{1}{(x - 1)} - \dfrac{1}{(x + 1)} dx$

$\ln y = x + \ln (x - 1) - \ln (x + 1) + c$ where c is the constant of integration.

$\ln y = x + \ln \dfrac{(x - 1)}{(x + 1)} + c$

Now, this is the problem. If I put y = 2 and x = 0 to evaluate c, the log term is negative. I am sure there is a simple way of reorganising, but I just can't see it.

Can anyone help?

2. ## Re: how to avoid a negative logarithm?

Your error is that $\displaystyle \int \frac{1}{x}dx$ is NOT "$\displaystyle ln(x)$", it is $\displaystyle ln(|x|)$.

3. ## Re: how to avoid a negative logarithm?

Originally Posted by s_ingram

Can anyone help?
Subject heading: "how to avoid a negative logarithm?"

s_ingram, you are not talking about negative logarithms. You are talking about logarithms of negative numbers.

Originally Posted by HallsofIvy
$\displaystyle \int \frac{1}{x}dx$ is NOT "$\displaystyle ln(x)$", it is $\displaystyle ln(|x|)$
$\displaystyle \int \frac{1}{x}dx \ = \ ln|x| \ + \ C \ \ \ \ \ \$ (where the absolute value bars are sufficient as grouping symbols).

4. ## Re: how to avoid a negative logarithm?

Thanks for the correction.