What is the difference between sum and integral? I am a beginner in calculus and I want to know what is the difference between sum and integral. More specifically I came across this example:

Compare $$\sum^\infty_1\frac1x\space \text{and} \space \int_1^\infty\frac1xdx$$

It would be really helpful if someone explains this to me. I want to know the difference between the two.
Thanks for any help!!
 A: Basically, an integral adds up infinitely small pieces, whereas a sum adds up distinct pieces. 
$$
 \int_1^{\infty} xdx\,
$$
Will add up all of the area under f(x)=x, whereas
$$
 \sum_{x=1}^{\infty} x\,
$$
Will add up each value for x from whatever you start, until you stop.
For $f(x)=1/x$ this is the difference between the area under 1/x, and the series $1 + 1/2 + 1/3 + 1/4 +...+ 1/n $ (the harmonic series).
Both of these values diverge.
A: There are many possible answers. In this concrete example we can use the integral test for convergence (https://en.wikipedia.org/wiki/Integral_test_for_convergence) since $\frac{1}{x}$ is decreasing.
Another possible answer is: absolutely convergent series and integrals are the same! This sounds awkward, but that's actually what you will learn when you hear about lebesgue integral. You will see that series are just lebesgue integrals with the counting measure (i.e. a point has "volume" or "measure" 1). In this interpretation, the difference is the measure and the set over which you integrate. "Measure" in the maths sense is an abstract meaning for the volume of subsets.
A: The integral is very closely related to a sum almost like your one, called the Riemann sum. Instead of just adding up the values of the function at different points, the integral adds up the areas of rectangles whose height is one function evaluation, and width is the distance between there and the next one (which is a fixed $\delta x$). It looks like this:
$$ \sum_{i=0}^{N} f(x_i)\delta x \;\;\;\;\;\;  \text{where}\;\; x_i = x_0 + i\delta x $$
The integral is defined roughly as "what happens when the width of these rectangles get really small", which becomes a better approximation of the area under the curve (since more narrower rectangles will conform to the curve better than fewer wider ones). In formal terms, the integral is the limit of the Reimann sum (analogously to how a derivative is the limit of an average gradient):
$$ \int_{x_0}^{x_N} f(x) dx = \lim_{\delta x \to 0} \sum_{i=0}^N x_i \delta x$$
Looking at it in these terms, the difference between the sum and the integral in your question is exactly the difference between that sum and the (limit of the) Reimann sum.
A: As dyang mentions in his answer, if the integral converges then the sum does also; however, if the integral diverges then the sum does also, which is the important one here
$$\int_1^\infty\frac1x\,dx = \lim_{n \to \infty}\int_1^n x^{-1}\,dx = \lim_{n \to \infty} \left(\log x \bigg|_1^n\right) = \lim_{n \to \infty} \log n = \infty \implies \text{Divergence}$$
Since the integral diverges, the sum does also.
