# Finding the complex integral as follows

Let $$C$$ be a contour that is formed by an arc $$y = x^2$$ from $$(0,0)$$ to $$(1,1)$$, and a line segment from $$(1,1)$$ to $$(0,1)$$. Find the integral $$\int_C f(z) dz$$ where $$f(z) = 2xy+ i(-x^2+y^2)$$.

Attempt: Let $$C_1$$ be the arc $$y=x^2$$ and $$C_2$$ be the line segment such that $$C= C_1 \cup C_2$$. Parametrizing $$C_1$$ and $$C_2$$ gives \begin{align*} C_1 &: z = z(t) = t + it^2, \,0 \le t \le 1 \\ C_2 &: z = z(u) = (1-u) + i, \,0 \le u \le 1. \end{align*} and $$z'(t) = 1 + i2t$$ and $$z'(u) = -1$$. Now, for $$C_1$$, we have \begin{align*} \int_{C_1} f(z) dz &= \int_{C_1} f(z(t))z'(t) \ dt \\ &= \int_0^1 (2t(t^2) + i \cdot (-t^2 + (t^2)^2)(1+i2t)) \ dt \\ &= \int_0^1 (2t^3 + i \cdot (t^4 - t^2)(1+i2t)) \ dt \\ &= \int_0^1 (-2t^5 + 4t^3) \ dt + i \cdot \int_0^1 (5t^4 - t^2 ) \ dt \\ &= \left[-\frac{t^6}{3} + t^4\right]_0^1 + i \cdot \left[t^5 - \frac{t^3}{3}\right]_0^1 \\ &= \left(-\frac{1}{3} + 1\right) + \left(1 - \frac{1}{3}\right) \\ &= \frac{2}{3} + i \cdot \frac{2}{3}. \end{align*}

Now, for $$C_2$$, we have \begin{align*} \int_{C_2} f(z) dz &= \int_{C_2} f(z(u)) z'(u) du \\ &= \int_0^1 (2(1-u) + i \cdot (-(1-u)^2 + 1^2)(-1)) du \\ &= - \int_0^1 (2-2u + i \cdot (-u^2 + 2u) du \\ &= -([2u - u^2]_0^1 + i \cdot \left[-\frac{u^3}{3} + u^2\right]_0^1) \\ &= -((2 - 1) + i \cdot \left(-\frac{1}{3} + 1)\right) \\ &= -1 - i \cdot \frac{2}{3}. \end{align*}

Hence, \begin{align*} \int_C f(z) \ dz &= \int_{C_1} f(z) \ dz + \int_{C_2} f(z) \ dz \\ &= \frac{2}{3} + i \cdot \frac{2}{3} - 1 - i \cdot \frac{2}{3} \\ &= - \frac{1}{3}. \end{align*}

1. Am I correct?
2. How about an approach by Cauchy's theorem (if $$f$$ is analytic then the complex integral equals to zero.)? I doubt about using it since the contour $$C$$ isn't closed.

Since $$f(z)=-iz^2$$, $$f$$ is indeed analytic. If we "add" another path $$C_3$$ to the contour, namely the one from $$(0,1)$$ to $$(0,0)$$. Then $$C$$ is closed. Now we get $$\int_C f(z)dz=0$$ by Cauchy. Furthermore $$0=\int_C f(z)dz=\int_{C_1}f(z)dz+\int_{C_2}f(z)dz+\int_{C_3}f(z)dz$$ and $$\int_{C_1}f(z)dz+\int_{C_2}f(z)dz=-\int_{C_3}f(z)dz.$$ Now it suffices to only calculate the much simpler integral along the line segment from $$(0,0)$$ to $$(0,1)$$.
Now since a parametrization of $$C_3$$ is $$it$$, we get $$\int_{C_3}f(z)dz=\int_0^1f(it)idt=\int_0^1-i(it)^2idt=\int_0^1-i(it)^2idt=\int_0^1-t^2dt=-\frac{1}{3}$$
and furthermore $$-\int_{C_3}f(z)dz=-(-\frac{1}{3})=\frac{1}{3}.$$