# Problem solving a couple of ODEs

First I'm trying to make this equation exact $$\frac{\sin y}{x} dx + (\frac{y}{x} \cos y - \frac{\sin y}{y} ) dy = 0$$

The problem says to use to use an integrating factor $u(x,y)=h(\frac{x}{y})$.
To make integrating a little easier I first did a variable change using $v=\frac{x}{y}$, but that didn't help much when I had to derive it.
In general I-ve been having trouble solving most problems that require an integrating factor that involes both variables, unless it's of the form $u(x,y)=x^a y^b$ with a and b integers to be determined.
I think there's some "simple" way to solve this I'm not seeing, or knew and can't remember. If anyone has any idea, please share.

Now on to the second problem. I need to find a solution for $$y'' -y' +e^2x y = 0$$ As a note it says to consider the variable change $x = \ln t$.

By doing this I get $y'' - y' +t y = 0$, which I'm not too sure how to solve.
I gather that something's missing since as that is right now $y'= \frac{dy}{dx}$, and I need it w.r.t. $t$. So, $$y'= \frac{dy}{dx} = \frac{dy}{dt} \frac{dt}{dx} = y' \frac{1}{t}$$ $$y'' = \frac{d^2 y}{dx^2} = \frac{dy'}{dx} = \frac{dy'}{dt} \frac{dt}{dx} = y'' \frac{1}{t^2}$$

