I am trying to find the scalar potential, $\phi(\vec r)$, of a conservative vector field $\vec a(\vec r)$. I am integrating along a straight line from $\vec r_0$ to $\vec r$ which is parametrised by $\vec r^\prime = \lambda\vec r$ with $0\le\lambda\le1$. Thus $d\vec r^\prime=d\lambda\vec r$ and hence:$$\phi(\vec r)=\int_0^\vec r \vec a(\vec r^\prime)\cdot d\vec r^\prime=\int_{\lambda=0}^{\lambda=1} \vec a(\lambda\vec r)\cdot \vec r d\lambda$$
The conservative vector field I am using is $\vec a=\vec rf(r)$ where $f(r)$ is an arbitrary function of $r=|\vec r|$.
Therefore, $$\phi(\vec r)=\int_{\lambda=0}^{\lambda=1} \vec a(\lambda\vec r)\cdot \vec r d\lambda=\int_{0}^{1} \lambda\vec rf(\lambda r)\cdot \vec r d\lambda\: [\star]$$ $$=\int_{0}^{1} \lambda^2(\vec r\cdot \vec r)f(r) d\lambda\:[\star\star]=(\vec r\cdot \vec r)f(r)\int_{0}^{1} \lambda^2 d\lambda $$ $$=\frac{1}{3}(\vec r\cdot \vec r)f(r)=\frac{1}{3}r^2f(r)$$
Next, in order to verify that I have obtained the correct scalar potential I use the fact that: $$\vec a=\nabla \phi (\vec r) $$ $$\vec a=\nabla(\frac{1}{3}r^2f(r))=\frac{1}{3}((\nabla r^2)f(r)+(\nabla f(r))r^2)$$ $$=\frac{1}{3}(\vec r f(r) + f^\prime (r)(\nabla r)r^2)=\frac{1}{3}(\vec r f(r) + f^\prime (r)(r^{-1}\vec r)r^2)$$ $$=\frac{1}{3}(\vec r f(r) + f^\prime (r)r^{-1}\vec r)$$
I am supposed to get back my vector $\vec a=\vec rf(r)$ but this is not the case. I believe that there is potentially something wrong at $[\star]$ or $[\star\star]$.
I would like to know where I have gone wrong in order to get back my original vector.
Thanks