1. first order differential equation

Solve for dy/dx+y/x=1/x

I'd like to see the correct way to solve it. I did it a ridiculous way and ended up with the answer, but I don't want to spend so much time next time.

General formula is y=e^-(P(x)dx)*int[(Q(x)e^(P(x)dx)dx], no?

P(x)y=y/x so P(x)=1/x
Q(x)=1/x so Q(x)=1/x as well
the integrating factor is = e^int[(P(x)dx)] = e^int[1/x] = e^[ln(x)] = x ... right?

I should just be able to plug in and solve, right?

2. Originally Posted by thedoge
Solve for dy/dx+y/x=1/x

I'd like to see the correct way to solve it. I did it a ridiculous way and ended up with the answer, but I don't want to spend so much time next time.

General formula is y=e^-(P(x)dx)*int[(Q(x)e^(P(x)dx)dx], no?

P(x)y=y/x so P(x)=1/x
Q(x)=1/x so Q(x)=1/x as well
the integrating factor is = e^int[(P(x)dx)] = e^int[1/x] = e^[ln(x)] = x ... right?

I should just be able to plug in and solve, right?
It's of variables seperable type.

$\displaystyle \frac{dy}{dx}=\frac{1}{x}(1-y)$

so:

$\displaystyle \int \frac{1}{(1-y)} \,dy=\int \frac{1}{x}\,dx$

$\displaystyle -\ln(1-y)=\ln(x) + C$

so:

$\displaystyle y=1+A/x$

RonL

RonL

3. Originally Posted by thedoge
Solve for dy/dx+y/x=1/x
This is first order linear differencial equation, solves easily.

You have,
$\displaystyle y'+\frac{y}{x}=\frac{1}{x}$
We want to solve this on some open interval excluding zero.

The integrating factor is,
$\displaystyle \exp \left( \int \frac{1}{x} dx \right)=\exp (\ln |x|)=|x|$
I will assume the interval is $\displaystyle (0,\infty)$ in that case,
$\displaystyle |x|=x$.

Thus, the general solution is,
$\displaystyle y=\frac{1}{x} \left( \int x\cdot \frac{1}{x} dx \right)$=$\displaystyle \frac{1}{x}\left( x+C\right)$.
Thus,
$\displaystyle y=1+\frac{C}{x}$ are all solutions.

4. What would need to be done additionally if you had initial conditions where x and y were constants?

5. Originally Posted by thedoge
What would need to be done additionally if you had initial conditions where x and y were constants?
The initial condition determine the arbitary constant, so if you have initial
condition $\displaystyle y=y_0$ at $\displaystyle x=x_0$, you have:

$\displaystyle A=x_0(y_0-1)$

or if you are ImPerfectHacker:

$\displaystyle C=x_0(y_0-1)$

RonL

6. Originally Posted by thedoge
What would need to be done additionally if you had initial conditions where x and y were constants?
If the initial condition was,
$\displaystyle y(2)=1$
Then, since,
$\displaystyle y=1+\frac{C}{x}$
We substitute,
$\displaystyle x=2$ and $\displaystyle y=1$.
Thus,
$\displaystyle 1=2+\frac{C}{2}$
Solve,
$\displaystyle C=-2$
And have the solution is,
$\displaystyle y=1-\frac{2}{x}$
Which satisfies this differencial equation.