Background
A function $q$ is $w$-orthogonal to a function $p$ if for a fixed $w \in C[a,b]$, we have
$$\int_{a}^{b} q(x)w(x)p(x)dx = 0$$
Question
Let $p$ be any polynomial of degree $n$ and $q$ be a polynomial of degree $n+1$, and suppose we have fixed a function $w$, what are the general methods through which we can obtain $q$ such that we are guaranteed $p$ and $q$ are $w$-orthogonal?
You evaluate the integrals
$$I_d:=\int_{a}^{b} x^dw(x)p(x)dx.$$
Then take any solution of
$$\sum_{d=0}^{n+1}q_dI_d=0$$ where the $q_d$ are the coefficients of $q$.