The electric potential from an elementary electric dipole located at the origin is given by the expression
$\phi$($\vec r$) = $\vec p$ $\cdot$ $\vec r$/4$\pi$$\epsilon_0$$r^3$
where $\vec p$ is the electric dipole moment vector. Show that the corresponding electric field is given by the expression
$\vec E$ = -$\nabla$$\phi$ = $\frac{3 (\vec p \cdot \hat r) \hat r - \vec p }{4 \pi \epsilon_0 r^3}$
where $\hat r$ is the unit vector in the direction of the vector $\vec r$.
I'm not too sure if I wrote the electric field expression correctly so I uploaded a snippet of the question which is on the attachment.
So the way I thought to solve it was by replacing $\vec r$ with $r \hat r$
so $\vec E$ = -$\frac{\partial \phi}{\partial r}\hat r$ = -$\frac{\partial}{\partial r}(\vec p$ $\cdot$ $\vec r$/4$\pi$$\epsilon_0$$r^3)\hat r$ = -$\frac{\partial}{\partial r}(\vec p$ $\cdot$ $r \hat r$/4$\pi$$\epsilon_0$$r^3)\hat r$ = $\frac{\vec p \cdot \hat r }{2\pi \epsilon_0 r^3}\hat r$
not sure what I'm doing wrong. I thought maybe since the dot product involves the angle between the two vectors one of the other components of the spherical gradient survive but I'm not sure.