
If a scalar function

exists for which

, then we'd have


so the scalar function would be given by

where

is an arbitrary constant.
Presumably, this question is being asked in the context of the line integral of

along the given contour

. Since

is conservative - and consequently a scalar potential function

exists - we can simply use the gradient theorem to evaluate the line integral. We would get

(and we get the same answer by parameterizing

and computing the integral as we usually would)