Putting all this together back in the equation I get $$\frac{y''}{t^2} - \frac{y'}{t} + ty = 0$$

Now All I can really think about this is adding everything together so $$\frac{y'' - ty' +t^3 y}{t^2} = 0$$ $$y'' - t y' + t^3 y = 0$$

Again, I'm probably not doing something right here, but if I am, I'm not sure what would be a suitable $y(t)$ to try, since it can't be $t^a$, $e^{at}$ and so on.
Again, any ideas would be more than welcomed.

EDIT: Regarding the second problem, with a little help from Gerry I got (Assuming $\frac{d^2y}{dx^2} = t^2 \frac{d^2y}{dt^2}$ which I think is right) $$t^2 y'' - t y' + ty = 0$$ $$ty'' - y' + y = 0$$ Either $\frac{d^2y}{dx^2} = t \frac{d^2y}{dt^2}$ so that I don-t have any $t$ laying around, or there's something else that I'm not getting.

-
From $x=\log t$ you don't get $dt/dx=1/t$. –  Gerry Myerson Jul 18 '11 at 1:08
I figured that much, but can't figure out what it should be. Would you care helping me? –  Bananas Jul 18 '11 at 1:45
@Gerry should it be just $t$? Since $x = \log t$ then $\frac{dx}{dt} = \frac{1}{t}$ so doing some shuffling around I get that. Is that right? –  Bananas Jul 18 '11 at 2:23
@Colman, yes, it should just be $t$. One way to see that: $x=\log t$ -> $t=e^x$ -> $dt/dx=e^x=t$. –  Gerry Myerson Jul 18 '11 at 3:04
You're using $y'$ for both $dy/dx$ and $dy/dt$, which is asking for trouble. I'll post an answer. –  Gerry Myerson Jul 18 '11 at 6:11

Here's a sneaky way to do the first problem: it's actually linear, if you take $x$ as the dependent, and $y$ as the independent, variable. That is, with a little algebra you can rewrite it as $${dx\over dy}-{1\over y}x=-y\cot y$$

I expect you can solve first-order linear differential equations.

-
I hadn't realized that, pretty cool. I was too fixated in trying to find the integrating factor. Thanks, I'll take this into consideration with future problems too. I'd still like to find the integrating factor though, but can't seem to get it. –  Bananas Jul 18 '11 at 12:45
@Collman: Hint: Look at this form we have: $\frac{\mathrm{d}x}{\mathrm{d}y}+P(y)x=Q(y)$. Does something stick out what should be our integrating factor? –  night owl Jul 18 '11 at 19:08
@night, I think when Collman writes "I'd still like to find the integrating factor," he/she is referring to the original statement of the question, not to the linear equation in my answer. –  Gerry Myerson Jul 18 '11 at 23:30
@Gerry: Okay I see, I did not even read the question. I just read the answers provided first then comments then the question. –  night owl Jul 19 '11 at 6:38

Concerning the second question. I'll write $y_x$ and $y_t$ for derivatives with respect to $x$ and $t$, respectively.

We already have $y_x=ty_t$.

Then $y_{xx}=(ty_t)_x=t_xy_t+t(y_t)_x=t_xy_t+ty_{tt}t_x=ty_t+t^2y_{tt}$.

The equation becomes $t^2y_{tt}+ty_t-ty_t+t^2y=0$, that is, $t^2y_{tt}+t^2y=0$, which I'm sure you can handle.

-

To find a integrating factor $u(x,y)=h(x/y)$ try this. In a domain $D\subseteq \mathbb{R}^2$, such that $x\neq 0$, $y\neq 0$ and $\cos y\neq 0$, let $M(x,y)$ and $N(x,y)$ as Nana says and $u(x,y)=h(x/y)$, we have $$\begin{matrix} M_y= \frac{1}{x}\cos y & u_y = -\frac{x}{y^2}h'\left(\frac{x}{y}\right)\\ N_x= -\frac{y}{x^2}\cos y & u_x=\frac{1}{y}h'\left(\frac{x}{y}\right) \end{matrix}.$$ Then \begin{align*} (uM)_y&= \frac{1}{x}h\left(\frac{x}{y}\right)\cos y - \frac{1}{y^2}h'\left(\frac{x}{y}\right)\sin y\\ (uN)_x&= -\frac{y}{x^2}h\left(\frac{x}{y}\right)\cos y + h'\left(\frac{x}{y}\right)\left(\frac{1}{x}\cos y -\frac{1}{y^2}\sin y\right). \end{align*} If $u$ is an integrating factor \begin{align*} (uM)_y&= (uN)_x\\ \frac{1}{x}h\left(\frac{x}{y}\right)\cos y&=-\frac{y}{x^2}h\left(\frac{x}{y}\right)\cos y + \frac{1}{x}h'\left(\frac{x}{y}\right)\cos y, \end{align*} multiplying by $\frac{y}{\cos y}$ in both sides \begin{align*} \frac{y}{x}h\left(\frac{x}{y}\right) &=-\frac{y^2}{x^2}h\left(\frac{x}{y}\right)+\frac{y}{x}h'\left(\frac{x}{y}\right), \end{align*} now, put $t=\frac{x}{y}$ $$0=-\left( 1+\frac{1}{t}\right)h(t)+h'\left(t\right).$$ A solution of the last equation is $$h(t)=te^t.$$

-

I can help you make the first equation exact. First, let $M=\frac{\sin y}{x}$, $N=\frac{y}{x}\cos y-\frac{\sin y}{y}$. Then $$M_{y}=\frac{\cos y}{x}\,\,\,\,,N_{x}=-\frac{y\cos y}{x^2},$$ and $$M_{y}-N_{x}=\frac{x+y}{x^2}\cos y.$$ So clearly the differential equation is not exact. To find an integrating factor, we use the hint given. That is we try an integrating factor of the form $z=\frac{x}{y}.$ We thus compute the following: $$z_{x}=\frac{1}{y}\,\,\,,\,z_{y}=-\frac{x}{y^2}.$$ Next we form the differential equation of the form $$\frac{1}{u}\frac{\mathrm{d}u}{\mathrm{d}z}=\frac{M_{y}-N_{x}}{N\cdot z_{x}-M\cdot z{_y}}\qquad\qquad\qquad (*)$$ where the right hand side must depend on only $z$.

Computing the above expression we find the right hand side to be $\frac{x+y}{x}=1+\frac{y}{x}=1+\frac{1}{z}.$
So (*) becomes $$\frac{1}{u}\frac{\mathrm{d}u}{\mathrm{d}z}=1+\frac{1}{z}$$ which upon solving yields $$u=\exp(z+\ln z)=ze^z,$$ which is the integrating factor. Multiplying the original equation by $u$ will surely make the d.e. exact!

Hope it helps!!!

-
The hint was to try something of the form $h(x/y)$, not to try $h=x/y$. But I haven't done the work to see whether the answer you get to works. –  Gerry Myerson Jul 18 '11 at 6:04
@Gerry is correct, the hint doesn't say that $h = \frac{x}{y}$. In fact, there's no a and b so that $h = x^a y^b$ turns this into an exact equation so $h$ must be something else. –  Bananas Jul 18 '11 at 12:43