3.12. Given the real part $u(x, y)=x^{2}-y^{2}+2 x$ of a differentiable function $f(z)$. Find $f(z)$.
Solution.

Since the function $f(z)$ is differentiable, the Cauchy-Riemann conditions are satisfied, i.e.,

$$
\frac{\partial u(x, y)}{\partial x}=\frac{\partial v(x, y)}{\partial y}, \frac{\partial u(x, y)}{\partial y}=-\frac{\partial v(x, y)}{\partial x}
$$

or, in the context of our problem:

$$
\frac{\partial v(x, y)}{\partial x}=2 y, \frac{\partial v(x, y)}{\partial y}=2 x+2
$$

For the expression

$$
\frac{\partial v(x, y)}{\partial x} d x+\frac{\partial v(x, y)}{\partial y} d y
$$

to represent the total differential of some function $U(x, y)$ (called the potential function), it is necessary and sufficient, as is known from the course of classical analysis, that the condition (see Chapter 2)

$$
\frac{\partial}{\partial y} \frac{\partial v(x, y)}{\partial x}=\frac{\partial}{\partial x} \frac{\partial v(x, y)}{\partial y}
$$

is satisfied, which is the case here. We will reconstruct the potential function $U(x, y)$ from its total differential by taking a line integral of the second kind over the contour $L=L_{1}+L_{2}$, where

$$
L_{1}:\left\{\begin{array}{l}
x=t, \\
y=y_{0}, \\
t \in\left[x_{0}, x\right] ;
\end{array} \quad L_{2}:\left\{\begin{array}{l}
x=x \\
y=t \\
t \in\left[y_{0}, y\right]
\end{array}\right.\right.
$$

We have:

$$
\begin{gathered}
U(x, y)=\int_{L} \frac{\partial v(x, y)}{\partial x} d x+\frac{\partial v(x, y)}{\partial y} d y=\int_{L} 2 y d x+(2 x+2) d y= \\
=\int_{L_{1}} 2 y_{0} d t+\int_{L_{2}}(2 x+2) d t=2 y_{0} \int_{x_{0}}^{x} d t+(2 x+2) \int_{y_{0}}^{y} d t= \\
=2 y_{0}\left(x-x_{0}\right)+(2 x+2)\left(y-y_{0}\right)= \\
=(2 x y+2 y)-\left(2 y_{0} x_{0}+2 y_{0}\right)=U_{1}(x, y)-U_{1}\left(x_{0}, y_{0}\right) .
\end{gathered}
$$

It is clear from this that

$$
U(x, y)=U_{1}(x, y)+c=2 x y+2 y+c, c \in \mathbb{X} .
$$

It is not difficult to see that this is the imaginary part of the function $f(z)$, from which it follows that

$$
\begin{gathered}
f(z)=x^{2}-y^{2}+2 x+i(2 x y+2 y+c)=x^{2}- \\
-y^{2}+2 x+i(2 x y+2 y)+C= \\
=\left(x^{2}+2 x(i y)+(i y)^{2}\right)+2(x+i y)+C=(x+i y)^{2}+ \\
+2(x+i y)+C=z^{2}+2 z+C, C=i c .
\end{gathered}
$$