# Solve $-1+B^{\prime}(r)r+B(r)=\frac{Q^2}{4 \pi r^2}$ analytically

I need to solve $$-1+B^{\prime}(r)r+B(r)=\frac{Q^2}{4 \pi r^2}$$ , $Q=const$. The boundary condition is $B(r)\to 1$ as $r \to \infty$. I am faced with this equation while solving for the spherically symmetric metric with a charge $Q$. Though, I can find the solution using Mathematica, or Wolfram Alpha, I would like to get an analytic solution. I am familiar with techniques for solving ODEs not able to recall them.

-
By analytics solution you mean the process of ariving at the solution? See e.g. Wikipedia. –  NikolajK Jun 17 '13 at 12:16

It is a linear equation. Rewrite it as $$(r\,B)'=1+\frac{Q^2}{4\,\pi\,r^2}.$$ Integrate to obtain $$r\,B=r-\frac{Q^2}{4\,\pi\,r}+C$$ and $$B(r)=1-\frac{Q^2}{4\,\pi\,r^2}+\frac{C}{r}.$$ The boundary condition is satisfied or any value of the constant $C$.