I understand that textbook questions are to be avoided here but I would like to request help from this forum. This a question in mechanics which involves what should be a fairly straightforward conversion between Cartesian and polar co-ordinate systems. But this question has left me and my classmates stumped because the answer obtained from conversion is nowhere near the required solution. Here is the question:
Show that the equations $$E_r = \frac{p}{2\pi\epsilon_0r^3}\cos\theta \qquad E_\theta=\frac{p}{4\pi\epsilon_0r^3}\sin\theta$$ follow from $$E_x=\frac{3p\sin\theta\cos\theta}{4\pi\epsilon_0r^3}\qquad E_z= \frac{p(3\cos^2\theta-1)}{4\pi\epsilon_0r^3}$$
$E_x$, $E_z$, $E_r$, $E_\theta$ represent the electric field vector along the $x$-axis, $z$-axis, $r$-component and $\theta$-component. So, my question is whether this proof is possible or is there a minor error which when corrected gives the required answer?
Edit: Here's my attempt at the proof:
Assumptions:
(a) $$E_r = \sqrt {E_x^2+E_z^2}$$
(b) $$E_\theta = \tan^{-1} (E_z/ E_x)$$
(c) $$k = \frac{p}{4\pi\epsilon_0r^3}$$
Then we obtain,
$$E_r = 2k\cos\theta$$ $$E_\theta = k\sin\theta$$ $$E_x = 3k\sin\theta\cos\theta$$ $$E_z = k(3\cos^2\theta -1)$$
Plugging these values into (a) and simplifying, I obtained: $$E_r = k\sqrt {3\cos^2\theta +1}$$ after which I was stuck.
Plugging the values into (b) and simplifying, I obtained: $$E_\theta = \tan^{-1} \frac {3\cos^2\theta-1}{3\sin\theta\cos\theta}$$
I attempted to simplify this by separating one $cos^2\theta$ terma so I could have two cosine terms in my numerator: $$E_\theta = \tan^{-1} \frac {\cos^2\theta+\cos2\theta}{3\sin\theta\cos\theta}$$ I separated them and multiplied the second term by $\frac 22$ so I could convert both of them into tangent terms: $$E_\theta = \tan^{-1} \frac {\cos^2\theta}{3\sin\theta\cos\theta}+ \frac {\cos2\theta}{3\sin\theta\cos\theta}*\frac 22$$ $$E_\theta = \tan^{-1} \frac {1}{3\tan\theta}+ \frac {1}{3\tan2\theta}$$ All attempts after this were in vain.