Find $f(r) $ if $\nabla ^2 f(r) =0$. The answer is $$f(r) = b + \frac{a}{r} $$ where $a$ and $b$ are constants.
Unfortunately I don't know how to find f(r). I was hinted that $$ \nabla ^2 f(r)=\frac{d^2f}{dr^2} + \frac{2}{r} \frac{df}{dr}$$ Where $f(r)$ is harmonic. I hope someone can give me a detailed answer. Thank you. 
 A: I totally agree with the first comment to your question: given the hint, you must have:
$$
\frac{d}{dr}\frac{df}{dr} + \frac{2}{r}\frac{df}{dr}=0.
$$
Call $\dfrac{df}{dr}=g$ to find
$$
\frac{dg}{dr} + \frac{2}{r}g=0,
$$
this is
$$
\frac{dg}{g} = -2\frac{dr}{r}.
$$
This is a first order, separable, equation giving
$$
\log(g)=-2\log(r)+k,
$$
$k\in\mathbb{R}$. So,
$$
g=e^{-2\log(r)+k}=e^{\log(r^{-2})}e^k=\frac{c}{r^2}=\dfrac{df}{dr},
$$
being $c=e^k\in\mathbb{R}^+$. The equation
$$
df=c\frac{dr}{r^2}
$$
gives an
$$
f=-\frac{c}{r}+b,
$$
$b\in\mathbb{R}$. Choosing $a=-c\in\mathbb{R}^-$ we finally find
$$
f(r)=\frac{a}{r}+b,
$$
with $a\in\mathbb{R}^-$, $b\in\mathbb{R}$, for all $r\in\mathbb{R}\backslash\{0\}$.
A: Write
$f'(r) = \dfrac{df}{dr}, \; \text{etc}; \tag 1$
then the equation is
$f''(r) + \dfrac{2}{r}f'(r) = 0; \tag 2$
this is in fact the Laplace equation in spherical coordinates with the angular derivatives suppressed since $f$ depends only on $r$; see this wikipedia page; we write this as
$\dfrac{f''(r)}{f'(r)} = -\dfrac{2}{r}, \tag 3$
or 
$\dfrac{d(\ln f'(r))}{dr} = -\dfrac{2}{r}; \tag 4$
we integrate 'twixt $r_0$ and $r$:
$\displaystyle \int_{r_0}^r \dfrac{d(\ln f'(s))}{ds} \; ds = -2\int_{r_0}^r \dfrac{1}{s} \; ds, \tag 5$
whence
$\ln f'(r) - \ln f'(r_0) = -2(\ln r - \ln r_0 ) = 2\ln r_0 - 2\ln r$
$= \ln r_0^2 - \ln r^2, \tag 6$
$\ln \left ( \dfrac{f'(r)}{f'(r_0)} \right ) = \ln \left ( \dfrac{r_0^2}{r^2} \right ); \tag 7$
$\dfrac{f'(r)}{f'(r_0)} = \dfrac{r_0^2}{r^2}; \tag 8$
$f'(r) = \dfrac{r_0^2f'(r_0)}{r^2}; \tag 9$
integrate one more time
$f(r) - f(r_0) = \displaystyle \int_{r_0}^r f'(s) \; ds$ $= \displaystyle \int_{r_0}^r \dfrac{r_0^2 f'(r_0)}{s^2} \; ds = r_0^2f'(r_0) \left (\dfrac{1}{r_0} - \dfrac{1}{r}\right); \tag{10}$
algebra:
$f(r) = f(r_0) + r_0f'(r_0) - \dfrac{r_0^2f'(r_0)}{r}, \tag{11}$
which is in the requisite form, with
$b = f(r_0) + r_0f'(r_0), \tag{12}$
and
$a = -r_0^2f'(r_0). \tag{13}$
