[proofplan]
We count algebraic numbers by first counting the integer [polynomials](/page/Polynomial%20Ring) that can define them. For each fixed degree, an integer polynomial is determined by its finite tuple of coefficients, so the set of such polynomials is [countable](/page/Countable%20Set). The algebraic numbers are then covered by the union of the finite root sets of these countably many polynomials, and the countable union theorem gives countability.
[/proofplan]
[step:Parametrize fixed-degree integer polynomials by coefficient tuples]
Fix $d \in \mathbb{N}$. Define $P_d$ to be the set of all non-zero polynomials $p: \mathbb{R} \to \mathbb{R}$ with integer coefficients and degree exactly $d$. Define the coefficient map
\begin{align*}
\Phi_d: P_d &\to \mathbb{Z}^{d+1} \\
a_d x^d + a_{d-1}x^{d-1} + \cdots + a_0 &\mapsto (a_d, a_{d-1}, \ldots, a_0).
\end{align*}
This map is injective because two polynomials with the same ordered coefficient tuple have the same coefficient at every power of $x$ and hence are the same polynomial. Its image is
\begin{align*}
\Phi_d(P_d)=\{(a_d,\ldots,a_0)\in \mathbb{Z}^{d+1}: a_d\neq 0\}.
\end{align*}
The set $\mathbb{Z}$ is countable, and repeated application of the [Countability of Product of Natural Numbers](/theorems/754), together with the standard countability of finite Cartesian products of countable sets, gives that $\mathbb{Z}^{d+1}$ is countable. Since $P_d$ injects into the countable set $\mathbb{Z}^{d+1}$, $P_d$ is countable.
[guided]
Fix $d \in \mathbb{N}$. We want to count all integer polynomials of degree exactly $d$ by replacing each polynomial with the finite list of its coefficients. Define $P_d$ to be the set of all non-zero polynomials $p: \mathbb{R} \to \mathbb{R}$ with integer coefficients and degree exactly $d$.
Define the coefficient map
\begin{align*}
\Phi_d: P_d &\to \mathbb{Z}^{d+1} \\
a_d x^d + a_{d-1}x^{d-1} + \cdots + a_0 &\mapsto (a_d, a_{d-1}, \ldots, a_0).
\end{align*}
This is the right map because a polynomial of degree $d$ is completely determined by its coefficients from degree $d$ down to degree $0$. If $\Phi_d(p)=\Phi_d(q)$ for two polynomials $p,q \in P_d$, then $p$ and $q$ have the same coefficient at each power $x^k$ for $0\leq k\leq d$, so $p=q$. Thus $\Phi_d$ is injective.
The image of $\Phi_d$ is exactly
\begin{align*}
\{(a_d,\ldots,a_0)\in \mathbb{Z}^{d+1}: a_d\neq 0\},
\end{align*}
because degree exactly $d$ means that the leading coefficient $a_d$ is non-zero. This set is a subset of $\mathbb{Z}^{d+1}$.
The integer set $\mathbb{Z}$ is countable. Applying the [Countability of Product of Natural Numbers](/theorems/754) repeatedly, and using the standard transfer of countability along bijections between countable sets, every finite Cartesian product of copies of $\mathbb{Z}$ is countable. Hence $\mathbb{Z}^{d+1}$ is countable. Since $P_d$ injects into the countable set $\mathbb{Z}^{d+1}$, $P_d$ is countable.
[/guided]
[/step]
[step:Collect all positive-degree integer polynomials into one countable set]
Define $P$ to be the set of all non-zero integer-coefficient polynomials $p: \mathbb{R}\to\mathbb{R}$ with positive degree. Since every such polynomial has a unique degree $d\in\mathbb{N}$,
\begin{align*}
P=\bigcup_{d\in\mathbb{N}} P_d.
\end{align*}
The indexing set $\mathbb{N}$ is countable, and each $P_d$ is countable by the previous step. Therefore the [Countable Union of Countable Sets](/theorems/755) implies that $P$ is countable.
[/step]
[step:Cover the algebraic numbers by finite root sets]
For each $p\in P$, define its real root set by
\begin{align*}
R(p)=\{x\in\mathbb{R}:p(x)=0\}.
\end{align*}
By the [Factor Theorem](/theorems/3235), a non-zero polynomial of degree $d$ has at most $d$ real roots, so $R(p)$ is finite for every $p\in P$. Since every finite set is countable, each $R(p)$ is countable.
We now identify the algebraic numbers with the union of these root sets:
\begin{align*}
\mathbb{A}=\bigcup_{p\in P} R(p).
\end{align*}
The inclusion $\subset$ holds because if $x\in\mathbb{A}$, then by definition $x$ is a real root of some non-zero integer-coefficient polynomial. Such a polynomial cannot have degree $0$, since a non-zero constant polynomial has no roots, so it belongs to $P$, and hence $x\in R(p)$ for some $p\in P$. The reverse inclusion holds because every element of $R(p)$ is a real root of a non-zero polynomial with integer coefficients, hence is algebraic.
The set $P$ is countable by the previous step, and each $R(p)$ is countable. Applying the [Countable Union of Countable Sets](/theorems/755) to the family $(R(p))_{p\in P}$ gives that $\mathbb{A}$ is countable.
[guided]
For each polynomial $p\in P$, define the real root set
\begin{align*}
R(p)=\{x\in\mathbb{R}:p(x)=0\}.
\end{align*}
The purpose of this definition is to split the algebraic numbers according to which polynomial they solve.
We first check that each $R(p)$ is small. If $p\in P$ has degree $d$, then the Factor Theorem implies that every distinct real root contributes a distinct linear factor. Therefore a non-zero polynomial of degree $d$ has at most $d$ real roots. Hence $R(p)$ is finite, and every finite set is countable.
Next we prove that the algebraic numbers are exactly the union of these root sets:
\begin{align*}
\mathbb{A}=\bigcup_{p\in P} R(p).
\end{align*}
Let $x\in\mathbb{A}$. By the definition of algebraic number, there is a non-zero polynomial $q:\mathbb{R}\to\mathbb{R}$ with integer coefficients such that $q(x)=0$. The polynomial $q$ cannot have degree $0$, because a non-zero constant polynomial has no roots. Thus $q\in P$, and so $x\in R(q)\subseteq \bigcup_{p\in P}R(p)$.
Conversely, let $x\in\bigcup_{p\in P}R(p)$. Then there exists $p\in P$ such that $x\in R(p)$. By the definition of $R(p)$, this means $p(x)=0$. Since $p$ is a non-zero polynomial with integer coefficients, $x$ is algebraic. Therefore $x\in\mathbb{A}$.
Now we apply the [Countable Union of Countable Sets](/theorems/755). The indexing set $P$ is countable by the previous step, and for every $p\in P$ the set $R(p)$ is countable because it is finite. Hence the union
\begin{align*}
\bigcup_{p\in P}R(p)
\end{align*}
is countable. Since this union equals $\mathbb{A}$, the set of algebraic numbers is countable.
[/guided]
[/step]