polar coordinate verification

I am trying to verify polar coordinate transformation. $$\mathbf{r}\left(x,y\right)=x\hat{\mathbf{x}}+y\hat{\mathbf{y}}$$ also, $$\mathbf{r}\left(\rho,\theta\right)=\rho\hat{\mathbf{\rho}}+\theta\hat{\mathbf{\theta}}$$ subject to, when going from cartesian to polar $$\rho=\sqrt{x^2+y^2}\\ \theta=\arctan\left(\frac{y}{x}\right)$$ and $$\hat{\mathbf{\rho}}=\cos\theta\hat{\mathbf{x}}+\sin\theta\hat{\mathbf{y}}\\ \hat{\mathbf{\theta}}=-\sin\theta\hat{\mathbf{x}}+\cos\theta\hat{\mathbf{y}}$$ I want to start with $\mathbf{r}\left(\rho,\theta\right)$ and show how I can get to $\mathbf{r}\left(x,y\right)$. First I substitute

$$\rho \hat{\mathbf{\rho}}+\theta \hat{\mathbf{\theta}}=\sqrt{x^2+y^2}\left(\cos\theta\hat{\mathbf{x}}+\sin\theta\hat{\mathbf{y}}\right)+\arctan\left(\frac{y}{x}\right)\left(-\sin\theta\hat{\mathbf{x}}+\cos\theta\hat{\mathbf{y}}\right)$$ I then substitute $\cos\theta=\frac{x}{\sqrt{x^2+y^2}}$ and $\sin\theta=\frac{y}{\sqrt{x^2+y^2}}$. I am left with the first term simplifying to $x\hat{\mathbf{x}}+y\hat{\mathbf{y}}$, but the second term becomes $$\arctan\left(\frac{y}{x}\right)\left(-\frac{y}{\sqrt{x^2+y^2}}\hat{\mathbf{x}}+\frac{x}{\sqrt{x^2+y^2}}\hat{\mathbf{y}}\right)$$ which I cannot quite see how to reduce to zero algebraically. Any advice?

The problem you have is with the equation $$\mathbf{r}\left(\rho,\theta\right)=\rho\hat{\mathbf{\rho}}+\theta\hat{\mathbf{\theta}}$$ If you go from the origin along $\hat{\mathbf{\rho}}$ for a distance $\sqrt{x^2+y^2}$, you get to the point $(x,y)$. There is no reason to go any distance along $\hat{\mathbf{\theta}}$. The new reference frame has already the first axis towards the $(x,y)$ point. Your equation is then $$\mathbf{r}\left(\rho,\theta\right)=\rho\hat{\mathbf{\rho}}$$ Then all the rest of your calculations are correct.