# Differential Equation Question $y'=\frac{1}{\cos y-x}$

I want to find the solution for the first order differential equation $$y'=\frac{1}{\cos y-x}$$ I have no clue what to do, what I tried is:

1. $$(\cos y-x)dy=dx$$
2. $$\frac{dy}{dx}=\frac{1}{\cos y-x}$$

hints will be welcomed,thanks.

Rewriting the equation as $$(x-\cos y)y'+1=0$$ and putting $M(x,y)=1$ and $N(x,y)=x-\cos y$, $$M(x,y)dx+N(x,y)dy=0$$ We see that the equation is not exact because $$\frac{\partial M(x,y)}{\partial y}=0\neq 1=\frac{\partial N(x,y)}{\partial x}.$$

We have to find an integrating factor $\mu(y)$ such that $$\mu(y)M(x,y)dx+\mu(y)N(x,y)dy=0$$ is exact, that is $$\frac{\partial \mu(y)M(x,y)}{\partial y}=\frac{\partial \mu(y)N(x,y)}{\partial x}.$$ We find that $\mu$ must satisfy $\mu'(y)=y$ so that $\mu(y)=e^{y}$. Multiplying $(x-\cos y)y'+1=0$ by $\mu(y)$ one has $$e^{y}(x-\cos y)y'+e^{y}=0$$ Let $A(x,y)=e^{y}$ and $B(x,y)=e^{y}(x-\cos y)$; this is an exact equation because $$\frac{\partial A(x,y)}{\partial y}=\frac{\partial B(x,y)}{\partial x}=e^{y}.$$ Let $F(x,y)$ such that $\frac{\partial F(x,y)}{\partial x}=A(x,y)$ and $\frac{\partial F(x,y)}{\partial y}=B(x,y)$; so the solution of the equation is given by $$F(x,y)=C$$ with $C$ an arbitrary constant. Integrating $\frac{\partial F(x,y)}{\partial x}$ with respect to $x$ one has $$F(x,y)=e^yx+\psi(y)$$ where $\psi(y)$ is an arbitrary function of $y$. Differentiating $F(x,y)$ with respect to $y$, we find $$\frac{\partial F(x,y)}{\partial y}=e^yx+\psi'(y)=B(x,y)=e^{y}(x-\cos y)$$ so that $$\psi'(y)=-e^{y}\cos y$$ and solving $$\psi(y)=-\frac{1}{2}e^{y}(\cos y+\sin y)$$ Finally $$F(x,y)=e^yx-\frac{1}{2}e^{y}(\cos y+\sin y)$$ so the solution is $F(x,y)=C$: $$e^yx-\frac{1}{2}e^{y}(\cos y+\sin y)=C$$ or $$x=\frac{1}{2}(\cos y+\sin y)+Ce^{-y}.$$

Hint: Consider $\frac{dx}{dy}$.

• I am still dont get it. I need to write it as $y'+p(x)y=q(x)$, but you want to do as $x'+p(y)x=q(y)$? – Ofir Attia Nov 4 '13 at 8:54
• @OfirAttia You don't always need to write it as $y^{\prime}+p(x)y=q(x)$; $x^{\prime}+p(y)x=q(y)$ is equally valid since it's still a linear equation. – Christopher Toni Nov 4 '13 at 9:25
• We get $\frac{dx}{dy}=\cos y-x$, or equivalently $\frac{dx}{dy}+x=\cos y$, a nice linear equation. – André Nicolas Nov 4 '13 at 22:28

HINTS 1st order non-linear differential equation. take all the terms to one side then multiply both sides by x-cos(y) .. this is not an exact equation. So have to find the integrating factor.

answer will be ((e^y) * x) - 0.5*e^y*(cos(y)+sin(y)) = c

Hint: let $$z=y+\ln|x|$$ This will lead you to $$\frac{de^z}{de^y}=\pm\cos(\ln e^y)$$ It's easy to calculate $\int\cos(\ln x)dx$.

If you use the hint of @Andre Nicolas your DE becomes a linear eqn. in $x$:$$\frac{dx}{dy}+x=\cos y$$ (the roles of $x$ and $y$ are interchanged) with the integrating factor $e^y$. So the solution to ths eqn. is $$x=e^{-y}\int e^y \cos ydy+ce^{-y}$$