Improper integral diverges Let a real-valued function $f$ be continuous on $[0,1].$ Then there exists a number $a$ such that the integral
$$\int_0^1\frac 1 {|f(x)-a|}\, dx
$$ diverges. How to prove that statement?
 A: I don't think this statemnt is correct if $a\in[0,1]$. Maybe I'm wrong but you can take the counter example $f(x)=\frac 1 {|sin(x)+cos(x)|}$. So let's make two points:
1.looking at $|f(x)-a|$,notice that $f(x)=sin(x)+cos(x)$ is continious but moreover is nonegative. if $a\in[0,1]$ the integral is well defined.
2.Then the antriderivative of the function is wel defined according to maple and for all a in [0,1] the claim is correct.

EDIT: Let's try reductio ad absurdum and assume $\int_0^1 \frac 1 {|f(x)-a|} dx$ converges to $L\in\mathbb R$. Also let $a\in \mathbb R,f:[0,1]\rightarrow\mathbb R$. since the function is defined on a closed interval $\exists x_0 \in \mathbb R$ s.t  $x_0$ is a maximum (concluding from weirestrass first lemma for continious function on closed intervals) . since $|f(x)-a|\leq |f(x_0)-a| \Longrightarrow \frac {1}{|f(x)-a|}\geq \frac {1}{|f(x_0)-a|}$. and taking $a\to f(x_0)$, $|f(x_0)-a|\to 0$ but then $ \frac 1 {|f(x_0)-a|} \to \infty$ and finally $L=\int_0^1 \frac 1 {|f(x)-a|}dx\geq \int_0^1 \frac 1 {|f(x_0)-a|}\to \infty$ which is undifined in contradiction for that we assumed that $L\in\mathbb R$. 
A: Take a nondecreasing rearrangement $r(x)$ of the function $f(x)$ (some discussion of this may be found at http://en.wikipedia.org/wiki/Convex_conjugate). This involves finding a measure-preserving transformation of the interval $[0,1]$ that transforms $f$ into $r$. In particular, your integrals $\int_0^1\frac 1 {|f(x)-a|}\, dx$ are all preserved (for every $a$). Now apply the result that every monotone function is a.e. differentiable (see http://en.wikipedia.org/wiki/Monotonic_function). Take a point $p$ where the function $r$ is differentiable.  Then $a=r(p)$ does the trick, because $r(x)-a$ can be bounded in terms of a linear expression.
Note that the existence of a nondecreasing rearrangement of a function $f$ admits an elegant proof in the context of its hyperreal extension $^\star f$, which we will continue to denote by $f$.  Namely, take an infinite hypernatural $H$ and consider a partition of the hyperreal interval $[0,1]$ into $H$ segments, by means of partition points $0, \frac{1}{H}, \frac{2}{H}, \frac{3}{H}, \ldots, \frac{H-1}{H}, 1$.  Now rearrange the values $f(\frac{i}{H})$ of the function at partition points in increasing order, and permute the $H$ segments accordingly.  The standard part of the resulting function is the desired monotone function $r$.
Note 1.  I should point out that one does not really need to use the result that monotone functions are a.e. differentiable.  Consider the convex hull of the graph of $r(x)$, and take a point where the graph touches the boundary of the convex hull (other than the endpoints 0 and 1).  Setting $a$ equal to the $x$-coordinate of the point does the job.
A: Here's a proof that $\int_0^1\frac1{\lvert f(x)-a\rvert}dx = \infty$ for every $a$ in the image of $f$ and outside of a meagre set. In particular, if $f$ is not constant, then there are uncountably many such $a$ in every neighborhood of the image of $f$. [Note: I also agree that user72694's proof works fine, and is completely independent of the proof I'll give here.]
First, define $g(a)$ to be the given integral, and let $[a_0,a_1]$ be the image of $f$. Assuming that $f$ is non-constant, we have $a_0 < a_1$. Letting $b_0 < b_1$ be in $[a_0,a_1]$ then Fubini's theorem gives,
$$
\int_{b_0}^{b_1}g(a)\,da=
\int_{b_0}^{b_1}\!\!\!\int_0^1\frac1{\lvert f(x)-a\rvert}\,dxda
=\int_0^1\!\!\!\int_{b_0}^{b_1}\frac1{\lvert f(x)-a\rvert}\,dadx=\infty.
$$
Here, the integral of $1/\lvert f(x)-a\rvert$ wrt $a$ is infinite whenever $f(x)$ is in $[b_0,b_1]$ (because $1/x$ is not integrable at the origin), which happens for $x$ in a nontrivial interval, so the double integral is infinite. This means that $g$ is not integrable (and, hence, is unbounded) in any nontrivial interval $[b_0,b_1]$ in the image of $f$.
Next, for each $K > 0$, set $S_K=\lbrace a\in[a_0,a_1]\colon g(a) > K\rbrace$. As $g$ is unbounded in the neighborhood of any point, the set $S_K$ is dense in $[a_0,a_1]$. Furthermore, $S_K$ is open for each positive $K$. To see this, note that $g_n(a)\equiv\int_0^11_{\lbrace\lvert f(x)-a\rvert > 1/n\rbrace}/\lvert f(x)-a\rvert dx$ is a sequence of continuous functions increasing to $g$, so $g$ is lower semicontinuous.
Hence, we have
$$
\left\lbrace a\in[a_0,a_1]\colon g(a)=\infty\right\rbrace=\bigcap_{n=1}^\infty S_n,
$$
which is a countable intersection of dense open sets in $[a_0,a_1]$ so, by definition, its complement is meagre.
A: The Devil's staircase is a counterexample. When the integral is defined, it converges. For instance, at 0, the Devil's staircase is approximately between $(C_1 x)^{\frac{\ln 2}{\ln 3}}$ and $(C_2 x)^{\frac{\ln 2}{\ln 3}}$ (the curves connecting the left endpoints of intervals and right endpoints, respectively), and so your integral converges if $a=0$. Near any other point where the integral is defined, the integral converges since the set is self-similar, so all such points are like 0.
All of this is in Chapter four of Frank Jones' Lebesgue integration book, as well as pages 521.

