Elementary question about Cayley Hamilton theorem and Zariski topology

A question about a proof of Cayley's Hamilton theorem using Zariski topology.

"The set $C$ of all matrices of size $n \times n$ (over an algebraically closed field $k$) with distinct eigenvalues is dense in the Zariski topology".

Can we argue as follows?

Since non-empty open sets in the Zariski topology are dense in $k^{n}$ then we are done if we can show the complement of $C$, i.e the set of all matrices of size $n \times n$ with repeated eigenvalues is open in the Zariski topology.

Now to each matrix $B$ of size $n \times n$ compute its characteristic polynomial $p_{B}$ and associate to this polynomial its discriminant $D(p_{B})$. Now define a map:

$f: \mathbb{A}^{n^{2}} \rightarrow \mathbb{A}^{1}$ given by $f(B)=D(p_{B})$ where where $\mathbb{A}^{n}$ denotes the $n$-affine space. I'm identifying here $\mathbb{A}^{n^{2}}$ with the set of all matrices $n \times n$ over an algebraically closed field $k$.

Here is my question. How do we know the map $f$ is continuous with respect the Zariski topology? If we can show it is continuous aren't we done? because we can take $\{0\}$ this is closed in $\mathbb{A}^{1}$ because it is finite, so by continuity of $f$, $f^{-1}(\{0\})$ is closed in $\mathbb{A}^{n^{2}}$ but this preimage is exactly the set of all matrices with repeated eigenvalues.

-

This map is not only continuous. It is a actually a morphism of algebraic varieties. To see this note that the characteristic polynomial of a matrix is a polynomial whose coefficients are polynomials in the entries of the matrix. This is because it is equal to $\det(tI-A)$, and the determinant of a matrix is a polynomial in its entries. Also, the discriminant of a polynomial is again, a polynomial in its coefficients, so we see that this map is a polynomial in the entries of $A$.
Thanks. so basically it is because the map $f$ is a regular function (being a polynomial essentially) and regular maps are continuous in the Zariski topology? –  user6495 Mar 21 '11 at 20:53
$f$ is a polynomial hence it's continuous wrt. Zariski topology. You are almost done:you need to show that the complement of $f^{-1}(0)$ is non-empty, and this you know as there is matrix with different eigenvalues (eg. a suitable diagonal matrix)