Given that $g(x)$ is a continuously differentiable function of one variable $x$ which satisfies $g(0) = 2$. Assume that the value of the line integral $$I = \int_C xy^2 dx + yg(x)dy$$
is independent of the path C which joins $(0,0)$ to $(2,3)$, find an exact formula for the function $g(x)$, then find the exact value of the line integral $I$.
I have worked out that since the line integral is independent of the path C, it should be a conservative field (is this always true?). Hence going by the criteria of a conservative field I equate the differential of $xy^2$ with respect to $y$, to the differential of $yg(x)$ with respect to x and in the end I have worked out that $g(x) = x^2 + 2$.
Thus I now have the equation $$I = \int_C xy^2 dx + y(x^2 + 2)dy$$
However, I am stuck at the part finding the value of the line integral, in a sense I have no idea what to do with the information of path C's coordinate being from $(0,0)$ to $(2,3)$.
Thank you~
You are very, very close to the correct solution. The problem is that you cannot deduce that the field $(xy^2, yg(x))$ is conservative only from the fact that its integral between two points is path-independent. In order to deduce conservativeness, you would have to be told that the line integral between any two points is line-independent - which you are not given. Fortunately, not all is lost, and the information you are given is enough!
First, let us find one particular $g$ among the many that satisfy the given equality. Your approach is correct: let us try our chances and look for a conservative field (but nobody guarantees that we shall be able to find one!). Therefore, let us impose (as you do) that
$$\frac {\partial (xy^2)} {\partial y} = \frac {\partial (y g(x))} {\partial x} ,$$
which gives $2xy = y g'(x)$, whence (since the equality must be true for every $x$ and $y$) $g(x) = x^2 + c$ with $c$ some unknown integration constant. The condition $g(0) = 2$ forces $c=2$, so $g(x) = x^2 + 2$.
The problem is that, in principle, this $g$ that we have obtained is not unique. Let $x \mapsto g(x) + \epsilon (x)$ be another function with the same property. Then $I$ computed with $g$ and $I$ computed with $g + \epsilon$ are equal, so
$$0 = I - I = \int \limits _C xy^2 \ \Bbb d x + y \big( g(x) + \epsilon (x) \big) \ \Bbb d y - \int \limits _C xy^2 \ \Bbb d x + y g(x) \ \Bbb d y = \int \limits _C y \epsilon (x) \ \Bbb d y .$$
This equality says that if $\epsilon$ satisfies the equality above and $\epsilon(0) = 0$, then $x^2 + 2 + \epsilon(x)$ is as good as $x^2 + 2$, meaning that when plugged into $I$ they give the same result. It is impossible to tell them apart from the point of view of $I$ or, in more mathematical terms, the problem of finding $g$ does not have a unique solution.
Finally, in order to explicitly compute $I$ just choose any among these many functions, for instance $g(x) = x^2 + 2$. Next, since $I$ is path-independent, just choose any path between $(0,0)$ and $(2,3)$ and compute $I$. I shall choose a line segment joining the two, given by the formula
$$[0,1] \ni t \mapsto (2t, 3t) \in \Bbb R^2 .$$
Along this curve we get
$$I = \int \limits _0 ^1 (2t) \ (9t^2) \ 2 + (3t) [(2t)^2 + 2] \ 3 \ \Bbb d t = 36 \frac {t^4} 4 \Bigg| _0 ^1 + 36 \frac {t^4} 4 \Bigg| _0 ^1 + 18 \frac {t^2} 2 \Bigg| _0 ^1 = 27 .$$