Why is the area under $\frac1{\sqrt{x}}$ finite and the area under $\frac1x$ infinite? If this integral is calculated analytically,
$$\int_0^1 \frac1{\sqrt{x}} dx = 2\sqrt{1}-2\sqrt{0}=2.$$
However, the graph of $\dfrac1{\sqrt{x}}\to \infty$ as $x\to 0$, so the area under the  graph should approach infinity.
In contrast, the integral:
$$\int_0^1 \frac1{x} dx = \ln1-\ln0 =\infty.$$
Indeed, the graph of $\dfrac1x\to \infty $as $x\to 0$, so the area under the  graph should approach infinity.
My question: The red line represents $\dfrac1{\sqrt{x}}$ and the blue line represents $\dfrac1x$. How is it that the area under the red line is finite and the area under the blue line is infinite?

 A: There is no contradiction: just because a function goes to $\infty$ at $0$ does not mean its integral near $0$ should be infinite.
If you insist on interpreting the integral as area, here's a way to see that the area under the curve $y = 1/\sqrt{x}$ from $0$ to $1$ is finite. The area under the curve $y = 1/\sqrt{x}$ from $0$ to $1$ is the area of the region bounded by the $x$-axis, the $y$-axis, the line $x=1$, and $y = 1/\sqrt{x}$. But if we think about integrating in the $y$-direction, then this can also be interpreted as the area of the region bounded by $y=0$, $x = 1/y^2$, $x=0$, and $x=1$. This is just given by the integral
$$
1 + \int_1^\infty \frac{1}{y^2}~dy = 1 + 1 = 2.
$$
(The $1$ at the beginning comes from the square from $0$ to $1$. You should draw the region I described to see what I mean.)
Notice how I've computed the area of the same region, but I've managed to avoid any singularities.
In general this is a very common thing in calculus. There are other seemingly unintuitive results, such as a curve of infinite perimeter bounding a finite area (Koch snowflake) or a surface of revolution with infinite surface are bounding a region of finite volume (Gabriel's horn).
A: Yes, there is an answer and looking at your calculations I suppose you know how to get it:
$$ \int_{0}^{a} \frac{1}{\sqrt{x}} dx = 2 \sqrt{a} - 2\sqrt{0} = 2 \sqrt{a} $$
The point here is that although the graph of $\frac{1}{\sqrt{x}}$ goes to infinity when $x \to 0$, the area between the x axis and this graph is perfectly finite. This might be hard to understand, but you can try to imagine it in the following way. Suppose you take a number $\epsilon > 0$ and now you calculate the area between the x axis, the graph of $\frac{1}{\sqrt{x}}$ and the vertical lines $x=\epsilon$ and $x=a$. With the same integral we've already calculated, you obtain that this area is:
$$ \int_{\epsilon}^{a} \frac{1}{\sqrt{x}} dx = 2 \left( \sqrt{a} - \sqrt{\epsilon} \right) $$
And now you should't be troubled by the fact that the graph of $\frac{1}{\sqrt{x}}$ goes to infinity, because it is perfectly finite in $x = \epsilon$. Now make $\epsilon$ arbitrarily small, that is, take the limit when $\epsilon \to 0$, the area becomes $2 \sqrt{a}$ and you recover the previous result. The key point here is, from an intuitive point of view, that the interval $(0, \epsilon)$ has length $\epsilon$, which tends to zero. Thus, although the function $\frac{1}{\sqrt{x}}$ diverges near $0$, this zone of divergence is so small that you get a finite area. Of course, this is only a small intuitive discussion trying to shed light on your question, not a rigorous reasoning.
To understand a little bit more this idea, suppose you take $p>0$ a real number different from 1. Then, you have:
$$ \int_{\epsilon}^{a} \frac{1}{x^{p}} dx = \left[ \frac{x^{-p+1}}{1-p} \right]_{\epsilon}^{a} = \frac{1}{1-p} \left( a^{1-p} - \epsilon^{1-p} \right) $$
As you can easily check, when you take $\epsilon \to 0$ the result converges if $p<1$ and diverges if $p>1$. Then your example with $\frac{1}{x}$ (which also diverges because of the logarithm) is some kind of limit: functions like $\frac{1}{\sqrt{x}}$ or $\frac{1}{x^{3/5}}$ diverge slow enough near 0 to have a finite area, but $\frac{1}{x}$ or $\frac{1}{x^4}$ don't.
A: By writing both integrals in form of limit-of-sum we get
$$\int_0^1 \frac1{\sqrt{x}} dx =\lim_{n\to\infty}\frac1n\sum_{k=1}^n {\frac {\sqrt n}{\sqrt{ k}} }=\lim_{n\to\infty}\sum_{k=1}^n {\frac {1}{\sqrt{ nk}} }=\lim_{n\to\infty} \frac{H_n^{1/2}}{\sqrt{n}}=2 $$
But following Integral when expressed as limit-of-sum Diverges!
$$\int_0^1 \frac1{x} dx =\lim_{n\to\infty}\frac1n\sum_{k=1}^n {\frac{n}{k} } =\lim_{n\to\infty}\sum_{k=1}^n {\frac{1}{k} }$$ 
