# Thread: first order differential equation

1. ## first order differential equation

Solve the following equation

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

Did the following to put in form y'+P(x)y=Q(x)

$\displaystyle \begin{array}{l} \frac{{dy}}{{dx}} - \frac{y}{{x(x + 1)}} = x/x \\ \frac{{dy}}{{dx}} - \frac{y}{{x(x + 1)}} = 1 \\ \frac{{dy}}{{dx}} + y\left( {\frac{{ - 1}}{{x(x + 1)}}} \right) = 1 \\ \end{array}$

Than P(x) and the integrating factor are

$\displaystyle \begin{array}{l} P(x) = \frac{{ - 1}}{{x^2 + x}} \\ I = e^{\int {P(x)dx} } = e^{\int {\frac{{ - 1}}{{x^2 + x}}} dx} = e^{ - \int {\frac{1}{{x^2 + x}}} dx} = e^{ - \int {\frac{1}{x} - \frac{1}{{x + 1}}} dx} \\ \end{array}$

$\displaystyle = e^{ - \left[ {\int {\frac{1}{x}} dx - \int {\frac{1}{{x + 1}}dx} } \right]} = e^{ - \left[ {\ln |x| - \ln |x + 1|} \right]} = e^{\frac{{\ln |x + 1|}}{{\ln |x|}}} = \frac{{x + 1}}{x}$

Multiply by integrating factor and integrate RHS

$\displaystyle \begin{array}{l} \frac{{dy}}{{dx}}(I) - \frac{y}{{x(x + 1)}}(I) = 1(I) \\ \frac{{dy}}{{dx}}\left( {\frac{{x + 1}}{x}} \right) - \frac{y}{{x(x + 1)}}\left( {\frac{{x + 1}}{x}} \right) = 1\left( {\frac{{x + 1}}{x}} \right) \\ \end{array}$

$\displaystyle \begin{array}{l} \frac{d}{{dx}}\left( {\frac{{x + 1}}{x}y} \right) = 1\left( {\frac{{x + 1}}{x}} \right) \\ \left( {\frac{{x + 1}}{x}y} \right) = \int {\left( {\frac{{x + 1}}{x}} \right)} dx \\ \end{array}$

$\displaystyle = \int {\left( {1 + \frac{1}{x}} \right)dx = \int {1dx + \int {\frac{1}{x}dx = x + \ln |x| + C} } }$

$\displaystyle \frac{{x + 1}}{x}y = x + \ln |x| + C$

So give that when x=1 y = 0, solve for C

$\displaystyle \begin{array}{l} y = \frac{x}{{x + 1}}\left( {x + \ln |x| + C} \right) \\ 0 = \frac{1}{{1 + 1}}\left( {1 + \ln (1) + C} \right) \\ 0 = \frac{1}{2} + C \\ C = - \frac{1}{2} \\ \end{array}$

and so initial value problem I worked out to be

$\displaystyle y = \frac{x}{{x + 1}}\left( {x - \frac{1}{2} + \ln x} \right)$

However the answer to the problem is $\displaystyle y = \frac{x}{{x + 1}}\left( {x - 1 + \ln x} \right)$ where they worked C= -1

Can someone tell me here what I have done wrong? Or is the answer in the text wrong?

2. Originally Posted by Craka
Solve the following equation

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

Did the following to put in form y'+P(x)y=Q(x)

$\displaystyle \begin{array}{l} \frac{{dy}}{{dx}} - \frac{y}{{x(x + 1)}} = x/x \\ \frac{{dy}}{{dx}} - \frac{y}{{x(x + 1)}} = 1 \\ \frac{{dy}}{{dx}} + y\left( {\frac{{ - 1}}{{x(x + 1)}}} \right) = 1 \\ \end{array}$

Than P(x) and the integrating factor are

$\displaystyle \begin{array}{l} P(x) = \frac{{ - 1}}{{x^2 + x}} \\ I = e^{\int {P(x)dx} } = e^{\int {\frac{{ - 1}}{{x^2 + x}}} dx} = e^{ - \int {\frac{1}{{x^2 + x}}} dx} = e^{ - \int {\frac{1}{x} - \frac{1}{{x + 1}}} dx} \\ \end{array}$

$\displaystyle = e^{ - \left[ {\int {\frac{1}{x}} dx - \int {\frac{1}{{x + 1}}dx} } \right]} = e^{ - \left[ {\ln |x| - \ln |x + 1|} \right]} = e^{\frac{{\ln |x + 1|}}{{\ln |x|}}} = \frac{{x + 1}}{x}$

Multiply by integrating factor and integrate RHS

$\displaystyle \begin{array}{l} \frac{{dy}}{{dx}}(I) - \frac{y}{{x(x + 1)}}(I) = 1(I) \\ \frac{{dy}}{{dx}}\left( {\frac{{x + 1}}{x}} \right) - \frac{y}{{x(x + 1)}}\left( {\frac{{x + 1}}{x}} \right) = 1\left( {\frac{{x + 1}}{x}} \right) \\ \end{array}$

$\displaystyle \begin{array}{l} \frac{d}{{dx}}\left( {\frac{{x + 1}}{x}y} \right) = 1\left( {\frac{{x + 1}}{x}} \right) \\ \left( {\frac{{x + 1}}{x}y} \right) = \int {\left( {\frac{{x + 1}}{x}} \right)} dx \\ \end{array}$

$\displaystyle = \int {\left( {1 + \frac{1}{x}} \right)dx = \int {1dx + \int {\frac{1}{x}dx = x + \ln |x| + C} } }$

$\displaystyle \frac{{x + 1}}{x}y = x + \ln |x| + C$

So give that when x=1 y = 0, solve for C

$\displaystyle \begin{array}{l} y = \frac{x}{{x + 1}}\left( {x + \ln |x| + C} \right) \\ 0 = \frac{1}{{1 + 1}}\left( {1 + \ln (1) + C} \right) \\ 0 = \frac{1}{2} + C \\ C = - \frac{1}{2} \\ \end{array}$

and so initial value problem I worked out to be

$\displaystyle y = \frac{x}{{x + 1}}\left( {x - \frac{1}{2} + \ln x} \right)$

However the answer to the problem is $\displaystyle y = \frac{x}{{x + 1}}\left( {x - 1 + \ln x} \right)$ where they worked C= -1

Can someone tell me here what I have done wrong? Or is the answer in the text wrong?
$\displaystyle 0 = \frac{1}{{1 + 1}}\left( {1 + \ln (1) + C} \right)$

$\displaystyle \Rightarrow 0 = \frac{1}{2}\left( {1 + C} \right)$

$\displaystyle \Rightarrow 0 = 1 + C \, ....$

3. stupid little mistake I make.

Thanks Mr Fantastic