Find $f$ if the gradient of $f$ is $\vec F = \sin(x/2)\sin(y/2)\vec i - \cos(x/2)\cos(y/2)\vec j $
So we know that $\frac{df}{dx} = f_x = \sin(x/2)\sin(y/2) $ and we know that $\frac{df}{dy} = f_y = -\cos(x/2)\cos(y/2)$
Integrating $\sin(x/2)\sin(y/2)$ tells us that $$f = -2\cos(x/2)\sin(y/2) + C(y)$$ where $C(y)$ is a function of just $y$.
Differentiating that $f$ with respect to $y$ tells us that $$\frac{df}{dy} = f_y = -2\cos(x/2) * 2\cos(y/2) + C'(y) = -4\cos(x/2)\cos(y/2) + C'(y)$$
But from the question we know that $\frac{df}{dy} = \cos(x/2)\cos(y/2) $. So we have a contradiction. I don't know how to account for the $-4$.
What is $f$? It can't be $ -2\cos(x/2)\sin(y/2) + C(y)$ since that doesn't have the derivative wrt to $y$ given in the question, but it also has to be that because that's the function that has the derivative wrt to $x$ given in the question...
Any help is appreciated!
When you differentiated $-2\cos\frac x2\sin\frac y2+C(y)$ with respect to $y$, you mistakenly put in a coefficient of $2$ instead of $1/2$ (and also dropped the $C'(y)$ prematurely). If you fix that, things should work much better.