For which values $a, b \in \mathbb{R}$ the function $u(x,y) = ax^2+2xy+by^2$ is it the real part of a holomorphic function in $\mathbb{C}$

We have that

$$\begin{cases}v_x=-u_y=-2x-2by \\ v_y=u_x=2ax+2y\end{cases}$$

Now, integrating $v_x$ from $(0,0)$ to $(x,0)$ and $v_y$ from $(x,0)$ to $(x,y)$ and $v_y$ from $(0,0)$ to $(0,y)$ and $v_x$ from $(0,y)$ to $(x,y)$ we get two expressions for $v(x,y)$ that must be equal. Indeed

$$\begin{cases}v(0,y)-v(0,0)=\int_0^y v_y(0,t)dt=y^2 \\v(x,y)-v(0,y)=\int_0^x v_x(t,y)dt=-x^2-2bxy \\ v(x,0)-v(0,0)=\int_0^x v_x(t,0)dt=-x^2 \\v(x,y)-v(x,0)=\int_0^y v_y(x,t)dt=2axy+y^2\end{cases}$$

That is, $$v(x,y)=v(0,0)+y^2-x^2-2bxy=v(0,0)-x^2+2axy+y^2,$$ which gives us $b=-a.$

Finally, one checks that $u(x,y)=ax^2+2xy-ay^2, v(x,y)=v(0,0)-x^2+2axy+y^2$ satisfy the Cauchy-Riemann equations, and, so, $f(x,y)=u(x,y)+iv(x,y)$ is holomorphic.


This Result and Cauchy Riemann Equations shows that $u(x,y)$ is real part of holomorphic function iff $u$ is harmonic. So,$u_{xx}+u_{yy}=0$ i.e. $b=-a$. QED