# Solving the differential equation

$$x^2p\cos(1/x)-y\sin(1/x)=-1,p:=dy/dx\quad\binom{y\to-1}{x\to\infty}$$

What is the best way(Maybe it should be $p-y\tan(1/x)/x^2=-\sec(1/x)/x^2$): $$p\sec(1/x)-y\sec(1/x)\tan(1/x)/x^2=-\sec^2(1/x)/x^2$$ So: $$ye^{\int\sec(1/x)\tan(1/x)/x^2\;dx}=\int-\sec^2(1/x)/x^2.e^{\int\sec(1/x)\tan(1/x)/x^2\;dx}\;dx$$ And so on...

What I did: Let $k=-\sin(1/x),dk=1/x^2\;.\cos(1/x)\;.dx$ $$\require{cancel}\frac{\cancel{x^2}dy\cos^2(1/x)}{\cancel{x^2}dk}+yk=-1\\ \frac{dy}{dk}+y\sec^2(1/x)=-\sec^2(1/x)\\ dy/dk+yk/(1-k^2)=1/(k^2-1)\\ ye^{\int k/(1-k^2)\;dk}=\int e^{\int k/(1-k^2)\;dk}/(k^2-1)dk\\ \frac y{\sqrt{1-k^2}}=\int\frac{dk}{(k^2-1)\sqrt{1-k^2}}$$ Then I substituted $k=1/t$, then $u=t^2$, then $v^2=u-1$, then I got: $$\frac y{\sqrt{1-k^2}}=\frac12\left(\frac{2-k^2}{k\sqrt{1-k^2}}\right)+c$$ Or: $$y=\frac{2-\sin^2(1/x)}{-2\sin(1/x)}+c$$ Now I'm unable to determine c, also the correct form is $y=\sin(1/x)-\cos(1/x)$

• What's wrong with my second approach?

You lost me after "So". It looks like you correctly found the integrating factor since $$d\sec(\frac1x)=-\frac1{x^2}\sec(\frac1x)\tan(\frac1x)dx$$

So you have

$$(y\sec\frac1x)'=-\frac1{x^2}\sec^2\frac1x$$

Integrating both sides yields

$$y\sec\frac1x=\tan\frac1x+C$$ $$y=\sin\frac1x+C\cos\frac1x$$

The initial condition should be rather trivial.

• thanks, would you help me on the second one? – RE60K Oct 1 '14 at 5:19
• @Aditya I believe everything is fine up until the triple substitution. That thing screams for a trigonometric substitution similar to what you started with, like $k=\sin t$. Also, when you multiplied both sides of the equation after the integration, you forgot to multiply the $c$ term. – Mike Oct 1 '14 at 6:16

The first is incorrect. you may do the following $$y'-\frac{y}{x^2}tan(\frac1x)=\frac{1}{x^2}sec(\frac1x)\\ e^{\int -\frac{1}{x^2}tan(\frac1x)dx}=e^{\ln \cos\frac1x}=\cos\frac1x$$ and so on

• maybe you should add why that is incorrect?, thanks for your reply – RE60K Oct 1 '14 at 5:09
• to use this formula the coefficient of $p$ should be 1. – Semsem Oct 1 '14 at 5:11
• Oh sorry I ignored that! – RE60K Oct 1 '14 at 5:12
• $y'+f(x)y=g(x)\implies ye^{\int f(x)dx}=\cdots$ – Semsem Oct 1 '14 at 5:12

I think you made your life more complex than necessary. Start with $$x^2 y'\cos(1/x)-y\sin(1/x)=0$$ which is very simple ($\frac{u'}{u}= \frac{v'}{v}$) and get $$y=C \cos \left(\frac{1}{x}\right)$$ Use the variation of parameters now for $$x^2 y'\cos(1/x)-y\sin(1/x)=-1$$ and you will end with $$y=C \cos \left(\frac{1}{x}\right)+\sin \left(\frac{1}{x}\right)$$

• IDK "variation of parameters" – RE60K Oct 1 '14 at 7:03