Conversion of a Vector in a Cartesian Coordinate System to a Cylindrical Coordinate System I'm having trouble converting a vector from the Cartesian coordinate system to the cylindrical coordinate system (second year vector calculus)

Represent the vector $\mathbf A(x,y,z) = z\ \hat i - 2x\ \hat j + y\ \hat k $ in cylindrical coordinates by writing it in the form
$$\mathbf A(\rho, \phi, z) = A_1(\rho, \phi, z){\hat \rho} + A_2(\rho, \phi, z){\hat \phi} + A_3(\rho, \phi, z){\hat z}$$

I know that
$$x=\rho\cos(\phi) \ \ ,  \ \ y = \rho\sin(\phi) \ \ , \ \ z = z$$
and
$$\rho=\sqrt{x^2+y^2} \ \ , \ \ \phi = \arctan\Big(\frac{y}{x}\Big) \ \ , \ \ z = z$$
So I put
$$\mathbf A(\rho,\phi,z) = z\ \hat i - 2\rho\cos(\phi) \ \hat j + \rho\sin(\phi) \ \hat k$$
I've tried computing the tangent vectors to the curve:
$$\vec \rho = \Big(\frac{\partial A_x}{\partial \rho}, \frac{\partial A_y}{\partial \rho} , \frac{\partial A_z}{\partial \rho} \Big) = (0,-2\cos(\phi),\sin(\phi))$$
$$\vec \phi = \Big(\frac{\partial A_x}{\partial \phi}, \frac{\partial A_y}{\partial \phi} , \frac{\partial A_z}{\partial \phi} \Big) = (0, 2\rho\sin(\phi), \rho\cos(\phi))$$
$$\vec z = \Big(\frac{\partial A_x}{\partial z}, \frac{\partial A_y}{\partial z} , \frac{\partial A_z}{\partial z} \Big) = (1,0,0)$$
Scale factors:
$$h_\rho = |\vec \rho| = \sqrt{4\cos^2(\phi) + \sin^2(\phi)}$$
$$h_\phi = |\vec \phi| = \sqrt{4\rho^2\sin^2(\phi) + \rho^2\cos^2(\phi)}$$
$$h_z = |\vec z| = 1$$
I also know that
$$\hat \rho = \frac{1}{h_\rho}\vec \rho \ \ , \ \ \hat \phi = \frac{1}{h_\phi}\vec \phi \ \ , \ \ \hat z = \frac{1}{h_z}\vec z$$

But from here I'm not sure how to proceed to the correct answer of $$\mathbf A(\rho,\phi,z) = (z\cos(\phi)-\rho\sin(2\phi))\ \hat \rho - (z\sin(\phi)+2\rho\cos^2(\phi))\ \hat \phi + \rho\sin(\phi)\ \hat z$$

Any help would be greatly appreciated, cheers!
 A: Try a different way: find the expression of the cartesian unitary vectors in cylindrical unitary vectors. We have to invert this:
$$\left\{
    \begin{matrix}
    \hat\rho=\cos\phi\hat i+\sin\phi\hat j\\
    \hat\phi=-\sin\phi\hat i+\cos\phi\hat j\\
    \hat k=\hat k\\
    \end{matrix}
\right.$$
From this:
$$
    \begin{matrix}
    \sin\phi\hat\rho=\sin\phi\cos\phi\hat i+\sin^2\phi\hat j & \cos\phi\hat\rho=\cos^2\phi\hat i+\cos\phi\sin\phi\hat j\\
    \cos\phi\hat\phi=-\cos\phi\sin\phi\hat i+\cos^2\phi\hat j & -\sin\phi\hat\phi=\sin^2\phi\hat i-\sin\phi\cos\phi\hat j\\
    \end{matrix}
$$
we end with
$$\left\{
    \begin{matrix}
    \hat i=\cos\phi\hat\rho-\sin\phi\hat\phi\\
    \hat j=\sin\phi\hat\rho+\cos\phi\hat\phi\\
    \hat k=\hat k\\
    \end{matrix}
\right.$$
Now simply substitute:
$\mathbf A(x,y,z) = z\ \hat i - 2x\ \hat j + y\ \hat k=$
$=z(\cos\phi\hat\rho-\sin\phi\hat\phi)-2\rho\cos\phi(\sin\phi\hat\rho+\cos\phi\hat\phi)+\rho\sin\phi\hat k$
Rearrange and we are done.
$$\mathbf A(\rho,\phi,z) =(z\cos\phi-2\rho\sin(2\phi))\hat\rho-(z\sin\phi+2\rho\cos^2\phi)\hat\phi+\rho\sin\phi\hat k$$
A: There's some shortcuts. 
$$\vec{A}=\sum_{i=1}^3f_i(x,y,z)\vec{e_i}$$
Where $\vec{e_i}$ cycles through the unit vectors, $\vec{e_1}=\hat{i}=\hat{x}$, $\vec{e_2}=\hat{j}=\hat{y}$,$\vec{e_3}=\hat{k}=\hat{z}$
And $f_1(x,y,z)=z; f_2(x,y,z)=-2x; f_3(x,y,z)=y$
$\vec{A}$ remains the same vector regardless of which coordinates are used. The components and the unit vectors change. 
So $$\vec{A}=\sum_{i=1}^3f_i(x,y,z)\vec{e_i}=\vec{A}=\sum_{i=1}^3g_i(r,\theta,z)\vec{\mu_i}$$
Take the dot product of $\vec{A}$ with $\vec{\mu_j}$ and all $\vec{\mu_j}$ are orthogonal. 
$$g_j=\sum_{i=1}^3f_i(x,y,z)(\vec{e_i}\cdot\vec{\mu_j})$$
$$g_r=z\cos{\theta}+(-2r\cos{\theta})(\sin{\theta})+(r\sin{\theta})(0)$$
The dot product can be simplified. 
Consider the infinitesimal displacement where a repeated index implies summation over that index from 1 to 3:
$$d\vec{r}=dx_i\vec{e_i}=dx_\mu\vec{e_\mu}$$
By the chain rule, $dx_i=\frac{\partial x_i}{\partial x_\mu}dx_\mu$
So
$$dx_i\vec{e_i}=\frac{\partial x_i}{\partial x_\mu}dx_\mu\vec{e_i}=dx_\mu\vec{e_\mu}$$
$$dx_\mu(\frac{\partial x_i}{\partial x_\mu}\vec{e_i}-\vec{e_\mu})=0$$
This is to hold regardless of the displacement, so the term in parentheses is zero.
So:  $\frac{\partial x_i}{\partial x_\mu}\vec{e_i}=\vec{e_\mu}$
Take the dot product with $\vec{e_j}$
$$\frac{\partial x_i}{\partial x_\mu}(\vec{e_i}\cdot \vec{e_j})=(\vec{e_j}\cdot \vec{e_\mu})=\frac{\partial x_j}{\partial x_\mu}$$
So the dot products between the basis vectors are partial derviatives with respect to the coordinates. 
