[proofplan]
We use the monomial basis of the [polynomial ring](/page/Polynomial%20Ring). First write $f$ as a finite $k$-linear combination of monomials $x^\alpha$, then group those monomials according to their total degree $|\alpha|$. This gives the required homogeneous summands. Uniqueness follows because monomials form a $k$-basis of $k[x_1,\ldots,x_n]$, so comparing coefficients degree by degree forces every homogeneous component to be the one constructed.
[/proofplan]
custom_env
admin
[step:Expand the polynomial in the monomial basis]
Define $\mathbb{N}_0 := \mathbb{N} \cup \{0\}$. For $\alpha = (\alpha_1,\ldots,\alpha_n) \in \mathbb{N}_0^n$, define the monomial $x^\alpha := x_1^{\alpha_1}\cdots x_n^{\alpha_n}$ and its total degree $|\alpha| := \alpha_1+\cdots+\alpha_n$.
The polynomial ring $k[x_1,\ldots,x_n]$ is the free $k$-[vector space](/page/Vector%20Space) with basis the monomials $x^\alpha$, where $\alpha \in \mathbb{N}_0^n$. Hence there is a finite subset $A \subset \mathbb{N}_0^n$ and coefficients $c_\alpha \in k$ for $\alpha \in A$ such that $f = \sum_{\alpha \in A} c_\alpha x^\alpha$.
[/step]
custom_env
admin
[step:Group the monomial terms by total degree]For each $d \in \mathbb{N}_0$, define
\begin{align*}
A_d := \{\alpha \in A : |\alpha| = d\}.
\end{align*}
Define $f_d \in k[x_1,\ldots,x_n]$ by
\begin{align*}
f_d := \sum_{\alpha \in A_d} c_\alpha x^\alpha.
\end{align*}
If $A_d=\varnothing$, this sum is the zero polynomial.
Every monomial appearing in $f_d$ has total degree $d$, so $f_d \in k[x_1,\ldots,x_n]_d$. Since $A$ is finite, only finitely many sets $A_d$ are nonempty. Therefore only finitely many $f_d$ are nonzero. Summing over all degrees recovers the original polynomial:
\begin{align*}
\sum_{d=0}^{\infty} f_d = \sum_{d=0}^{\infty}\sum_{\alpha \in A_d} c_\alpha x^\alpha = \sum_{\alpha \in A} c_\alpha x^\alpha = f.
\end{align*}[/step]
custom_env
admin
[guided]From the monomial-basis expansion already fixed above, there is a finite set $A \subset \mathbb{N}_0^n$ and coefficients $c_\alpha \in k$ for $\alpha \in A$ such that
\begin{align*}
f = \sum_{\alpha \in A} c_\alpha x^\alpha.
\end{align*}
The construction is to separate these finitely many terms by their total degree. For a fixed degree $d \in \mathbb{N}_0$, the set
\begin{align*}
A_d := \{\alpha \in A : |\alpha| = d\}
\end{align*}
collects exactly the exponent vectors whose monomials have total degree $d$. We then define
\begin{align*}
f_d := \sum_{\alpha \in A_d} c_\alpha x^\alpha.
\end{align*}
If there are no degree-$d$ monomials in $f$, then $A_d=\varnothing$ and $f_d=0$. This convention is compatible with the statement because $k[x_1,\ldots,x_n]_d$ includes the zero polynomial.
Now each nonzero term of $f_d$ is a scalar multiple of a monomial $x^\alpha$ with $|\alpha|=d$. By the definition of a [homogeneous polynomial](/page/Homogeneous%20Polynomial) of degree $d$, this means $f_d$ is homogeneous of degree $d$, unless it is zero; in either case,
\begin{align*}
f_d \in k[x_1,\ldots,x_n]_d.
\end{align*}
Only finitely many $f_d$ can be nonzero because they are built from the finite set $A$ of monomials appearing in $f$. Finally, the sets $A_d$ partition $A$ according to total degree, so summing the grouped pieces gives back exactly the original monomial expansion:
\begin{align*}
\sum_{d=0}^{\infty} f_d = \sum_{d=0}^{\infty}\sum_{\alpha \in A_d} c_\alpha x^\alpha = \sum_{\alpha \in A} c_\alpha x^\alpha = f.
\end{align*}
The first sum is finite in effect, because all but finitely many $A_d$ are empty.[/guided]
custom_env
admin
[step:Compare monomial coefficients to prove uniqueness]
Suppose $(g_d)_{d \in \mathbb{N}_0}$ is another family such that $g_d \in k[x_1,\ldots,x_n]_d$ for every $d$, all but finitely many $g_d$ are zero, and $f = \sum_{d=0}^{\infty} g_d$. Let $E \subset \mathbb{N}_0$ be the finite set of indices $d$ such that $g_d \neq 0$. For every $d \in \mathbb{N}_0$, choose coefficients $b_{d,\alpha} \in k$ for the finitely many $\alpha \in \mathbb{N}_0^n$ with $|\alpha|=d$ as follows: if $d \in E$, use the monomial coefficients of the homogeneous polynomial $g_d$, and if $d \notin E$, set $b_{d,\alpha}=0$ for every such $\alpha$. Then, for every $d \in \mathbb{N}_0$, we have $g_d = \sum_{|\alpha|=d} b_{d,\alpha} x^\alpha$, where coefficients not occurring in $g_d$ are taken to be $0$.
Extend the coefficients $c_\alpha$ by setting $c_\alpha=0$ for $\alpha \notin A$. For any fixed $\alpha \in \mathbb{N}_0^n$, the monomial $x^\alpha$ can occur only in the homogeneous component of degree $|\alpha|$. Comparing the coefficient of $x^\alpha$ in $f = \sum_{d \in E} g_d$ therefore gives $c_\alpha = b_{|\alpha|,\alpha}$. Thus, for every $d \in \mathbb{N}_0$, the degree-$d$ monomial coefficients of $g_d$ agree with those of $f_d$. Since monomials form a $k$-basis of $k[x_1,\ldots,x_n]$, it follows that $g_d = f_d$ for every $d \in \mathbb{N}_0$. Hence the family constructed above is unique.
[/step]