# Real analysis

Real analysis is a field in mathematics that focuses on the properties of real numbers, sequences and functions. Included in this branch of mathematics are the concepts of limits and convergence, calculus, and properties of functions such as continuity. It also includes measure theory.
For the purposes of this article, "analysis" will be limited to the generalization and extension of the concepts of calculus, using the concepts of elementary point-set topology.
The reader should be quite familiar with the concepts of calculus, especially limits and continuity.

## Open sets

Open sets (and, by extension, closed sets, which are just the complements of open sets) are the fundamental concept of analysis. Analysis and topology are really just the study of open sets.
Before giving the definition of open sets in Euclidean space, we present some examples. Readers who are aware of the general intuitive notion of open sets should find these examples familiar.

### In one dimension

The simplest open sets in 1-dimensional Euclidean space (formally called $\mathbb {R} ^{1}$; informally called the real numbers or the "real line") are open intervals. An open interval consists of those numbers lying strictly between two endpoints a and b. In set-theoretic notation:
       $\{x\ |\ a<x<b\}\,$
A shorter notation for this set consists of the two endpoints in parentheses:
       $(a,b)\,$
A closed interval (we will have more to say about closed sets later) would include the endpoints. It is commonly denoted with brackets:
       $[a,b]=\{x\ |\ a\leq x\leq b\}$
An interval that includes one endpoint but not the other is called semi-open:
       $[a,b)=\{x\ |\ a\leq x<b\}$
       $(c,d]=\{x\ |\ c<x\leq d\}$
When drawing pictures of intervals, those same symbols are typically used:
             Need a picture here!
Open intervals are not the only open sets. Any union of open intervals is an open set. For example:
       $\bigcup _{N\geq 2}(N,N+1/N)$
Bizarrely defined sets like the one above are commonly used as examples and counterexamples in analysis and topology.

### In two or more dimensions

In two or more dimensions the situation becomes more complicated, because even simple open sets can come in an endless variety of shapes. The fundamental open set (equivalent to an open interval) is the open neighborhood, also called an open ball. An open neighborhood has a center point and a nonzero radius, and is the set of all points whose distance from the center is strictly less than that radius. In set-theoretic notation:
       $\{x\ |\ \|x-C\|<r\}\,$
The double-stroke absolute value sign is the norm or the metric distance function. In the common case it is the Euclidean/Pythagorean distance:
       $\|a-b\|={\sqrt {(a_{1}-b_{1})^{2}+(a_{2}-b_{2})^{2}}}\,$ in two dimensions (similarly for higher dimensions)
The double-stroke absolute value sign is similar to the usual absolute value operation, generalized to arbitrary dimensions or other metric spaces.
It is easy to see that, in two dimensions, an open neighborhood is the interior of a circle. It does not include the actual boundary of the circle, because it consists of the points whose distance from $C$ is strictly less than $r$. This point is crucial—the whole subject of analysis and topology depends on it!
To draw a picture of an open neighborhood, use a circle bounded by a dotted line. To make a closed ball, the formula would be:
       $\{x\ |\ \|x-C\|\leq r\}\,$
and the picture would be a solid circle. But open neighborhoods are the important sets from a theoretical standpoint.

## Definition of open set

Here is the proper theoretical definition:
Definition: A set is open if it contains a neighborhood of each of its points.
What this means is that a set $U$ is open if, for every point $x$ in $U$, there is a neighborhood $N$ such that $x\in N$ and $N\subseteq U$. This construction is shown in the diagram at the right.
If the point $x$ were allowed to lie exactly on the edge of $U$, it wouldn't be possible to draw a nonzero neighborhood around $x$ that lies in $U$. So the important feature of $U$'s openness is that none of its points can lie exactly on its edge. Every point in $U$ must be some finite distance back from the edge, which makes it possible to draw a neighborhood around it.

## Theorems

Here are a few extremely fundamental and far-reaching theorems. Some of them are surprisingly simple:
Theorem: Neighborhoods are open sets.
Proof: Suppose a neighborhood has center $C$ and radius $r$. If a point $x$ is in that neighborhood, its distance from $C$ must be strictly less than $r$, call it $k$.
       $\|x-C\|=k,\ \ \ k<r\,$
Place a new neighborhood, of radius $(r-k)/2$, around $x$. Every point in that neighborhood has a distance less than $k+(r-k)/2$ from $C$. That distance is less than $r$, so every point in the new neighborhood is in the original neighborhood, so the new neighborhood lies within the original one.
Theorem: Any union of open sets, including unions of an infinite number of open sets, is an open set.
Proof: If a point $x$ lies in the union, it must lie within one of the constituent open sets. There must be a neighborhood of $x$ contained in that constituent open set. That neighborhood must be contained in the union.
Theorem: The intersection of two open sets is an open set.
Proof: Let $X=P_{1}\cap P_{2}$, and let $x\in X$. Then $x\in P_{1}$ and $x\in P_{2}$. Since $P_{1}$ and $P_{2}$ are open, there must be neighborhoods $N_{1}\subseteq P_{1}$ and $N_{2}\subseteq P_{2}$ that contain $x$. Whichever of those two neighborhoods has the smaller radius will be a subset of both $P_{1}$ and $P_{2}$, so it will be a subset of $X$.
This theorem can be extended for any finite intersection, but it does not work for infinite intersections. Here is an example:
Let $P_{i}$ be an infinite sequence of ever-decreasing open intervals:
       $P_{i}=\{x\ |\ -1-1/i<x<1+1/i\}\,$
