Spivak, Chapter 3, Functions, Problem 2ii This problem seemed pretty straightforward and easy, but when I looked at the solution manual, it differed from my answer.
The problem is:

Let $g(x)=x^2$ and let
$$h(x) = \left\{\begin{array}{lr}
         0, & \text{x rational}  \\
         1, & \text{x irrational} \\
         \end{array}\right.$$
$(ii)$ For which y is $h(y)\leq g(y)$?

As I see it, if $y$ is rational, then we have
$$h(y)=0\leq y^2=g(y)\implies y>0$$
If $y$ is irrational
$$h(y)=1\leq y^2=g(y)\implies |y|>1$$
The solution manual has the solution:

y rational between -1 and 1, and all y with |y|>1

But if y is rational and larger than 1, e.g. $y=2$ then
$$h(2)=0\leq 2^2=g(2)$$
Is Spivak Solution manual correct, and if so, why is my solution incomplete or incorrect?
 A: First of all, the definition of $h$ is confusing because you wrote $$h(x,\color{red}{y}) = \begin{cases}0, & x \in \mathbb Q \\ 1, & x \not \in \mathbb Q. \end{cases}$$  (Note:  $\mathbb Q$ is my notation to indicate the set of all rational numbers.)  I believe you meant to write
$$h(x) = \begin{cases}0, & x \in \mathbb Q \\ 1, & x \not \in \mathbb Q. \end{cases}.$$
This definition is what I will assume.
If $y \in \mathbb Q$, then $h(y) \le g(y)$ for all such $y$.  However, you are incorrect if you say this implies $y > 0$.  For instance, $y = -3/2$ is rational and we have $h(-3/2) = 0$, $g(-3/2) = 9/4 > 0$.
If $y \not\in \mathbb Q$, then $h(y) = 1$, hence $g(y) = y^2 \ge h(y) = 1$ if and only if $y^2 \ge 1$ or $|y| \color{red}{\ge} 1$.  You used strict inequality when it should not be strict.  That said, since $1$ is rational, your result is equivalent.
The combination of these two statements is equivalent to Spivak's solution set.  In other words, the union of the set of all rationals and the set of all irrationals with absolute value at least $1$, is equivalent to the union of the set of all rationals with absolute value at most $1$, and the set of all reals with absolute value greater than $1$.  In mathematical notation:
$$\{y \in \mathbb R : (y \in \mathbb Q) \cup (y \in \bar{\mathbb Q} \cap |y| \ge 1)\} = \{y \in \mathbb R : (y \in \mathbb Q \cap |y| \le 1) \cup (|y| > 1) \}.$$  Here, I have used $\bar{\mathbb Q}$ to denote the set of all irrationals.
As for your last question:  $y = 2$ does meet the condition $h(2) \le g(2)$ since $h(2) = 0$ and $g(2) = 4$.  It also is an element in Spivak's solution set, since $|2| > 1$.  I do not see a contradiction here.
