relation between integral and summation

What is the relation between a summation and an integral ? This question is actually based on a previous question of mine here where I got two answers (one is based on summation notation) and the other is based on integral notation and I do not know yet which one to accept . So I would like to understand the connect between the two ?

Solutions Collecting From Web of "relation between integral and summation"

Let me first elaborate on Ilya’s comment. If you are familiar with measure theory, then integration and summation are both integration, but with respect to different measures. What is thought of as usual integration is integration with respect to the Lebesgue measure $dx$, while summation is integration with respect to the counting measure $\#(dx)$.

To make the connection explicit, we can write the counting measure as
$$ \#(dx) = \sum_n \delta(x-n) dx$$
where $\delta(x)$ is the Dirac $\delta$ distribution. Then
$$ \int f(x) \#(dx) = \sum_n \int f(x) \delta(x-n) dx = \sum_n f(n), $$
where I have used the fact that $\int f(x) \delta(x-x_0) dx = f(x_0)$.

To see that there is something interesting going on here (and this is not just a reworking of definitions), let’s compute this in a different way. The Dirac $\delta$ distribution is the (distributional) derivative of the Heavyside step function $H(x)$ (it takes the value $1$ for $x > 1$ and $0$ otherwise). Then
\begin{align}
\sum_n \int f(x) \delta(x-n) dx
&= \sum_n \int f(x) \frac{d}{dx} H(x-n) dx \\\
\end{align}
Since $H(x-n)$ is constant outside a neighborhood of $n$, we can replace
$$ \int f(x) \frac{d}{dx} H(x-n) dx $$
by
$$ \int_{n-\epsilon}^{n+\epsilon} f(x) \frac{d}{dx} H(x-n) dx. $$
Now apply naive integration by parts:
\begin{align}
\int_{n-\epsilon}^{n+\epsilon} f(x) \frac{d}{dx} H(x-n) dx &= f(n+\epsilon) – \int_{n-\epsilon}^{n+\epsilon} f'(x) H(x-n) dx \\\
&= f(n+\epsilon) – \int_n^{n+\epsilon} f'(x) dx \\\
&= f(n+\epsilon) – (f(n+\epsilon) – f(n)) \\\
&= f(n)
\end{align}
Hence
$$ \sum_n \int f(x) \delta(x-n) dx = \sum_n f(n) $$
as expected.

Now there is another connection between summation and (usual) integration, given by the Euler-Maclaurin formula. The idea is that since
$\int_0^n f(x) dx$ can be approximated by the Riemann sum
$$ \frac{1}{2} f(0) + f(1) + \cdots + f(n-1) + \frac{1}{2} f(n), $$
then there is formula
$$ \sum_{i=0}^n f(i) = \int_0^n f(x)dx + \textrm{higher order corrections} $$
I won’t derive the full formula, but let’s see a simple example. Consider
$ \int_0^1 f(x) dx$. We can integrate by parts taking $u = f(x), v = x$. Then we
have
\begin{align}
\int_0^1 f(x) dx &= \left. x f(x) \right|_0^1 – \int_0^1 x f'(x) dx \\\
&= f(1) – \int_0^1 x f'(x) dx
\end{align}
Hence
$$ f(1) = \int_0^1 f(x) dx + \int_0^1 x f'(x) dx $$
Hence
$$ \sum_{i=1}^n f(i) = \int_0^n f(x) dx + \sum_{i=1}^n \int_{i-1}^{i} (x-i+1) f'(x) dx $$
Note that the error term involves the derivative of $f$. To obtain the full formula, we repeat this trick on the remainder term. This will give a certain weighted sum of $f'(i)$, with an error term involving $f”(x)$. Continuing inductively, we get a formula that is schematically of the form
$$ \sum_n f(n) = \int f(x) dx + \sum_{k=1}^N \sum_n C_{k,n} f^{(k)}(n) + R_N $$
where $C_{k,n}$ are certain constants and $R_N$ is a remainder term that is a certain integral involving the $(N+1)$st derivative of $f$.

Since it is often possible to obtain asymptotics of integrals, this gives an extremely powerful method to find asymptotics of sums.

The summation appears in the definition of the Lebesgue integral.
For a nonnegative measurable function $f$ (or let’s say continuous or piecewise continuous) defined on an interval I, you first consider every step functions $g$ such that $g\leq f$, and you consider the quantity :
$$\sum_{i} g(x_i)\Delta_i$$
where the $i$ index the steps of the function $g$, $g(x_i)$ the value of the function on the corresponding step, and $\Delta_i$ the length of the step.
Then, you take the supremum of this quantity over all such functions $g$. And this is the definition of the integral.
$$\int_If(x)\mathrm dx=\sup_g \sum_{i} g(x_i)\Delta_i$$

