Definiteness of quadratic form associated with a bilinear form depending on two parameters

Let $a,b\in\mathbb{R}$ and consider the bilinear form $\phi(p,q)=p(a)q(b)+q(a)p(b)$ as an at most second degree polynomial with real coefficients. What is the definiteness of the quadratic form associated with $\phi$ depending on the values of $a$ and $b$?

I wrote down the Gram matrix in the basis $\{1, x, x^2\}$: \begin{bmatrix} 2 & a+b & a^2 + b^2 \\ a+b & 2ab & ab^2+a^2b \\ a^2+b^2 & ab^2+a^2b & 2a^2b^2 \end{bmatrix}

What should I do after that?

Find the leading principal minors. We see that the first minor is positive, the second minor is $4ab - (a+b)^2 = -(a-b)^2$, and the third minor is zero.
Cauchy's interlacing theorem lets us say that, in the case in which $a \neq b$, the quadratic form is indefinite. In particular, we deduce that the Gram matrix has a negative eigenvalue, a positive eigenvalue, and a zero eigenvalue.
In the case with $a = b$, we can write the Gram matrix as $$2\pmatrix{1\\a\\a^2}\pmatrix{1 & a & a^2}$$ from which we may deduce that the form is positive semidefinite.
One can see more clearly what's going on here by computing the bilinear form in a basis better adapted to $\phi$. A natural choice that makes more symmetric the roles of $a, b$ is $$\{1, x - \mu, (x - \mu)^2 + \nu\},$$ where $\mu := \frac{1}{2}(a + b)$ and $\nu$ is a real parameter to be determined. In particular, we can see that $$\phi(x \mapsto 1, x \mapsto x - \mu) = (1)(b - \mu) + (a - \mu)(1) = a + b - 2 \mu = 0,$$ so that the $(1, 2)$ and $(2, 1)$ entries of the Gram matrix are zero; computing the rest gives: $$\pmatrix{2 & 0 & \frac{1}{2}(a - b)^2 + 2 \nu \\ 0 & -\frac{1}{2}(a - b)^2 & 0 \\ \frac{1}{2}(a - b)^2 + 2 \nu & 0 & \ast} .$$ Taking $\nu = -\frac{1}{4} (a - b)^2$ makes the off-diagonal entries zero, making the Gram matrix diagonal, and computing gives that it also makes the entry $\ast$ zero: $$\pmatrix{2 & 0 & 0 \\ 0 & -\frac{1}{2}(a - b)^2 & 0 \\ 0 & 0 & 0} .$$ We can read off immediately that
• if $a \neq b$, then the bilinear form has rank $2$ and is not semidefinite, and
• if $a = b$ then the bilinear form has rank $1$ and is positive semidefinite.