Quadratics and their values depending on values of variable Source: Challenge and Thrill of Pre-College Mathematics, Page 201, Question 18:
"Let $$p(x)=ax^2+bx+c$$ be such that $p(x)$ takes real values on real values of x, and non-real values on non-real values of $x$. Is it true that $a=0$ ? If yes, then prove the same."
My attempt: Consider $x=y+zi$, a complex number. We can make cases on
$a=0, a≠0$ and prove that $a≠0$ doesn't work.
$a=0$ :- $p(x)=a(y^2-z^2+2yzi)+b(y+zi)+c$, and likewise for $a≠0$.
This is only a rough idea I have, but it doesn't help much when I tried to  actually solve the question. Could anyone help me elaborate, or provide comments on what I have done so far?
 A: $p(0),p(1)+p(-1),p(1)-p(-1)$ are all real, giving $a,b,c\in\Bbb R$. This implies that $\forall x\in\Bbb R,p(x)\in\Bbb R$.
For $z\ne0$, we require the imaginary part of $p(y+iz)$ to be non-zero. Thus$$z(2ay+b)\ne0\implies2ay+b\ne0\forall y\in\Bbb R$$If $a\ne0$, then for $y=-b/2a\in\Bbb R,2ay+b$ will be zero. Thus $a=0,b\ne0$.
A: If we write the quadratic polynomial in the form $ \ p(x) \ = \ ( \ ( \ a·x \ ) \ +  b \ ) · x \ + \ c \ \ , $ it may help in seeing how values of $ \ x \ $ are "mapped" by the function.
With the coefficients $ \ a \ , \ b \ , \ c \ $ all real numbers, it is clear that if $ \ x \ $ is also real, then since the real numbers are closed under multiplication and addition, $ \ p(x) \ $ must be real as well.  For $ \ z \ = \ \zeta \ + \ \eta·i \ \ (  \ \zeta \ $ and $ \ \eta \neq 0 \ $ being real), we expect $ \ a·z + b \ $ will have an imaginary part; multiplication of this number again by $ \ z \ $ would still seem retain an imaginary part.  The detailed calculation is
$$ \ p(z) \ = \ [ \ ( \ a·[ \ \zeta \ + \ \eta·i \ ] \ ) \ +  b \ ] · x \ + \ c \ \ = \  ( \ [a · \zeta + b] \ + \ a·\eta·i  \ )  · ( \ \zeta \ + \ \eta·i \ ) \ + \ c  $$
$$ = \  ( \ [a · \zeta + b]·\zeta \ - \ a·\eta^2  \ + c \ ) \ + \ ( \ [a · \zeta + b]·\eta \ + \ a·\zeta·\eta \ )·i  \ \ . $$
The imaginary part of $ \ p(z) \ $ is then $ \ ( \ 2·a · \zeta \ + \  b \ )·\eta·i \ \ ; $ this equals zero for $ \ \eta = 0 \ \ , $ confirming our earlier conclusion that real numbers "map to" real numbers.  But we can also see that this product is zero for $ \ \zeta \ = \ -\frac{b}{2a} \ \ , $ so $ \ z \ = \ -\frac{b}{2a} \ + \ \eta·i \ \ $  will also map to a real number for any value of $ \ \eta \ \ , $ unless $ \ a = 0 \ \  $  .  In that case, the imaginary part of $ \ p(z) \ $ becomes simply $ \ b ·\eta·i \ \neq 0 \ $ for $ \ \eta \neq 0 \ \ . $
Thus, with $ \ a = 0 \ \ , $ we are assured that $ \ p(z) \ $ "sends" real numbers to real numbers and non-real $ \ (\eta \neq 0) \ $ numbers to non-real numbers; but then $ \ p(z) \ $ "collapses" to the linear polynomial $ \ bz + c \ \ . $  A quadratic polynomial with real coefficients continues to map real numbers only to real numbers, but will "mix" particular complex numbers into the set of real numbers as well.
We can also understand this "mixing" by considering the "vertex form" of the quadratic polynomial $$   az^2 \ + \ bz \ + \ c \ \ = \ \ a · \left( \ z \ + \ \frac{b}{2a} \ \right)^2 \ + \ \left( \ c \ - \ \frac{b^2}{4a} \ \right) \ \ . $$
The second parenthetic term is a real number for real coefficients of the polynomial.  Inserting $ \ z \ = \ -\frac{b}{2a} \ + \ \eta·i \ \ $ yields
$ \ ( \ \eta·i \  )^2 \ + \ \left( \ c \ - \ \frac{b^2}{4a} \ \right) \ = \  c \ - \ \frac{b^2}{4a} \ - \ \eta^2  \ \ , $ which is also a real number.
$$ \ \ $$
Were the coefficients in $ \ p(z) \ \ $ complex numbers, we could also have real numbers "mapped" to non-real numbers (to reply to a comment in the OP).  It would be tedious to run through calculations like those above to verify this statement; instead, we can think about what we know of function transformations.  The complex number $ \ z \ = \ \zeta \ + \ \eta·i \ \ $ can be thought of as a point $ \ ( \ \zeta \ , \ \eta \ ) \ $ in the (complex) plane.  We can look at what $ \ p(z) \ $ "does with" such points.
With the coefficients $ \ a \ , \ b \ , \ c \ $ all real, the portion $ \ a·z \ + \ b \ $ involves a "re-scaling" of $ \ z \ $ following by a "horizontal shift".  For real numbers $ \ ( \ \zeta \ , \ 0 \ ) \ \ , $ they can only be "stretched" ( $ \ a > 1 \ $ ) or "compressed" ( $ \ a < 1 \ $ ) along the $ \ x-$axis and then "shifted" along the same axis, producing another real number $ \ \sigma\ \ . $  Inserting this into $ \ ( \ \sigma \ ) · x \ + \ c \ $ will then lead to another horizontal re-scaling and horizontal shift.  Thus, real numbers are transformed only to real numbers.
If the "re-scaling" coefficient is a complex number, however, "points" are not only "expanded or contracted" about the origin, but also revolved about the origin by a certain angle.  Continuing the discussion for real coefficients, "points"  $ \ ( \ \zeta \ , \ \eta \neq 0 \ ) \ \   $ not on the $ \ x-$axis will be pushed radially outward or drawn radially inward toward the origin and then shifted horizontally.  The "transformed" points are still not on the $ \ x-$axis, so $ \ \sigma \ $ is complex :  this means that $ \ ( \ \sigma \ ) · x \ + \ c \ $ will lead to another rotation about the origin before the final horizontal shift by $ \ c \ \ . $  There will be certain "points" that end up rotated onto the $ \ x-$ axis before this final shift, so it is possible to have particular non-real numbers transformed by $ \ p(z) \ $ to real numbers.
By permitting the coefficients of $ \ p(z) \ $ to be complex numbers, all non-zero real numbers $ \ ( \ \zeta \neq 0 \ , \ 0 \ ) \ $ are rotated off the $ \ x-$axis by the "re-scaling" $ \ a \ \ ; $ the subsequent shift by complex $ \ b \ $ translates all points in the complex plane in a direction generally not aligned with either coordinate axis.  This is the "mixing" of real numbers into non-reals mentioned above.  The next stage $ \ ( \ \sigma \ ) · x \ + \ c \ $ is then another re-scaling, rotation and translation, which will generally "send" real and non-real numbers alike to complex numbers, except for "special points" which will end up on the $ \ x-$axis.
