Integro-differential Cauchy problem. Is this well defined? Consider a given differentiable function $f(x)$ from $\mathbb{R}$ to $\mathbb{R}$. I construct the following function, defined for all $x > 0$:
$$C(x) = \frac{1}{x}\int_{0}^x f(s) \, \text{d}s $$
First point
I need to evaluate the derivative of $C(x)$. I guess that it is:
$$C'(x) = \frac{C(0)-C(x)}{x^2} + \frac{f(x)}{x}$$
Is this right?
I'm confused about the presence of $C(0)$ since I don't know if $C(x)$ is defined on $x=0$.
Second point
What happen if I want to solve the following Cauchy problem?
$$\begin{cases}\displaystyle C'(x) = \frac{C(0)-C(x)}{x^2} + \frac{f(x)}{x}, & x > 0\\[6pt]
C(0) = A \in \mathbb{R}\end{cases}$$
 A: I come up with 
$$
C' = \dfrac1x(-C + f)
$$
(one way to get this: $xC(x) = \int_0^x f(s)\ ds \to C + xC' = f$).
You can further define $C(0) = f(0)$ and then show that this is consistent with $\lim_{x\to 0^+} C(x)$ (use L'Hopital's rule, or simply note that, if $F(x) = \int_0^x f(s)\,ds$, then $F(0) = 0$ and so the limit definition of $F'$ is
$$
F'(0) = \lim_{x\to 0}\dfrac{F(x) - F(0)}{x} = \lim_{x\to 0}\dfrac{\int_0^x f(s)\,ds}{x} = \lim_{x\to 0}C(x)
$$
and on the other hand, by fundamental theorem of calculus, $F'(0) = f(0)$.
What do you mean by "what happens if I want to solve this?" ($C' = -C/x + f/x$)
For one, you already know a solution: $C(x) = \dfrac{1}{x}\int_0^x f(s)\,ds$
A: Here is an incomplete answer.  The answer posted by BaronVT points out that $C(x)\to f(0)$ as $x\downarrow0$, by L'Hopital's rule.  I would like to say that


*

*In a written proof I would mention, at least tersely and maybe not so tersely, that that conclusion relies on the continuity of $f$.

*The question of the existence or non-existence of $C'(x)$, and of evaluating $C'(x)$ if it exists, is well-defined and meaningful even if one never thinks about $C(0)$.  Therefore it's not enough to say let's make $C(0)$ equal to $f(0)$ because we like continuity.  Rather, one should prove that that continuous extension of $C$ is just what is needed to prove $C'$ exists and to get the right value of $C'(x)$. However, fortunately we won't need to think about $C(0)$ in order to find $C'(x)$ except when $x=0$; in other words, there is an error in your evaluation of $C'(x)$.

*If $C(x)$ is supposed to be the average value of $f$ on the interval $[0,x]$, any reasoning that leads to a proof that $C(0)$ is anything besides $f(0)$ should be considered grounds for replacing our mathematical model of what we're trying to think about with some other model.


So let's see if we can do the proof mentioned in the second bullet point.  For $x\ne0$, the product rule gives us
\begin{align}
C'(x) & = \frac 1 x \cdot\frac d {dx} \int_0^x f(s)\,ds + \int_0^x f(s)\,ds\cdot\frac d{dx}\frac 1 x \\[8pt]
& = \frac{f(x)}x - \frac 1 {x^2}\int_0^x f(s)\,ds = \frac{f(x)} x - \frac 1 x\left(\frac 1 x \int_0^x f(s)\,ds\right) \\[8pt]
& = \frac{f(x)} x - \frac 1 x C(x) = \frac{f(x)-C(x)} x. \tag 1
\end{align}
To find $C'(0)$, the product rule won't work because one of the two factors is not differentiable there.
In order that $C'(0)$ exist, it is necessary that $C$ be continuous at $0$, i.e. $C(0)=\lim_{x\to0}C(x)$.  That limit can be found by L'Hopital's rule or otherwise, and is $f(0)$. That tells us that $C(0)=f(0)$ is necessary for the existence of $C'(0)$.
Next,
\begin{align}
C'(0) = \lim_{x\to0}\frac{C(x) - C(0)} x & \overset{L}= \lim_{x\to0}\frac{f(x)-C(x)} x \quad\text{by $(1)$} \\[8pt]
& \overset L = \lim_{x\to0} \left(f'(x) - \frac{f(x)-C(x)} x\right), \quad \text{by $(1)$ again}.
\end{align}
Adding $\lim\limits_{x\to0}\dfrac{f(x)-C(x)}{x}$ to both sides, we get
$$
2 \lim_{x\to0}\frac{f(x)-C(x)} x = \lim_{x\to0}f'(x).
$$
So this last application of L'Hopital is valid if this last limit exists.  Is it valid only if this last limit exists?  Maybe not: maybe it's enough for the limit before the words "by $(1)$ again" to exist.
So do we get $C'(0) = \dfrac{f'(0)}2$?  We were not given continuity of $f'$.  Some functions are differentiable everywhere while the derivative has a discontinuity at one point.  So maybe the situation is more intricate than it appears at first.  At this point one could wonder about constructing a counterexample.
