3.3.7.3 Example 3
dydx=2(2yx)x+yy(0)=2

Let y=ux or u=yx, hence dydx=xdudx+u and the above ode becomes

xdudx+u=2(2uxx)x+uxxdudx+u=2(2u1)1+uxdudx=2(2u1)1+uu=2(2u1)u(1+u)1+u=u2+3u21+u

This is separable

1+uu2+3u2du=1xdxu2+3u21+u0

Integrating

1+uu2+3u2du=1xdx3ln(u2)+2ln(u1)=lnx+c

Replacing u=yx gives

3ln(yx2)+2ln(yx1)=lnx+c3ln(y2xx)+2ln(yxx)=lnx+c(1)ln(xy2x)3+ln(yxx)2=lnx+c

Singular solution is when u2+3u21+u=0 or u=1,u=2. This implies y=x,y=2x. Hence the solutions are

ln(xy2x)3+ln(yxx)2=lnx+cy=xy=2x

Note on the power rule for log. nln(m)=ln(mn) is valid for m>0 and in real domain. So in this above we implicitly assumed this is true in order to write 3ln(y2xx) as ln(xy2x)3. Now, taking exponential of (1) gives

(xy2x)3(yxx)2=c1xx3(y2x)3(yx)2x2=c1xx(yx)2(y2x)3=c1x(2)(yx)2(y2x)3=c1

At y(0)=2 then

(2)2(2)3=c112=c1

Hence the solution from (2) becomes

(yx)2(y2x)3=12

It is important in these kind of problems where left side has ln as function of y(x) is to take exponential. Lets see what happens of we do not. Starting again from (1) and let us try to solve for IC from (1) as is

ln(xy2x)3+ln(yxx)2=lnx+c

At y(0)=2 the above becomes

ln(0)3+ln(20)2=ln0+c

We see this will not work. These types of issues are easy to work around when solving by hand and looking at equations. But very hard to program since the code has to handle any form of expression.