Arranging $\mathbb N$ into a two-dimensional array to prove a countably infinite collection of countable sets is countable.

If $A_n$ is a countable set for each $n \in\mathbb N,$ then $$\bigcup_{n=1}^\infty A_n$$ is countable. How does arranging the natural numbers in a two-dimensional array allow one to show the statement given in the title?

Is it that, given any set $A_i$, being countably infinite, is in bijection with the $i$-th row of that two-dimensional array, itself being countably infinite, and therefore the collection of the sets $A_i$ is in the bijection with the set of rows in that two-dimensional array, which of course is in bijection with the natural numbers?

Since each $A_n$ is countable, there exists, for each $n$, a bijective function $f_n : \mathbb N \to A_n$.
Using these $f_n$'s, we can define a function $f : \mathbb N \times \mathbb N \to \cup_{n=1}^\infty A_n$, which sends each $(n, m) \in \mathbb Z \times \mathbb Z$ to the element $f_n(m) \subset A_n\subset \bigcup_{n = 1}^\infty A_n$. Clearly, this function $f$ is surjective.
So we have exhibited a surjective function $f$ from the countable set $\mathbb N \times \mathbb N$ onto the set $\bigcup_{n = 1}^\infty A_n$. Hence $\bigcup_{n=1}^\infty A_n$ is countable.
[The set $\mathbb N \times \mathbb N$ in this answer is the "two-dimensional array" referred to in your hint.]
• It probably deserves to be noted that you need the axiom of choice (or some variant of it) to be able to decide on all of the $f_n$s at the same time such that you can use them to construct a single function $\mathbb N\times\mathbb N\to\bigcup_n A_n$. – Henning Makholm May 31 '18 at 17:59
• The statement "Using these $f_n$'s...." implicitly assumes Choice... WHICH $f_n$'s??? What we know is that for each $n$ the set $S_n$ of bijections from $\Bbb N$ to $A_n$ is not empty. The axiom of Choice is needed to prove that there exists a function $g:\Bbb N\to \cup_{n\in \Bbb N}S_n$ such that $\forall n\;(g(n)\in S_n).$ So for any such $g$ we can re-name $g(n)$ as $f_n$, so as to conclude that there exists a sequence $(f_n)_{n\in \Bbb N}$ where$f_n\in S_n$ for every $n.$ – DanielWainfleet Jun 1 '18 at 5:31
{"ft_lang_label":"__label__en","ft_lang_prob":0.9264034,"math_prob":0.99973255,"size":556,"snap":"2019-26-2019-30","text_gpt3_token_len":142,"char_repetition_ratio":0.13405797,"word_repetition_ratio":0.022727273,"special_character_ratio":0.23920864,"punctuation_ratio":0.09090909,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.99999654,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2019-06-24T21:36:36Z\",\"WARC-Record-ID\":\"<urn:uuid:a980ad50-ad55-4865-8fc2-9c2535fdebdc>\",\"Content-Length\":\"143450\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:e0d91bbc-7925-4fa0-8dcd-da647d94b0fe>\",\"WARC-Concurrent-To\":\"<urn:uuid:ddf60701-598d-4a73-9fb0-9a56389bf606>\",\"WARC-IP-Address\":\"151.101.193.69\",\"WARC-Target-URI\":\"https://math.stackexchange.com/questions/2803327/arranging-mathbb-n-into-a-two-dimensional-array-to-prove-a-countably-infinite\",\"WARC-Payload-Digest\":\"sha1:JBE5E2WPKL32M5PLIGS5T5SZSJN7WIXG\",\"WARC-Block-Digest\":\"sha1:B34VE2CBEWAHAEOQBCHIQVW42HP5ODWK\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2019/CC-MAIN-2019-26/CC-MAIN-2019-26_segments_1560627999740.32_warc_CC-MAIN-20190624211359-20190624233359-00272.warc.gz\"}"}