The Riemman integral is a particular case of the Lebesgue integral in a simpler framework, and in its definition, the summation appears in a similar way.

In both cases we have a fixed “ground set” $X$ and various functions $f:\ X\to{\mathbb R}$. We want to capture the notion of “overall effect of $f$ on $X$” (or on subsets of $X$) in a single number. Denote the result of this “condensation” process by $I(f,X)$. This process (or function) $I(\cdot,\cdot)$ should have the following properties:
$$I(f+g,X)=I(f,X)+I(g,X)\ ,\qquad I(\lambda \,f, X)=\lambda\, I(f,X)\ ,$$
and when $A$, $B\subset X$ are “essentially disjoint” one should have
$$I(f,A\cup B)=I(f, A)+I(f,B)\ .$$
When the ground set $X$ is countable the simplest function $I(\cdot,\cdot)$ with these properties is just summation: for any subset $A\subset X$ put
$$I(f,A):=\sum_{x\in A} f(x)\ .$$
In this case “essentially disjoint” just means disjoint. A slightly more general “Ansatz” would use a weight function $w:X\to{\mathbb R}_{>0}$ and put
$$I(f,A):=\sum_{x\in A} f(x) w(x)\ .$$
When $X$ is an uncountable set, e.g., $X={\mathbb R}$, or $X$ the set of all binary sequences, then the construction of such an $I(\cdot,\cdot)$ is far from trivial, and the result of such a construction is then called an integral.

The first step is to define a measure on $X$ (for countable $X$ we could just use the counting measure). This is a function $\mu(\cdot)$ that assigns each “reasonable” subset $A\subset X$ its measure (or volume) $\mu(A)\geq0$. For “essentially disjoint” sets $A$, $B$ one should have $\mu(A\cup B)=\mu(A)+\mu(B)$. After such a measure $\mu$ has been set up one can go on and define the corresponding integral
$$I(f,X):=\int_X f(x)\ {\rm d}\mu(x)$$
in a standard way that does not depend on the particular $X$ under consideration, and this integral will have the properties required above.

The Riemann or Lebesgue integral is in a sense an continuous sum. The symbol $\int$ is adapted from a letter looking like a somewhat elongated ‘s’ from the word summa. In the definitions of the Riemann and the Lebesgue integrals the ordinary finite summation $\sum _{k=1}^n$ is used but the relation between the two is deeper than a mere ‘one is used in the definition of the other’ kind of relation.

The modern approach to viewing integrals is measure theory. Without getting into too many technical details one defines a measure space as an abstraction to the notion of measuring length or volume. Then real valued functions on a measurable space may be integrated to give a single real number.

For a particular measure space one gets the Lebesgue integral which itself, in a suitable way, subsumes the Riemann integral. On the other hand, given any set $X$ with $n$ elements there is a measure space structure on it such that for any function $f:X\to \mathbb {R}$ the integral of $f$ with respect to that measure is precisely the sum of the values that $f$ attains. In that sense general measure theory subsumes finite sums (of real numbers). More interestingly, given any countable set $X$ there is a measure on it such that the integral of real values functions on $X$ correspond to the infinite sum of its values. (Both of these remarks are trivial.) Thus measure theory subsumes infinite sums. From that point of view, a summation corresponds to integrals on a discrete measure space and the Lebesgue or Riemann integral corresponds to integrals on a continuous measure space.

[The Summation notation was solved using the logic that the area under a function $f(x)$ is the sum of the rectangles with very very small width.
In this equation the $b/n$ and $a/n$ is the given width, where $n$ approaches infinity ($n$ is the number of rectangles you want it to be divided into).

The length of the rectangle is the value of the function at a given $x$. To use the summation notation $b/n$ and $a/n$ is multiplied to $i$ so as to get the length (value of $f(x)$) as it moves along the function towards the limit ($b$ or $a$) and $i$ approaches $n$.
To calculate the area, the summations for $b$ and $a$ were just simply subtracted with both have reference point from zero.

$$\int_a^b f(x)dx = \frac{b}{n} \sum\limits_{i=1}^n f\left(\frac{bi}{n}\right) – \frac{a}{n} \sum\limits_{i=1}^n f\left(\frac{ai}{n}\right)\text{ where $n \to \infty$}$$