Solving $(y\cos x)dx+(\sin x +2)dy=0$ Greetings my teacher gave me the following differential equation: $$(y\cos x)dx+(\sin x +2)dy=0$$ and told me it's an total differential equation and to solve in $y(0)=\frac{1}{2}$ so I have two possible solutions and I 
 dont know which one is correct. Let's denote $P(x,y)$ to be the coefficients of $dx$ and $Q(x,y)$ to be the coeffiecients of dy. Firstly using: $$u(x,y)=\int_{x_0}^x P(t,y_0)dt +\int_{y_0}^y Q(x,t)dt$$ gives $$u(x,y)=\int_0^x \frac{1}{2}\cos{t}dt+\int_{\frac{1}{2}}^y \sin{x}dt=\frac{1}{2}\sin{x}+y\sin{x}-\frac{1}{2}\sin{x}=y\sin{x}$$ And the second method would be to use: $$u(x,y)=\int_{x_0}^x P(t,y)dt +\int_{y_0}^y Q(x_0,t)dt$$ which gives: $$u(x,y)=\int_0^x y\cos{t}dt+\int_{\frac{1}{2}}^y (\sin{0}+2)dt=y\sin{x}+2y-1$$ Also one can notice that is in fact also a separable differential equation.
Which one is correct and what shall I use? Edit: The only problem was that I forgot to put $+2$ in the second integral for the first method..
 A: Make the ODE into other form $$a\frac{dy}{dx} + b = 0$$ with functions $a = a(x,y) = \sin x + 2$ and $b = b(x,y) = y\cos x$. They have relation $$\frac{\partial a}{\partial x} = \cos x = \frac{\partial b}{\partial y}$$ which is necessary condition of exact ODE. So setting function $$\psi(x,y) = \int dy\ \sin x + 2 = \int dx\ y\cos x$$ such it have form $$\psi(x,y) = y\sin x + 2y$$ in ODE $$\frac{d}{dx}\psi(x,y) = 0.$$
Therefore the general solution of the exact ODE come here $$y = \frac{c}{\sin x + 2}$$ with real constant $c$ of integral.
In the initial condition $y_0 = y(0) = 2^{-1}$, the real constant $c$ is $1$, and the solution become $$y = \frac{1}{\sin x + 2}.$$
A: I'd rather do it like this;
$(y\cos x)dx+(\sin x +2)dy=0$
$\dfrac{dy}{dx} = - \dfrac{y\cos(x)}{\sin(x)+2}$
$\dfrac{dy}{y}= \dfrac{-\cos(x)dx}{\sin(x)+2}$
$\displaystyle\int\frac{dy}{y}=\int\frac{-\cos(x)\,dx}{\sin(x)+2}$
$\displaystyle\ln(y) = -\ln\big(\sin(x)+2\big)+\ln C$
$y= \dfrac{C}{\sin(x)+2}$
$y(0) =\dfrac 12$
$\implies \dfrac12 = \dfrac{C}{2}\implies C=1$
$\therefore y=\dfrac1{\sin(x)+2}$
A: $$\partial_x F=(y\cos x) \implies F=\int y\cos xdx=y\sin x +\phi(y)$$
$$\partial_y F=\sin x +2=0 \implies F=\int \sin x +2)dy=2y+y\sin x +\psi (x)$$
$$ \implies F=2y+y\sin x   \implies 2y+y\sin x =C$$

Another solution...
$$(y\cos x)dx+(\sin x +2)dy=0$$
$$(y\cos x)+(\sin x +2)y'=0$$
$$(y\sin x)'+2y'=0$$
Integrate 
$$(y\sin x)+2y=K$$
$$\implies y=\frac K {\sin x +2}$$
