For which $(a,b) \in \mathbb{R}$ is $x^2+2axy+by^2$ the real part of a holomorphic function? I am working on the following exercise:

For which $a,b \in \mathbb{R}$ is $u := x^2+2axy+by^2$ the real part of a holomorphic function in $\mathbb{C}$? For each of these $(a,b)$ find all holomorphic functions.

I think we should use the Cauchy-Riemann Differential Equations here, so for the imaginary part $v$ of a holomorphic function has to hold:
$$\frac{\partial u}{\partial_x} = 2x+2ay = \frac{\partial v}{\partial_y}$$
$$\frac{\partial u}{\partial_y} = 2ax+2by = -\frac{\partial v}{\partial_x}$$
To get $v$ from the partial derivatives I would say that we need integration. Integrating $2x+2ay$ over $y$ yields 
$$2xy+ay^2+C_1$$
and integrating $(-1) \cdot (2ax+2by)$ over $x$ yields
$$-ax^2-2bxy+C_2$$
I do not know how to continue from here. Could you help me?
 A: If $u$ is the real part of a holomorphic function, $u$ is harmonic (and this follows from Cauchy-Riemann equations).
Thus, a necessary condition for $y$ to be the real part of a holomorphic function is that 
$$
\Delta u=0\\
2+2b=0\\
b=-1
$$
Conversely, a harmonic function in all of $\mathbb{R}^2$ is the real part of an holomorphic function (which in our case you can determine explicitly), and we are done
A: Assume that $u$ is the real part of a holomorphic function. By equality of mixed partial derivatives and the CR equations, $$
\frac{\partial ^2 u}{\partial x^2} + \frac{\partial^2 u}{\partial y^2} = \frac{\partial}{\partial x} \frac{\partial v}{\partial y} - \frac{\partial}{\partial y} \frac{\partial v}{\partial x} =  0
$$
Holds for all $(x,y) \in \mathbb C^2$. This gives you $b = -1$.

We have : $\frac{\partial v}{\partial x} = 2y - 2ax \implies v = f(y) + 2yx - ax^2$ for some $C^1$ function of $y$. Similarly, $\frac{\partial v}{\partial y} = 2x + 2ay$ implies $v = f(x) + 2xy + ay^2$ for some $C^1$ function of $x$. Comparing the expression by isolating $x$ and $y$ terms, $f(x) = -ax^2$ and $f(y) = ay^2$. Thus, we get $v(x,y) = -ax^2 + 2xy + ay^2$.
Thus, $x^2 + 2axy - y^2 + i(-ax^2+ 2xy + ay^2)$ is the family of holomorphic functions in question.
Dig a little deeper, and you see that : $$x^2(1-ai) +2(a+i)(xy) - y^2(1-ai) = (1-ai)(x^2 + 2ixy - y^2) = (1-ai)(x+iy)^2$$ is a scalar multiple of the square of a complex number, so of course it is holomorphic.
A: The constants $C_1=f(x)$ and $C_2=g(y)$. Hence
$$
v_1=2xy+ay^2+f(x)
$$
Signe we know
$$
v_{1x}=2y+f’(x)=-2ax-2by
$$
From Which we get $b=-1$ and $f’(x)=-2ax$.
We also have
$$
-ax^2-2byx+g(y)=v_2
$$
We know that
$$
-2bx+g’(y)=2x+2ay
$$
From comparison we get $g’(y)=2ay$. The two functions are identical so it doesn’t matter which one we choose.
$$
v_1=2xy+ay^2-ax^2
$$
$$
v_2=2xy+ay^2-ax^2
$$
From these calculation I conclude that $b=-1$ and $a$ can be whatever.
