2.1.24 \(x f_y - f_x = \frac {g(x)}{h(y)} f^2\)

problem number 24

Taken from Maple pdsolve help pages

General solution of a first order nonlinear PDE

Solve for \(f(x,y)\) \begin {align*} x f_y - f_x = \frac {g(x)}{h(y)} f^2 \end {align*}

Mathematica

ClearAll["Global`*"]; 
pde = x*D[f[x, y], y] - D[f[x, y], x] == (f[x, y]^2*g[x])/h[y]; 
sol =  AbsoluteTiming[TimeConstrained[DSolve[pde, f[x, y], {x, y}], 60*10]];
 

\[\left \{\left \{f(x,y)\to -\frac {1}{\int _1^x-\frac {g(K[1])}{h\left (\frac {x^2}{2}-\frac {K[1]^2}{2}+y\right )}dK[1]+c_1\left (\frac {x^2}{2}+y\right )}\right \}\right \}\]

Maple

restart; 
pde := x*diff(f(x,y),y)-diff(f(x,y),x)=f(x,y)^2*g(x)/h(y); 
cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol',pdsolve(pde,f(x,y))),output='realtime'));
 

\[f \left ( x,y \right ) = \left ( \int ^{x}\!{\frac {g \left ( {\it \_a} \right ) }{h \left ( -1/2\,{{\it \_a}}^{2}+1/2\,{x}^{2}+y \right ) }}{d{\it \_a}}+{\it \_F1} \left ( 1/2\,{x}^{2}+y \right ) \right ) ^{-1}\]

Hand solution

Solve for \(f\left ( x,y\right ) \) in \(xf_{y}-f_{x}=\frac {g\left ( x\right ) }{h\left ( y\right ) }f^{2}.\) Using the Lagrange-charpit method, the characteristic equations are\[ \frac {dy}{x}=\frac {-dx}{1}=\frac {df}{\frac {g\left ( x\right ) }{h\left ( y\right ) }f^{2}}\] From the first pair of equation we obtain\begin {align} dy & =-xdx\nonumber \\ y & =-\frac {x^{2}}{2}+C_{1}\nonumber \\ C_{1} & =y+\frac {x^{2}}{2}\tag {1} \end {align}

Using \(-dx=\frac {df}{\frac {g\left ( x\right ) }{h\left ( y\right ) }f^{2}}\) as choice of the second pair of equations. Hence \(\frac {df}{f^{2}}=-\frac {g\left ( x\right ) }{h\left ( y\right ) }dx\). But from (1) \(y=C_{1}-\frac {x^{2}}{2}\), therefore\[ \frac {df}{f^{2}}=-\frac {g\left ( x\right ) }{h\left ( C_{1}-\frac {x^{2}}{2}\right ) }dx \] Integrating gives\begin {align*} -\frac {1}{f} & =-\int _{0}^{x}\frac {g\left ( s\right ) }{h\left ( C_{1}-\frac {s^{2}}{2}\right ) }ds+C_{2}\\ C_{2} & =-\frac {1}{f}+\int _{0}^{x}\frac {g\left ( s\right ) }{h\left ( C_{1}-\frac {s^{2}}{2}\right ) }ds \end {align*}

But \(C_{2}=F\left ( C_{1}\right ) \) where \(F\) is arbitrary function. Therefore\begin {align*} -\frac {1}{f}+\int _{0}^{x}\frac {g\left ( s\right ) }{h\left ( C_{1}-\frac {s^{2}}{2}\right ) }ds & =F\left ( y+\frac {x^{2}}{2}\right ) \\ -\frac {1}{f} & =F\left ( \frac {1}{2}\left ( 2y+x^{2}\right ) \right ) -\int _{0}^{x}\frac {g\left ( s\right ) }{h\left ( C_{1}-\frac {s^{2}}{2}\right ) }ds\\ \frac {1}{f} & =\int _{0}^{x}\frac {g\left ( s\right ) }{h\left ( C_{1}-\frac {s^{2}}{2}\right ) }ds-F\left ( \frac {1}{2}\left ( 2y+x^{2}\right ) \right ) \\ f & =\frac {1}{\int _{0}^{x}\frac {g\left ( s\right ) }{h\left ( C_{1}-\frac {s^{2}}{2}\right ) }ds-F\left ( \frac {1}{2}\left ( 2y+x^{2}\right ) \right ) } \end {align*}

But \(C_{1}=\frac {1}{2}\left ( 2y+x^{2}\right ) \) and the above becomes\[ f\left ( x,y\right ) =\frac {1}{\int _{0}^{x}\frac {g\left ( s\right ) }{h\left ( \frac {1}{2}\left ( 2y+x^{2}\right ) -\frac {s^{2}}{2}\right ) }ds-F\left ( \frac {1}{2}\left ( 2y+x^{2}\right ) \right ) }\]

____________________________________________________________________________________