Compute $\int_{\gamma} \nabla f \cdot d\mathbf{x}$ Compute $\int_{\gamma} \nabla f \cdot d\mathbf{x}$ for the following choices of $f$ and $\gamma$.
(a) $f(x,y) = x^2+y^2; \gamma:g(t) = (1+t^2, 1-t^2), -1 \le t \le2$
What I have tried:
$$\int_{-1}^2(1+t^2)^2dx + \int_{-1}^2(1-t^2)^2dy$$
Where $dx = 2t$ and $dy = -2t$
So we have
$$\int_{-1}^2(1+t^2)^2(2t)dt + \int_{-1}^2(1-t^2)^2(-2t)dt$$
however this outputs the wrong result. How do I proceed from here>?
 A: For $f(x,y) = x^2+y^2$ we have
$$ \nabla f. X = 2(x^2+y^2)$$
Thus,
$\begin{array}{ccl} 
\displaystyle\int_{\gamma}  \nabla f. X ds &=& 2 \displaystyle\int_{\gamma}   (x^2+y^2) ds\\
&=& 2 \displaystyle\int_{-1}^{2}  ((1+t^2)^2+(1-t^2)^2) \sqrt{8t^2} dt\\
&=& 2 \sqrt{8} \left( - \displaystyle\int_{-1}^{0}  ((1+t^2)^2+(1-t^2)^2) t  dt +\displaystyle\int_{0}^{2}  ((1+t^2)^2+(1-t^2)^2) t  dt \right) \\
&=& 8\sqrt{2} \left(-\displaystyle\int_{-1}^{0}  t^5+tdt+\displaystyle\int_{0}^{2}t^5+tdt \right) \\
&=&96\sqrt{2}. 
\end{array}$
A: Note that $f(x, y) = x^2 + y^2$, so the vector field $\nabla f$ is
$$ \nabla f (x, y) = (2x, 2y).$$
By definition,
\begin{align}
\int_\gamma \nabla f \cdot dx &= \int_{-1}^2 2(1+ t^2) 2t dt + \int_{-1}^2 2 (1-t^2) (-2t) dt, 
\end{align}
which gives $30$.
In general, when the vector fields in the gradient of a function, the line integral depends only on the end points but not the path: for any path $\gamma : [a, b]\to \mathbb R^2$,
$$\int_\gamma \nabla f \cdot dx = f(\gamma(b)) - f(\gamma(a)).$$
In our case
$$f(\gamma(b)) - f(\gamma(a)) = f(\gamma(2)) - f(\gamma(-1)) =f(5, -3) - f(2,0) = 25 + 9 - 4 = 30.$$
