I am currently reading Hamming's Numerical Methods for Scientists and Engineers. On pg. 79, it is stated that if a complex function is such that for every real argument produces a real value, then its zeros come in conjugate pairs.
After defining $\overline{w(z)}$ as replacing every $i$ in the expression by $-i$ (which according to this answer https://math.stackexchange.com/a/187195, it is equivalent to composing the function $w$ on the left and right with the conjugate), $\bar w(z)$ as the conjugate only after the function application, and $w(\bar z)$ as conjugating the argument before applying the function. He produces the following line as a proof:
$$w(x+iy)=0=\overline{w(x+iy)}=\bar w(x-iy)=w(x-iy),$$ where $x+iy$ is assumed to be a zero.
I am having trouble understanding this proof. Could you elaborate on it, or point me to a more detailed proof of this theorem?
I find quite confusing the notation $\bar{w}$ as definded by Hamming and I will avoid it.
Let $f\colon \Omega\to \mathbb C$ be a holomorphic (i.e. analytic) function defined on some region $\Omega\subseteq \mathbb C$. Assume that the following equality holds for every $z\in \Omega$:
$$\overline{f(z)}=f(\overline z). \qquad (\star)$$
Then, if $z_0\in\Omega$ is a zero of $f$, we have $f(z_0)=0$ and hence $\overline{f(z_0)}=0$. Therefore, using $(\star)$
$$0=\overline{f(z_0)}=f(\overline{z_0})$$
and we have shown that $\overline{z_0}$ is a zero of $f$.
Now let us prove $(\star)$.
[It is insightful to first consider the case of $f$ being a polynomial (but you can just skip to the general proof below). Given $f(z)=a_0+a_1z+\dots+a_nz^n$, suppose that $f$ takes real values for real inputs. Then it must be the case that all the coefficients $a_0,\dots,a_n$ are real (and hence $a_j=\overline{a}_j$ for all $j=0,\dots,n$). Therefore
$$f(\overline z)=a_0+a_1\overline z+\dots +a_n\overline{z}^n=\overline{a}_0+\overline{a}_0\overline z+\dots +\overline{a}_n\overline{z}^n=\overline{f(z)}$$ which proves $(\star)$.
One may interpret this result considering the function $h(z)=\overline{a}_0+\overline{a}_0 z+\dots +\overline{a}_n z^n$ obtained replacing the coefficients of the polynomial with their conjugates. You can notice that
General proof of $(\star)$.
Consider the function $h\colon \Omega\to \mathbb C$ defined as $h(z)=\overline{f(\overline{z})}$. In Hamming's notation, if we rename the function $f$ with $w$, then $h(z)$ is $\overline{w}(z)$.
One can prove that the function $h$ is still holomorphic. If you know them, just use Cauchy-Riemann equations or Wirtinger's operator. It is a straightforward verification.
Now we use the hypothesis of $f$ having real values for real inputs. Recall that if $z\in \mathbb C$ is real then you can replace it with its conjugate, since they are equal. Hence, given a real $z$ and using this property twice, we can write $$f(z)=f(\overline z)=\overline{f(\overline{z})}=h(z).$$ Therefore the functions $f$ and $h$ coincide on the real axis. An important result in complex analysis, namely the identity theorem for holomorphic functions, tells us that in fact $f$ is equal to $h$ everywhere. Thus $f(z)=h(z)$ for all $z\in\Omega$ and taking conjugate on both sides we get $$\overline{f(z)}=f(\overline z)$$ which is what we had to prove.
I took a look to Hamming's proof. It is more or less the same given here, but he does not specify that the function $h$ (which he calls $\overline w$) is in fact holomorphic and hence that the identity principle holds. He just notices that $w(x)=\bar w (x)$ for real values of $x$ (that is the same thing written here in point 3: $f(z)=h(z)$ for real $z$), but this is not enough to show that $f$ and $h$ (i.e. $w$ and $\bar w$) are equal for every complex input $z$. However he assumes it while writing the last equality $\bar w(x-iy)=w(x-iy)$. In fact this theorem is valid only for holomorphic functions specifically because they are sufficiently regular to ensure that the equality $f=h$ extends on the whole domain.