# another differential

#### Beard

Hi, again

I am slightly confused by what the questions is asking here.

Solve the differential to find y

$$\displaystyle \frac{dy}{dx} = xy(1 - y)$$ subject to y = 0.5 when x = 0. What is the purpose of the 'subject....' part?

#### GeoC

The "Subject to...." is giving you the boundary conditions needed to solve the problem.

#### Beard

What is the point working it out if you already have the y value, is it just to get another y value at the end???

#### HallsofIvy

MHF Helper
You don't have "the y value". y is a function of x. Telling you that "y(0)= 0.5" only tells you its value for one value of x. You want to find the entire function.

This is a "separable" equation. If $$\displaystyle \frac{dy}{dx}= xy(1- y)$$ then $$\displaystyle \frac{dy}{y(1-y)}= xdx$$. Integrate both sides of that (use "partial fractions" on the left) to get y as a function of x. When you integrate, you will get a "constant of integration". You can use y(0)= .5 to determine what that constant should be.

• Beard

#### GeoC

BTW, when I solve this I obtain $$\displaystyle y/(1-y) = C*e^{x^2/2}$$. The boundary condition y=0.5 at x=0 gives C=1.

• Beard

#### Prove It

MHF Helper
What is the point working it out if you already have the y value, is it just to get another y value at the end???
It's because when you integrate a function, the solution is a FAMILY of functions, due to there being an integration constant. The point of having a boundary condition is that you can solve for the integration constant.

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

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

Using partial fractions:

$$\displaystyle \frac{A}{y} + \frac{B}{1 - y} = \frac{1}{y\,(1 - y)}$$

$$\displaystyle \frac{A(1 - y) + B\,y}{y\,(1 - y)} = \frac{1}{y\,(1 - y)}$$

$$\displaystyle A(1 - y) + B\,y = 1$$

$$\displaystyle (B - A)\,y + A = 0\,y + 1$$.

Equating like coefficients gives

$$\displaystyle B - A = 0$$ and $$\displaystyle A = 1$$.

So $$\displaystyle B = 1$$.

Therefore $$\displaystyle \frac{1}{y\,(1 - y)} = \frac{1}{y} + \frac{1}{1 - y}$$.

Back to the DE:

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

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

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

$$\displaystyle \int{\left(\frac{1}{y} + \frac{1}{1 - y}\right)\,dy} = \frac{1}{2}\,x^2 + C_1$$

$$\displaystyle \ln{|y|} - \ln{|1 - y|} + C_2 = \frac{1}{2}\,x^2 + C_1$$

$$\displaystyle \ln{\left|\frac{y}{1 - y}\right|} = \frac{1}{2}\,x^2 + C$$ where $$\displaystyle C = C_1 - C_2$$

$$\displaystyle \ln{\left|\frac{y - 1 + 1}{1 - y}\right|} = \frac{1}{2}\,x^2 + C$$

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

$$\displaystyle \ln{\left|-1 + \frac{1}{1 - y}\right|} = \frac{1}{2}\,x^2 + C$$

$$\displaystyle \left|-1 + \frac{1}{1 - y}\right| = e^{\frac{1}{2}\,x^2 + C}$$

$$\displaystyle \left|-1 + \frac{1}{1 - y}\right| = e^C\,e^{\frac{1}{2}\,x^2}$$

$$\displaystyle -1 + \frac{1}{1 - y} = A\,e^{\frac{1}{2}\,x^2}$$ where $$\displaystyle A = \pm e^{C}$$

$$\displaystyle \frac{1}{1 - y} = A\,e^{\frac{1}{2}\,x^2} + 1$$

$$\displaystyle 1 - y = \frac{1}{A\,e^{\frac{1}{2}\,x^2}}$$

$$\displaystyle y = 1 - \frac{1}{A\,e^{\frac{1}{2}\,x^2}}$$.

Now using the boundary condition that $$\displaystyle y(0) = \frac{1}{2}$$ we find

$$\displaystyle \frac{1}{2} = 1 - \frac{1}{A\,e^{\frac{1}{2}(0)^2}}$$

$$\displaystyle \frac{1}{A\,e^{0}} = 1 - \frac{1}{2}$$

$$\displaystyle \frac{1}{A} = \frac{1}{2}$$

$$\displaystyle A = 2$$.

So finally, the solution is

$$\displaystyle y = 1 - \frac{1}{2\,e^{\frac{1}{2}\,x^2}}$$

$$\displaystyle y = \frac{2\,e^{\frac{1}{2}\,x^2} - 1}{2\,e^{\frac{1}{2}\,x^2}}$$.

• Beard

#### HallsofIvy

MHF Helper
Oh, you shouldn't tell him that! Let Beard work it out himself.(Wink)

#### Prove It

MHF Helper
Oh, you shouldn't tell him that! Let Beard work it out himself.(Wink)
Judging by the OP's statements and questions, it appears that he/she hasn't had much practice with these sorts of problems. So by having a full solution, at least the OP has something to refer back to for future similar problems.

#### Beard

Oh, you shouldn't tell him that! Let Beard work it out himself.(Wink)

I had worked the integrals out before I posted its just that I was unsure of why/how the boundary conditions were used