  The classical Hardy inequality holds in Sobolev spaces $W_0^{1,p}$ when $1\le
p< N$. In the limiting case where $p=N$, it is known that by adding a
logarithmic function to the Hardy potential, some inequality which is called
the critical Hardy inequality holds in $W_0^{1,N}$. In this note, in order to
give an explanation of appearance of the logarithmic function at the potential,
we derive the logarithmic function from the classical Hardy inequality with the
best constant via some limiting procedure as $p \nearrow N$. And we show that
our limiting procedure is also available for the classical Rellich inequality
in second order Sobolev spaces $W_0^{2,p}$ with $p \in (1, \frac{N}{2})$ and
the Poincar\'e inequality.
