A question on the compact subset

This is an exercise from a topological book.

Let $X$ is Hausdorff and $K$ is a compact subset of $X$. $\{U_i:i=1,2,...,k\}$ is the open sets of $X$ which covers $K$. How to prove that there exist compact subsets of $X$: $\{K_i:i=1,2,...,k\}$ such that $K=\cup^k_{i=1}K_i$ and for any $i\le k$, $K_i \subset U_i$?

What I've tried: I try to let $K_i = K\cap U_i$, then it is obvious $K=\cup^k_{i=1}K_i$, however, I'm not sure such $K_i$ is still compact in $X$. I don't know how to go on.

Could anybody help me? Thanks ahead:)

-
The intersection of a compact set and an open set is not compact in general, so your attempt doesn't work. – Robert Israel Jul 31 '12 at 7:28
Although I do not know how to approach your problem, maybe you can simplify it by considering $K$ as a subspace of $X$ and $K\cap U_i$ to be an open over of $K$. – Ilya Jul 31 '12 at 7:29
Let $K_i=K\backslash\bigcup_{j\neq i} U_i$. – Michael Greinecker Jul 31 '12 at 7:33
@MichaelGreinecker: Assuming you meant $K \backslash \bigcup_{j \ne i} U_j$, the union of those may not be all of $K$. – Robert Israel Jul 31 '12 at 7:34
Hmm, that's right. – Michael Greinecker Jul 31 '12 at 7:36

If $x \in U_i$, since $K \backslash U_i$ is compact we can take disjoint open neighbourhoods $V$ and $W$ of $x$ and $K \backslash U_i$ respectively. Then the closure of $V$ is contained in $U_i$. And so each $x \in K$ has an open neighbourhood $V_x$ whose closure is contained in some $U_i$. These form an open cover of $K$, so we can take a finite subcover $V_1, \ldots, V_m$. Let $K_i$ be the union of the closures of those $V_j$ whose closures are contained in $U_i$.
I still have something I don't know. Why for each $x \in K$ has an open nbhd $V_x$ whose closure is contained in some $U_i$. In my opinion, only the point $x \in K\cap U_i$ has such nbhd. Could you explain more for me? – Paul Jul 31 '12 at 8:20
@Paul: But any point of $K$ can be that $x$ (since it's in some $U_i$) – Robert Israel Jul 31 '12 at 16:15
Right. And what makes sure that for any $i\le k$, $K_i$ is compact? – Paul Aug 1 '12 at 7:00
Sorry, Robert. This is what i want to know: why every the closure of $V_j$ is compact? Because the closure are in the some $U_i$? However, this is not correct, I think. – Paul Aug 1 '12 at 7:35