Why dense subsets are convenient to prove theorems 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)$?
 A: Let's say you wanted to prove that the sum of the Riemann (or Lebesgue) integrals of two real-valued functions with the same domain is equal to the integral of the sum.  (We assume, of course, that each of the two functions is integrable in the required sense.)
To do this, we first prove this property for step functions (for Riemann integrals) or for simple functions (for Lebesgue integrals).  E.g., for Lebesgue integrals, the simple functions are dense in the $L^{1}$-space, so for two general functions $f, g$, the result
$$
\int f + \int g = \int (f + g)
$$
follows by: approximating each of $f, g$ by simple functions $s_{f}, s_{g}$ with accuracy within $\epsilon/2$ in the sense of the $L^{1}$-distance.  For the functions $s_{f}, s_{g}$, the desired equality is verifiable more or less directly.  Therefore, we obtain that
$$
|\int f + \int g - \int (f + g)| < \epsilon.
$$
This is one for every positive $\epsilon$, so
$$
|\int f + \int g - \int (f + g)| = 0.
$$
Another example is the proof of Plancherel's Theorem.
A: Consider this statement: if $f\colon\mathbb{R}\longrightarrow\mathbb R$ is continuous and such that$$(\forall x,y\in\mathbb{R}):f(x+y)=f(x)+f(y)\text,$$then there is a $c\in\mathbb R$ such that$$(\forall x\in\mathbb{R}):f(x)=cx.$$In order to prove it, take $c=f(1)$. It is easy to prove by induction that$$(\forall n\in\mathbb{N}):f(n)=cn.$$Furthermore, $f(0)=f(0+0)=f(0)+f(0)$ and so $f(0)=0=c\times0$. On the other hand, if $n\in\mathbb N$, $0=f(0)=f\bigl(n+(-n)\bigr)=f(n)+f(-n)$, and so $f(-n)=-f(n)=-cn=c\times(-n)$. So$$(\forall n\in\mathbb{Z}):f(n)=cn.$$It is now easy to prove that$$(\forall q\in\mathbb{Q}):f(q)=cq.$$But how do you prove now that$$(\forall x\in\mathbb{R}):f(x)=cx?$$Simple: you use the fact that $\mathbb Q$ is dense in $\mathbb R$.
A: Let $B$ be a dense subset of $A$. Suppose property $P$ is preserved under limits and we know that every point in $B$ satisfies property $P$. 
Now pick an arbitrary point of $A$, say $a$. Then $a=\lim_n b_n$ of elements in $B$ each of which have the property and since our property even holds for the limit, it holds for $a$.
Motivation: The best and most relevant examples of this occur when you are working in a space $X$ where your points are functions. So we can talk about several properties like continuous, (insert-mathematician's name)-integrable, differentiable, bounded, harmonic, analytic, etc. 
To give but one important example to highlight the importance of such a notion, let me mention that there have been entire generations of mathematicians whose illustrious careers were dedicated to studying the conditions under which the integral of a limit of functions is the limit of the integral.
A: 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.
