This is question 1.27 from Fulton's textbook: http://www.math.lsa.umich.edu/~wfulton/CurveBook.pdf (the very top of page 9).
1.27. Let $V, W$ be algebraic sets in $\mathbb{A}^n(k)$, with $V\subset W$. Show that each irreducible component of $V$ is contained in some irreducible component of $W$.
By a theorem, we have the unique writing $W = \displaystyle\bigcup_{i=0}^{n} w_i$ where the $w_i$ are disjoint and irreducible.
My idea is that for $V$ we will have $V = \displaystyle\bigcup_{i=0}^{n} (V\cap w_i)$ where the $(V\cap w_i)$ are the irreducible components. It's clear that their union is $V$ and that they are mutually disjoint, but I have no idea how to prove they are irreducible. I have tried assuming there are algebraic sets such that $A\cup B = V \cap w_i$ for fixed $i$, and hoping to contradict the irreducibility of $w_i$ with some set algebra, but I didn't get very far.
My question boils down to: Are these the irreducible components of $V$? (and if so, how could I show they are irreducible?) If not, hints towards a solution would be appreciated.
Just to sum up some discussion from the comments: your idea doesn't quite work but it's not so far off, either. A good example of something reducible is the the cross cut out by $xy = 0$ in $\mathbb{A}^2$. It has two irreducible components which meet at the origin, whereas the plane is irreducible.
However, you can show -- and Fulton likely uses this to prove the uniqueness of the irreducible components -- that if $X$ is irreducible and contained in a finite union of closed subsets $Y_1, \dots, Y_n$ then $X$ has to be contained in one of the $Y_i$; this might remind you of a fact about prime numbers.