For the function to be analytic, the Cauchy-Riemann equations must be satisfied. These equations are:
\[
\frac{\partial u}{\partial x} = \frac{\partial v}{\partial y}, \quad \frac{\partial u}{\partial y} = -\frac{\partial v}{\partial x}
\]
where \( f(z) = u(x, y) + i v(x, y) \), and in this case:
\[
u(x, y) = x^2 + a y^2 - 2xy \quad \text{and} \quad v(x, y) = b x^2 - y^2 + 2xy
\]
We compute the partial derivatives:
\[
\frac{\partial u}{\partial x} = 2x - 2y, \quad \frac{\partial u}{\partial y} = 2a y - 2x
\]
\[
\frac{\partial v}{\partial x} = 2b x + 2y, \quad \frac{\partial v}{\partial y} = 2x - 2y
\]
Now, apply the Cauchy-Riemann equations:
1. \( \frac{\partial u}{\partial x} = \frac{\partial v}{\partial y} \):
\[
2x - 2y = 2x - 2y \quad \text{(this is always true, so no condition on \( a \) and \( b \) from this equation)}
\]
2. \( \frac{\partial u}{\partial y} = - \frac{\partial v}{\partial x} \):
\[
2a y - 2x = - (2b x + 2y)
\]
Simplifying:
\[
2a y - 2x = -2b x - 2y
\]
\[
2a y + 2y = 2b x + 2x
\]
\[
y(2a + 2) = x(2b + 2)
\]
Dividing both sides by 2:
\[
y(a + 1) = x(b + 1)
\]
For this equation to hold for all values of \( x \) and \( y \), we must have:
\[
a + 1 = 0 \quad \text{and} \quad b + 1 = 0
\]
Thus, \( a = -1 \) and \( b = -1 \).
Therefore, the correct values of \( a \) and \( b \) that make the function analytic are \( a = 1 \) and \( b = -1 \).