[proofplan]
The polynomial ring $k[X_0, \ldots, X_n]$ has a canonical $\mathbb{N}$-grading by total degree, in which every polynomial $f$ decomposes uniquely as a finite sum of homogeneous parts $f = \sum_d f_{[d]}$. We prove the equivalence by direct double implication. The "if" direction (closure under taking homogeneous parts implies homogeneity) is essentially a relabelling: any generating set can be replaced by the set of all homogeneous parts of its members, which by hypothesis still lie in $I$ and which generate the same ideal. The "only if" direction is the content: given $I$ generated by homogeneous polynomials $f_1, \ldots, f_r$ and an arbitrary $g = \sum_i f_i h_i \in I$, we expand each $h_i$ into its homogeneous parts $h_i = \sum_e (h_i)_{[e]}$ and use that products of homogeneous polynomials are homogeneous of additive degree to extract $g_{[d]}$ as the sum $\sum_i f_i (h_i)_{[d - \deg f_i]}$, which manifestly lies in $I$.
[/proofplan]
[step:Set up the canonical grading and the homogeneous-part decomposition]
The polynomial ring $R := k[X_0, \ldots, X_n]$ carries the standard $\mathbb{N}$-grading by total degree:
\begin{align*}
R = \bigoplus_{d \geq 0} R_d, \qquad R_d := \{\text{homogeneous polynomials of total degree } d\} \cup \{0\}.
\end{align*}
Each $R_d$ is a $k$-vector space spanned by the monomials $X_0^{\alpha_0} \cdots X_n^{\alpha_n}$ with $\alpha_0 + \cdots + \alpha_n = d$. Multiplication respects the grading: $R_d \cdot R_e \subset R_{d+e}$ for all $d, e \geq 0$, since the total degree of a product of monomials is the sum of the total degrees.
Every $f \in R$ has a unique decomposition
\begin{align*}
f = \sum_{d \geq 0} f_{[d]}, \qquad f_{[d]} \in R_d,
\end{align*}
with finitely many non-zero terms (the sum is finite because $f$ has finite total degree). The polynomial $f_{[d]}$ is the \emph{homogeneous part of $f$ in degree $d$}. We refer to this as the \emph{homogeneous decomposition} of $f$. Uniqueness follows from the directness of the sum $R = \bigoplus_d R_d$.
\emph{Definition of homogeneous ideal.} Recall: an ideal $I \subset R$ is \emph{homogeneous} if it can be generated by a (possibly infinite) set of homogeneous elements, i.e. there exist $\{f_\lambda\}_{\lambda \in \Lambda}$ with each $f_\lambda \in R_{d_\lambda}$ for some $d_\lambda \geq 0$, such that $I = (f_\lambda : \lambda \in \Lambda)$.
[/step]
[step:Prove "if": closure under homogeneous parts implies $I$ is homogeneous]
Suppose every $f \in I$ has all homogeneous parts $f_{[d]} \in I$. We construct a generating set for $I$ consisting of homogeneous elements, exhibiting $I$ as a homogeneous ideal.
Define
\begin{align*}
S := \{f_{[d]} : f \in I,\ d \geq 0\} \subset I.
\end{align*}
Each element of $S$ is homogeneous by construction (it lies in some $R_d$), and each is in $I$ by hypothesis. We claim $S$ generates $I$.
Let $J := (S)$ be the ideal generated by $S$ in $R$. Since $S \subset I$, we have $J \subset I$.
For the reverse, let $f \in I$. Decompose $f$ into homogeneous parts:
\begin{align*}
f = \sum_{d=0}^{D} f_{[d]},
\end{align*}
where $D = \deg f$ (only finitely many parts are non-zero). Each $f_{[d]}$ lies in $S \subset J$, and $J$ is closed under sums, so $f \in J$. Hence $I \subset J$, giving $I = J = (S)$.
Since $S$ is a set of homogeneous elements and $I = (S)$, the ideal $I$ is homogeneous by definition.
[/step]
[step:Prove "only if": homogeneity implies closure under homogeneous parts — set up the generating data]
Suppose $I$ is homogeneous. By definition there exists a generating set $\{f_\lambda\}_{\lambda \in \Lambda}$ of homogeneous polynomials, i.e. each $f_\lambda \in R_{d_\lambda}$ for some $d_\lambda \geq 0$, with $I = (f_\lambda : \lambda \in \Lambda)$.
Take any $g \in I$. By definition of the ideal generated by $\{f_\lambda\}$, there is a finite subset $\Lambda_0 \subset \Lambda$ and elements $h_\lambda \in R$ for $\lambda \in \Lambda_0$ with
\begin{align*}
g = \sum_{\lambda \in \Lambda_0} f_\lambda\, h_\lambda.
\end{align*}
For brevity, relabel: write $f_1, \ldots, f_r$ for the chosen generators (with degrees $d_1, \ldots, d_r$) and $h_1, \ldots, h_r$ for the corresponding ring elements, so
\begin{align*}
g = \sum_{i=1}^r f_i\, h_i, \qquad f_i \in R_{d_i}.
\end{align*}
Our task: show that for every $d \geq 0$, the homogeneous part $g_{[d]}$ lies in $I$.
[/step]
[step:Compute $g_{[d]}$ in terms of the homogeneous parts of the $h_i$]
Decompose each $h_i$ into homogeneous parts:
\begin{align*}
h_i = \sum_{e \geq 0} (h_i)_{[e]}, \qquad (h_i)_{[e]} \in R_e.
\end{align*}
Substitute into the expression for $g$:
\begin{align*}
g = \sum_{i=1}^r f_i\, h_i = \sum_{i=1}^r f_i \sum_{e \geq 0} (h_i)_{[e]} = \sum_{i=1}^r \sum_{e \geq 0} f_i\, (h_i)_{[e]}.
\end{align*}
We examine the homogeneity of each summand $f_i\, (h_i)_{[e]}$. Since $f_i \in R_{d_i}$ is homogeneous of degree $d_i$ and $(h_i)_{[e]} \in R_e$ is homogeneous of degree $e$, and multiplication respects the grading ($R_{d_i} \cdot R_e \subset R_{d_i + e}$), the product satisfies
\begin{align*}
f_i\, (h_i)_{[e]} \in R_{d_i + e}.
\end{align*}
Now collect terms in $g = \sum_{i, e} f_i (h_i)_{[e]}$ by total degree. The summand $f_i (h_i)_{[e]}$ contributes to total degree $d = d_i + e$, equivalently $e = d - d_i$ (and only when $d - d_i \geq 0$). By uniqueness of the homogeneous decomposition,
\begin{align*}
g_{[d]} = \sum_{\substack{i, e \\ d_i + e = d}} f_i\, (h_i)_{[e]} = \sum_{i : d_i \leq d} f_i\, (h_i)_{[d - d_i]}.
\end{align*}
This is the key formula.
[guided]
We have written $g$ as a finite sum $g = \sum_i f_i h_i$ with $f_i$ homogeneous of degree $d_i$ and $h_i$ arbitrary. We want to extract the homogeneous part $g_{[d]}$ in a form that makes its membership in $I$ obvious.
\textbf{The strategy.} Decompose each $h_i$ into homogeneous parts and then sort all terms by total degree. The product of two homogeneous things is homogeneous of additive degree, so each piece will land in a single graded component, where it can be matched up with $g_{[d]}$.
\textbf{Decomposing the $h_i$.} For each $i$, write $h_i = \sum_{e \geq 0} (h_i)_{[e]}$ with $(h_i)_{[e]} \in R_e$. Substitute:
\begin{align*}
g = \sum_{i=1}^r f_i\, h_i = \sum_{i=1}^r \sum_{e \geq 0} f_i (h_i)_{[e]}.
\end{align*}
Each individual summand $f_i (h_i)_{[e]}$ is a product of:
\begin{itemize}
\item $f_i \in R_{d_i}$, homogeneous of degree $d_i$ (this is the hypothesis: $I$ is generated by homogeneous polynomials),
\item $(h_i)_{[e]} \in R_e$, homogeneous of degree $e$ (this is the construction: we just decomposed $h_i$).
\end{itemize}
Their product lies in $R_{d_i + e}$ because $R$ is a graded ring: $R_a \cdot R_b \subset R_{a+b}$, the defining property of a graded multiplication.
\textbf{Collecting by total degree.} The expression $g = \sum_{i, e} f_i (h_i)_{[e]}$ is a sum of homogeneous pieces, each in $R_{d_i + e}$. Group them by total degree $d := d_i + e$:
\begin{align*}
g = \sum_{d \geq 0} \left( \sum_{i, e : d_i + e = d} f_i (h_i)_{[e]} \right).
\end{align*}
The inner sum is a sum of elements of $R_d$, hence itself in $R_d$. So the right-hand side is the homogeneous decomposition of $g$, and by uniqueness of that decomposition (Step 1), we identify the inner sum with $g_{[d]}$:
\begin{align*}
g_{[d]} = \sum_{i, e : d_i + e = d} f_i (h_i)_{[e]} = \sum_{i : d_i \leq d} f_i (h_i)_{[d - d_i]}.
\end{align*}
The condition $d_i \leq d$ is needed because $e = d - d_i \geq 0$.
\textbf{Why uniqueness matters.} Without uniqueness of the homogeneous decomposition, we could not conclude that the degree-$d$ piece of $g$ (i.e. $g_{[d]}$) equals the sum of the degree-$d$ terms of our expansion. Uniqueness comes from the fact that $R = \bigoplus_d R_d$ is a direct sum: a polynomial has only one decomposition into homogeneous parts.
\textbf{What we have gained.} The original expression $g = \sum_i f_i h_i$ shows $g \in I$, but does not say anything about its homogeneous parts. The key identity above writes $g_{[d]}$ as an $R$-linear combination of the homogeneous generators $f_1, \ldots, f_r$, so $g_{[d]} \in I$ follows immediately.
[/guided]
[/step]
[step:Conclude $g_{[d]} \in I$ for every $d$]
The identity from Step 4,
\begin{align*}
g_{[d]} = \sum_{i : d_i \leq d} f_i\, (h_i)_{[d - d_i]},
\end{align*}
exhibits $g_{[d]}$ as an $R$-linear combination of the generators $f_1, \ldots, f_r$ of $I$. The coefficients $(h_i)_{[d - d_i]}$ are elements of $R$ (specifically, of $R_{d - d_i}$). Since $I$ is closed under $R$-linear combinations of its generators (this is the definition of an ideal generated by a set), we conclude
\begin{align*}
g_{[d]} \in I \qquad \text{for every } d \geq 0.
\end{align*}
This holds for every $g \in I$ and every $d \geq 0$, so every homogeneous part of every element of $I$ lies in $I$.
[/step]
[step:Combine the two implications]
Step 2 shows: closure under homogeneous parts implies $I$ is homogeneous (in the generated-by-homogeneous-elements sense). Steps 3–5 show: if $I$ is homogeneous, then for every $g \in I$ and every $d \geq 0$, $g_{[d]} \in I$. Combining,
\begin{align*}
I \text{ is homogeneous} \iff \forall f \in I,\ \forall d \geq 0,\ f_{[d]} \in I,
\end{align*}
which is the desired characterisation.
[/step]