Integrating Factor

1. Jul 12, 2007

Bucky

1. The problem statement, all variables and given/known data
Use the integrating factor to solve the first order differential equation

dy/dx + (2/x)y = 1 - 2/x

subject to the initial condition y(1) = 2

3. The attempt at a solution

I have the full answer (it's an example), but my lecturer is notorious for omitting steps, to my constant irritation. It might be fine for pure mathmaticians, but for some of us comp sci fakers, it makes everything much more difficult
$P = \frac{2}{x}$
$Q = 1-\frac{2}{x}? or just \frac{2}{x} ?$
Integrating factor is therefore
$F = e^{2 \int \frac{1}{x}} ... F = x^2$

Upon multiplying by $F = x^2$, we find

$x^2 \frac{dy}{dx} + 2xy= x^2 - 2x$

Where does the 2xy go?
$((x^2) y)' = x^2 + 2x$
so that
$x^2 y = \int (x^2 - 2x) dx$

$x^2y = \frac{x^3}{3} - x^2 + C$
when x = 1, y = 2

$x^2 y = \frac{x^3}{3} - x^2 + C 2 = \frac{1}{3} -1 + C C = \frac{8}{3}$

therefore, sollution is
$y = \frac{x}{3} - x + \frac {8}{3x^2}$

where did the x^2 come from at the end?

Last edited: Jul 12, 2007
2. Jul 12, 2007

olgranpappy

The point of the integrating factor is that you make the LHS of the equation look like the total derivative with respect to x of something. Consider this function:
$$f=yx^2$$
y is a function of x, and x^2 is a function of x. what is the derivative of f? Use the product rule:
$$\frac{df}{dx}=\frac{dy}{dx}x^2+y\frac{d(x^2)}{dx}$$
but of course I know the derivative of x^2 with respect to x, it's just 2x. I.e.
$$\frac{df}{dx}=\frac{dy}{dx}x^2+y2x$$

In other words, I can rewrite
$$\frac{dy}{dx}x^2+2xy$$
as
$$\frac{d(yx^2)}{dx}$$

...that's where the 2x went.

3. Jul 12, 2007

olgranpappy

...so, now I have
$$\frac{d(yx^2)}{dx}=x^2-2x$$
then the integral of the LHS is trivial
$$yx^2=\int (x^2-2x)$$
...and, well, the integral of the RHS is easy too
$$yx^2=\frac{x^3}{3}-x^2+C$$

so then, dividing both sides by x^2 I find
$$y=\frac{x}{3}-1+\frac{C}{x^2}$$

with C=8/3 this is
$$y=\frac{x}{3}-1+\frac{8}{3x^2}$$