TITLE: Why dense subsets are convenient to prove theorems
QUESTION [10 upvotes]: Could you please explain the following concept (preferably by examples) about dense subsets:

If you want to prove that every point in $A$ has a certain property that is preserved under limits, then it suffices to prove that every point in a dense subset $B$ of $A$ has that property.

What are the examples of properties that are preserved under limits?
Why is it sufficient to prove such properties for a dense subset $B\subseteq A\subseteq closure(B)$?

REPLY [27 votes]: I will provide two examples in Linear Algebra where density can be exploited in a very slick way.
Plenty of other examples can be found in Approximation Theory and Functional Analysis.
Cayley-Hamilton theorem. If $p$ is the characteristic polynomial of $A$, then $p(A)=0$.
Proof. If $A$ is a diagonalizable matrix the claim is trivial by applying $p$ to the Jordan normal form of $A$. If $A$ is not a diagonalizable matrix, it can be made so by introducing an arbitrarily small perturbation $A\mapsto A_\varepsilon$. Since $p$ is continuous the claim follows by density.
The trace is abelian. We have $\text{Tr}(AB)=\text{Tr}(BA)$.
Proof. If $A$ is invertible then $AB$ and $BA= A^{-1}(AB)A$ are conjugated matrices, hence they have the same characteristic polynomial and the same trace. If $A$ is not invertible, it can be made so by considering $A+\varepsilon I$. Since $\text{Tr}$ is a continuous operator, the claim follows by density.
That should be enough to start understanding why density is really important: it gives us a rigorous way for "cheating", i.e. for working with stronger regularity assumptions.