# Math Help - first order differential equation

1. ## first order differential equation

Solve the following equation

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

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

$
\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

$
\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}
$

$
= 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

$
\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}
$

$
\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}
$

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

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

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

$
\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

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

However the answer to the problem is $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

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

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

$
\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

$
\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}
$

$
= 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

$
\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}
$

$
\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}
$

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

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

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

$
\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

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

However the answer to the problem is $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?
$0 = \frac{1}{{1 + 1}}\left( {1 + \ln (1) + C} \right)$

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

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

3. stupid little mistake I make.

Thanks Mr Fantastic