for integer $i\geq 1$ The intersection of all of the $P_{i}$'s is the closed interval
       $[-1,1]\,$
which is not open.
So the topological rule of thumb is:
       Any union of open sets is open.
       Any finite intersection of open sets is open
Theorem: The null set (empty set) is open.
Proof: It needs to contain a neighborhood of each of its points. But it has no points.
Theorem: The entire space is open.
Proof: We need a neighborhood of each point in the space. The neighborhood centered on that point, with radius 1, will do the trick.
This means that the real line is open. It is not an open interval, because that interval would have to be "$(-\infty ,\infty )$", and infinity is not a number. The real line is an open set, because it is:
       $\mathbb {R} ^{1}=\bigcup _{n}\ (n-1,n+1)$
over all integers $n$. (Infinite unions are allowed, even though infinity is not a number.)
Theorem: Every open set is a union of neighborhoods.
Proof: It contains a neighborhood of each of its points; those are its constituent neighborhoods.
This means that any open set in the plane, for example, is a union of open circles. (It is also the union of open rectangles, open diamonds, open 5-pointed stars, and so on. This is a consequence of the invariance of the metric in defining a topology.)
In the field of topology, a collection of open sets, whose unions comprise all of the open sets that exist, is called a basis. So what we have just shown is that the open neighborhoods (open intervals, open circles, open spheres, etc.) are a basis for the topology of finite-dimensional Euclidean spaces.

## Closed sets

Definition: A set is closed if its complement is open.
That's all there is to it.
Because of some simple theorems of set theory, including DeMorgan's laws, some of the preceding theorems relating to open sets can be reformulated for closed sets.
    Any intersection of closed sets, including the intersection of an infinite number of closed sets, is closed.
    Any union of a finite number of closed sets is closed.
    The null set is closed.
    The entire space (for example, the real line) is closed.
As before, the null set, and the entire real line, are closed sets, but they are not closed intervals.
Exercise: Show that any closed interval $[a,b]=\{x\ |\ a\leq x\leq b\}$ is in fact a closed set by this definition.

## Limit points, and the other definition of closed sets

Closed sets are often given a different definition, as sets containing their limit points.
Definition: A point x is a limit point of a set S if every open set containing x has nonempty intersection with S.
Limit points include points "lying on the edge" of a set, whether they are actually in the set or not. The point (x=1, y=0) is on the edge of the unit open disk
    $\{x,y\ |\ {\sqrt {x^{2}+y^{2}}}<1\}\,$
and is a limit point, even though it is not actually in the open disk. It is also a limit point of the unit closed disk
    $\{x,y\ |\ {\sqrt {x^{2}+y^{2}}}\leq 1\}\,$
and is in the closed disk. (We will say more about that phenomenon shortly.)
A wide variety of sets can have limit points. The set of reciprocals of positive integers:
    ${\begin{Bmatrix}{\frac {1}{N}}\ |\ N\in \mathbb {N} ^{+}\end{Bmatrix}}\,$
is neither open nor closed, but it has a limit point at zero.
       Why? Because every open set containing zero must contain a neighborhood of zero. That neighborhood, however small it may be, contains 1/N for some integer N.
Limit points get their name from this. Zero is the limit of the sequence $\{x_{n}=1/n\}\,$, so it is a limit point of the sequence. Whenever a sequence converges, the point to which it converges is a limit point.
Whenever a set of numbers or points has an infinite number of its elements "pile up" at one point, that point is a limit point.
Another name for a limit point is an accumulation point or a cluster point.
Now we get to another very important characterization of closed sets.
Theorem: A set is closed if and only if it contains all of its limit points.
Proof:
First, let C be a closed set, and x be a limit point of C. We will show that $x\in C$. Let $U={\overline {C}}$, so U is open.
       Assume $x\notin C$. Then $x\in U$. Since U is open, x has a neighborhood N with $x\in N\subseteq U$.
       This means that $N\cap C=\varnothing$. But x being a limit point of C means that any neighborhood of x intersects C.
Now let C contain all of its limit points, and let $U={\overline {C}}$. We will show that U is open, so C is closed.
       Let $x\in U$. It follows that $x\notin C$, and, since C contains all of its limit points, x is not a limit point of C.
       Therefore, there must be a neighborhood of x that does not intersect C. That neighborhood must therefore be a subset of U.
       So, for every point $x\in U$, there is a neighborhood of x also in U, so U is open, so C is closed.