Zariski topology in projective space agrees with Zariski topology in affine

I'm browsing through my notes in algebraic geometry and I'm struggling with a theorem.

So recall that in the Zariski topology in the affine space $\mathbb A^n$ the closed sets are zero loci of polynomials in $k[x_1, x_2,\ldots, x_n]$.

Now consider the projective space $\mathbb P^n$ and its standard cover with affine open sets $\mathbb P^n=U_0\cup U_1\cup \ldots \cup U_n$, where $U_i=\{[x_0, x_2,\ldots, x_n], x_i\ne 0\}$.

Now define the Zariski topology on $\mathbb P^n$ to be the glueing topology, i.e. $X\subset \mathbb P^n$ is closed iff each $X\cap U_i$ is Zariski closed in $U_i$ as an affine set. I want to show that the closed sets in $\mathbb P^n$ are precisely the zero loci of homogeneous polynomials.

While it is easy to show that zero loci of homogeneous polynomials are closed sets in this sense, I cannot show that the converse is also true and I would appreciate some help.

Hint 1: Take a closed set in $C \subset \mathbb{P}^n$, and call $C_i=C \cap U_i$. Then, by definition, each $C_i$ is given as the zero set of some polynomials in $k[x_0/x_i, \ldots, x_n/x_i ]$ (where $x_i/x_i$ is omitted). Now, take those polynomials, and homogenize them: i.e., for a fixed polynomial $P \in k[x_0/x_i, \ldots, x_n/x_i ]$ you consider the biggest power $x_i^d$ appearing at the denominator, and then you consider $x_i^d P \in k[x_0,\ldots,x_d]$. It is a homogeneous polynomial of degree $d$.
Hint 2: You can make it easier if you do a couple of reductions: consider just $C$ irreducible. If you can deal with it, then you just have to discuss what polynomials give $C \cup D$, once both $C$ and $D$ are given by polynomials. Second, using induction on the dimension (i.e. you show your statement is true for $\mathbb{P}^n$ inductively on $n$), you can assume that your irreducible $C$ is not contained in any of the complements of the $U_i$'s (if it was, then it would be contained in $\mathbb{P}^{n-1}$). With these two reductions, you should be able to use the polynomials as in Hint 1 coming just from one of the $C_i$'s.