To solve this you need to employ multivariable calculus, and partial differentiation, which isn't covered at A-Level, so this is probably a degree level question.
Imagine you have a non-linear differential equation such as the one shown in the OP. The general form for a non-linear first order differential equation is:
M(x,y)+N(x,y)dxdy.
If you rearrange the equation given so that it is in this form you end up with
(−cosxcosy−sin2x)+(sinxsiny+cos2y)dxdy.
Now for a differential equation with an exact solution, imagine that there is a function
F(x,y); taking the partial derivative of with respect to each variable gives us the functions
Fx and
Fy, if this function is such that
Fx and
Fy are equal to
M(x,y) and
N(x,y) respectively, then we can solve the equation to find
F(x,y).
If you employ the logic that
M(x,y) is the partial derivative of
F(x,y) taken with respect to x, and
N(x,y) is the equivalent taken with respect to y. If there is an exact solution for
F(x,y), then if you take the partial derivative of
M(x,y) with respect to y, it should be equal to the partial derivative of
N(x,y) taken with respect to x, and in fact that is a quick way to test if there is an exact solution.
M(x,y)=−cosxcosy−sin2x∴My=cosxsinyN(x,y)=sinxsiny+cos2y∴Nx=cosxsinyIt is clear that the two partial derivatives are equal, consequently there exists a function
F(x,y) which is the solution to this differential equation.
We know that
M(x,y) is equal to
Fx, therefore if we integrate
M(x,y) with respect to x we should end up with
F(x,y).
∫−cosxcosy−sin2xdx=−sinxcosy−2x+4sin2x+f(y)Note the addition of a function of y at the end of this integral; we are dealing with partial derivatives so the typical integration constant is replaced by a function in the variable we didn't integrate with.
So now we know what
F(x,y) is equal to, but we still have that function in y at the end. We also know that
Fy is equal to
N(x,y), therefore:
∂y∂[−sinxcosy−2x+4sin2x+f(y)]=sinxsiny+f′(y)sinxsiny+f′(y)=sinxsiny+cos2y∴f′(y)=cos2y∴f(y)=2y+4sin2y∴F(x,y)=−sinxcosy−2x+4sin2x+2y+4sin2yAnd that is the solution to your differential equation. I have given a full solution here as if you haven't worked with partial derivatives before you likely won't know what to do with this type of question. I hope this helped you!