Since \(\dfrac{\partial M}{\partial y}=\dfrac{\partial N}{\partial x}\) for all \(x\) and \(y\), the differential equation is exact over the \(xy\)-plane.
(b) Since the differential equation is exact, there is a function \( z=\) \(f(x,y)\) so that \[\begin{equation*} \frac{\partial f}{\partial x}=M=\cos y-\cos x\qquad \hbox{and}\qquad \frac{\partial f}{\partial y}=N=e^{y}-x\sin y \end{equation*}\]
We integrate \(\dfrac{\partial f}{\partial x}=M=\cos y-\cos x\) partially with respect to \(x\) (holding \(y\) constant). Then \[\begin{equation*} f(x,y)=\int ( \cos y-\cos x)\,dx=x\cos y-\sin x+B(y) \tag{3} \end{equation*}\]
where \(B,\) which is yet unknown, is a function of \(y\) alone. To find \(B,\) we differentiate \(f\) with respect to \(y\). \[\begin{equation*} \frac{\partial f}{\partial y}=\dfrac{\partial }{\partial y}\left[ x\cos y-\sin x+B(y)\right] =-x\sin y-0+\dfrac{\partial }{\partial y}B(y)=-x\sin y+ \dfrac{\it dB}{dy} \end{equation*}\]
Since \(\dfrac{\partial f}{\partial y}=N=e^{y}-x\sin y,\) we have \[\begin{eqnarray*} -x\sin y+\dfrac{\it dB}{dy} &=&e^{y}-x\sin y \\ \dfrac{\it dB}{dy} &=&e^{y}\\ B(y)&=&e^{y}+C \end{eqnarray*}\]
where \(C\) is a constant. Now we substitute \(B(y)\) into (3) to obtain the general solution \[ f(x,y)=x\cos y-\sin x+e^{y}+C=0 \]
To find the particular solution that satisfies the boundary condition \(y(\pi )=0\), we need to find \(C\) so that \(y=0\) when \(x=\pi .\) Then \[\begin{eqnarray*} \pi \cos 0-\sin \pi +e^{0}+C& =&0 \\[3pt] \pi +1+C& =&0 \\[3pt] C& =&-( 1+\pi) \end{eqnarray*}\]
The particular solution is \(\ x\cos y-\sin x+e^{y}=\pi +1.\)