Constructing a sum of squares in $\mathbb R[x]$ with given complex valuation

Fix a polynomial $$g(x)\in\mathbb R[x]$$ and a complex number $$u\in\mathbb C\setminus\mathbb R$$. My main question is

How can we construct a polynomial $$s(x)\in\mathbb R[x]$$ such that $$s(x)$$ is a sum of squares and $$s(u)=g(u)$$ and $$s(\overline{u})=g(\overline{u})$$?

I know that if $$s(u)=g(u)$$ then $$s(\overline{u})=g(\overline{u})$$, so we really only need the condition $$s(u)=g(u)$$. I am asking about this because I am trying to understand a proof of a theorem (as Theorem 7.3 in "Solving systems of polynomial equations" by Sturmfels) in which the author claims that we can write a polynomial $$g(x)\in\mathbb R[x_1,\ldots,x_n]$$ is congruent to a sum of squares $$s(x)\in\mathbb R[x_1,\ldots x_n]$$ modulo $$\langle x-u\rangle\cap\langle x-\overline{u}\rangle$$ for fixed $$u\in\mathbb C^n$$ strictly complex. The rest of the proof I can understand (and I could copy it into this question if requested), but I am having trouble seeing just why exactly this can be done. So my main question above is just asking about the univariate case of this, from which I believe I could generalize the argument.

So far I have only been able to think of the following. If we set $$s(x):=\frac{g(x)^2+|g(u)|^2}{2\Re(g(u))}$$ then we have $$g(u)^2+g(u)g(\overline{u})=g(u)\left(g(u)+\overline{g(u)}\right)=2\Re (g(u))g(u)$$ so $$s(u)=g(u)$$. But this only works if $$\Re (g(u))>0$$ since we need $$s(x)$$ to be a sum of squares in $$\mathbb R[x]$$.

Note that since $$u$$ is not real, $$u$$ and $$1$$ are linearly independent over $$\mathbb{R}$$, so every complex number can be written as $$au+b$$ for some $$a,b\in\mathbb{R}$$. In particular, we can pick $$a$$ and $$b$$ such that $$au+b$$ is a square root of $$g(u)$$, and then take $$s(x)=(ax+b)^2$$.
Alternatively, pick $$a\in\mathbb{R}$$ large enough such that $$v=u+a$$ has positive real part. Now note that the consecutive powers of $$v^2$$ have an angle of less than $$\pi$$ between them. We can pick $$n\in\mathbb{N}$$ such that $$g(u)$$ has argument between the arguments of $$v^{2n}$$ and $$v^{2n+2}$$, and then $$g(u)$$ can be written as a linear combination of $$v^{2n}$$ and $$v^{2n+2}$$ with nonnegative real coefficients. This gives a polynomial $$s(x)=b(x+a)^{2n}+c(x+a)^{2n+2}$$ which is a sum of squares and has $$s(u)=g(u)$$.
• Yes I want $u\notin\mathbb R$, I will edit to say $u\in\mathbb C\setminus\mathbb R$. This solution is very interesting, thank you! I might leave the answer un-accepted for a little while just in case people have other approaches and want to share. – Dave Feb 19 at 22:02