The general formula for a quadratic is:

When we transform to the new coordinates, we get:

Gathering the terms in uv we obtain the coefficients:

Remember the double angle formulas:

So we obtain:

for the coefficients of xy. These must equal zero for all the xy terms to disappear. Thus:

This approach runs into a problem if C = A, as it does for our example:

But we can just invert the step at the end:

The cotangent is zero when the cosine is zero, e.g. for

Thus, if

then all the xy terms vanish, as we found before.