TITLE: Cardinality of the set of all functions from blank to blank
QUESTION [6 upvotes]: I'm trying to determine if a bunch of examples constitute countable or uncountable sets.  One of which is the set of all functions from the positive integers to the positive integers.  Word on the street is that it's uncountable, but I can't really convince myself.  My (probably wrong) logic is as follows.  Each function is a subset of $A = \mathbb Z^+ \times \mathbb Z^+$.  $A$ is countable, so each function is countable since each is a subset of $A$.  The set in question is the union of all said functions, each of which is countable.  Hence since a union of countable sets is countable, the set of all functions from $\mathbb Z^+$ to $\mathbb Z^+$ is countable.  I'm bracing myself for when you guys to point out the fail!  (And hopefully rewire my faulty logic.)

REPLY [2 votes]: Let $\mathcal{A}$ denote the set of all functions from $\mathbb{N} \rightarrow \mathbb{N}$. The claim is that $\mathcal{A}$ is uncountable. To prove this suppose not, i.e. that $\mathcal{A}$ is countable. Let $(f_n)_{n \in \mathbb{N}}$ be a countable enumeration of all functions in $\mathcal{A}$. Define $f : \mathbb{N} \rightarrow \mathbb{N}$ as follows: 
$h(n) = f_n(n) + 1$
Clearly $h$ is a function from $\mathbb{N} \rightarrow \mathbb{N}$. Hence $h \in \mathcal{A}$. But $h \neq f_n$ for any $n$ since $h(n) = f_n(n) + 1 \neq f_n(n)$. So $\mathcal{A}$ could not have been countable.  

Indeed, each function $f : \mathbb{N} \rightarrow \mathbb{N}$ is countable. But why are you taking countable union of countable sets? What you want to know is the number of functions $f : \mathbb{N} \rightarrow \mathbb{N}$. When you say, "A is countable, so each function is countable since each is a subset of A. The set in question is the union of all said functions, each of which is countable. Hence since a union of countable sets is countable," it appears that you are already assuming you have a countable number of functions. What is the countable union suppose to signify.