Let $S$ denote the segment that connects the points $O(0, 0), \; A(1, 1)$. I want to evaluate the integral: $\displaystyle \int_{S} z^2 \, dz$.
The segment can be parametrized as $\gamma(t)=(t, t), \; t \in \mathbb{R}$ . Hence:
$$ \int_S z^2 \, dz = \int_0^1 f(\gamma(t)) \gamma'(t)\,dt $$
But $f(\gamma(t))=(t+it)^2=t^2+2it -t^2 =2it $ and $\gamma'(t)=(1, 1)$. Thus the contour integral equals $\dfrac{2}{3}i $.
However this does not coincide with the answer of the book which gives that $\dfrac{2}{3}(i-1)$.What am I doing wrong here?
Hint: Let $z = t + ti$, where $0 \leq t \leq 1 $ then $dz = (1 + i)dt$