# How do I solve $y' = \sin(x - y)$?

How can I solve the differential equation: $$y'=\sin(x-y)$$

Could I do this?

$$\frac{dy}{dx}= \sin x \cos y - \sin y \cos x$$

But, how would I continue?

-
Wolfram Alpha provides the answers obtained in: wolframalpha.com/input/?i=y%27+%3D+sin%28x-y%29 – Leucippus Jul 14 '14 at 22:22
@Leucippus I found that the general solution is: $$\tan{(x-y)}+ \sec{(x-y)}=x+c$$ Is this equal to the one that wikipedia provides? – evinda Jul 14 '14 at 23:04
What is provided from the Wolfram solution is the complete solution of $y(x)$. The solution you have provided, which works, is a mixed solution containing a function of $x$ and $y(x)$. Solving the solution you have provided for $y(x)$ should provide something close to that provided by Wolfram. – Leucippus Jul 14 '14 at 23:36
@Leucippus But how can I solve it for $y(x)$ ? – evinda Jul 14 '14 at 23:53

## 3 Answers

If you substitute $y_1=y-x$ you get:

$$y_1'=y'-1$$

$$\sin(x-y)=\sin(x-y_1-x)=\sin(y_1)$$

So:

$$\sin(y_1)=y_1'+1$$

Next you get $1=\dfrac{y_1'}{\sin(y_1)-1}$ and you can integrate both sides.

You get:

$1)$ Left side: $$\int_{x_0}^{x} 1 dx=x-x_0$$

$2)$Right side (by changing variables): $$\int_{x_0}^{x} \frac{y_1'(x)}{\sin(y_1(x))-1} dx=\int_{y_1(x_0)}^{y(x)} \frac{1}{\sin x-1} dx$$

-
Isn't it $\sin(-y_1)=-\sin(y_1)$ ? So,do we have to substitute maybe : $y_1=y-x$ ? – evinda Jul 14 '14 at 21:49
If $y_1 = y + x$ then $x - y = 2x - y_1$. You should use $y_1 = x-y$... – johannesvalks Jul 14 '14 at 21:51
So,we do it like that: $$u=x-y$$ $$u'=1-y'$$ $$1-u'= \sin u \Rightarrow 1- \sin u=u' \Rightarrow \frac{du}{dx}=1- \sin u \Rightarrow \frac{du}{ 1- \sin u}=dx$$ But how can I continue? – evinda Jul 14 '14 at 21:53
$\int\frac{1}{1-\sin(u)}du=\int\frac{1+\sin(u)}{\cos^{2}(u)}du=\int\sec^{2}(u)du‌​+\int\tan(u)\sec(u)du$ – user71352 Jul 14 '14 at 21:57
@mesel Agreed. (+1 from me, in any event; I wasn't a downvoter, though) – apnorton Jul 15 '14 at 0:35

Let $z = x - y$. Thus, $\dfrac{dy}{dx} = 1 - \dfrac{dz}{dx}$ and $$\dfrac{dy}{dx} = \sin(x - y) \quad \Rightarrow \quad \dfrac{dz}{dx} = 1 - \sin z \quad \Rightarrow \quad \int dx = \int \dfrac{dz}{1 -\sin z}$$ The next step is to change $u = \tan(z/2)$ so that $dz = \dfrac{2du}{1 + u^2}$. Note that $$\sin z = \dfrac{2\sin(z/2)\cos(z/2)}{\cos^2(z/2) + \sin^2(z/2)} = \dfrac{2\tan(z/2)}{1 + \tan^2(z/2)} = \dfrac{2u}{1 + u^2}$$ Thus, $$x = \int \dfrac{\dfrac{2du}{1 + u^2}}{1 -\dfrac{2u}{1 + u^2}} =2\int \dfrac{du}{1 + u^2 - 2u} = 2\int \dfrac{du}{(1-u)^2} = -\dfrac{2}{1-u} + C \quad \Rightarrow$$ $$x = \dfrac{2}{\tan(z/2) - 1} + C = \dfrac{2}{\tan\biggl(\dfrac{x - y}{2}\biggr) - 1} + C$$

-
So,is the general solution $\tan(x-y)+ \sec(x-y)=x+c$ ? – evinda Jul 14 '14 at 22:40
Write $z = x - y$ and proceeds as before. – MathFacts Jul 14 '14 at 23:08
Could you explain it further to me? Can we not solve this equation for $y(x)$ ? – evinda Jul 14 '14 at 23:55
As before, I think the solution that other differential equation can not be explained to x. – MathFacts Jul 14 '14 at 23:58
At the book,it is given the differential equaltion $y'=\sin (x-y) \text{ and } y(0)=\pi$ and the solution is $y=x-2 \arctan(x+c) + \frac{\pi}{2}$..How can I conclude to this? Substituting $x=0$ at the solution that I found, I found that $c=-1$..How could I continue? – evinda Jul 15 '14 at 0:01

I will only add the solution of the integral,

$$\int\dfrac{1}{1-\sin x}dx$$ set $\tan(x/2)=u$ then you will have

$$\int\dfrac{1}{1-{2u\over{1+u^2}}} \dfrac{2}{u^2+1} du$$

As a result you will have $$\dfrac{2\sin(\dfrac x2)}{\cos(\dfrac x2)-\sin(\dfrac x2)}+c$$

-
How do you get from the first integral to the seond one,using the substitution? Do you use a formula? – evinda Jul 14 '14 at 22:14
@evinda: just the substition, if $tan(x/2)=u$ then $cos(x/2)=\dfrac {1}{\sqrt{1+u^2}}$ and $sin(x/2)=\dfrac {u}{\sqrt{1+u^2}}$ then use $sin(x)=2sin(x/2)cos(x/2)=\dfrac {2u}{{1+u^2}}$ – mesel Jul 14 '14 at 22:17
A ok..is the general solution $\tan(x-y)+ \sec(x-y)=x+c$,or have I found it wrong? – evinda Jul 14 '14 at 22:40
It's $\large{2\,{\rm d}u \over 1 + u^{2}}$ in your second line. – Felix Marin Jul 14 '14 at 23:32
@FelixMarin: thank you for your correction. – mesel Jul 15 '14 at 0:30