Converting the Electric Field of a Dipole from Cartesian to Spherical Coords

Homework Statement

Show that $$E_z = \frac{p}{4 \pi \epsilon_0} \left( \frac{3z^2}{r^5} - \frac{1}{r^3} \right)$$ is equivalent to the electric field on the positive z-axis from $$E_r = \frac{2 p \cos \theta}{4 \pi \epsilon_0 r^3}$$

Homework Equations

The unit normal for a sphere, sin0cos%, sin0sin%, cos0 (0 is theta; % is phi)
z = rcos0

The Attempt at a Solution

I multiplied E_r by cos0 (the z component of the unit vector in spherical coordinates)
and got 2cos^2 theta /r^3 (times p/4piEo)

However, simplifying E_z I get [2cos^2 theta - sin^2 theta]/r^3 (times p/4piEo)

I'm not sure what I'm doing wrong, any guidance would be appreciated!

Edit: solved. Forgot to consider a value for theta

Last edited: