# Thread: first order differential equation

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.

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

so:

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

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

so:

$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,
$y'+\frac{y}{x}=\frac{1}{x}$
We want to solve this on some open interval excluding zero.

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

Thus, the general solution is,
$y=\frac{1}{x} \left( \int x\cdot \frac{1}{x} dx \right)$= $\frac{1}{x}\left( x+C\right)$.
Thus,
$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 $y=y_0$ at $x=x_0$, you have:

$A=x_0(y_0-1)$

or if you are ImPerfectHacker:

$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,
$y(2)=1$
Then, since,
$y=1+\frac{C}{x}$
We substitute,
$x=2$ and $y=1$.
Thus,
$1=2+\frac{C}{2}$
Solve,
$C=-2$
And have the solution is,
$y=1-\frac{2}{x}$
Which satisfies this differencial equation.