I'm tried to do following and I can't see what went wrong. $$\begin{bmatrix} \hat r\\ \hat \theta \end{bmatrix} = \begin{bmatrix} \cos \theta & \sin \theta \\ -\sin \theta & \cos \theta \end{bmatrix} \times \begin{bmatrix} \hat i\\ \hat j \end{bmatrix} $$ Taking inverse, $$ \begin{bmatrix} \hat i\\ \hat j \end{bmatrix} = \begin{bmatrix} \cos \theta & -\sin \theta \\ \sin \theta & \cos \theta \end{bmatrix} \times \begin{bmatrix} \hat r\\ \hat \theta \end{bmatrix} $$ The gradient of function $ \phi $ $$\nabla \phi = \hat i \frac{\partial \phi}{\partial x} + \hat j \frac{\partial \phi}{\partial y}$$ $$= \hat r \left( \cos \theta \frac{\partial \phi}{\partial x} + \sin \theta \frac{\partial \phi}{\partial y} \right) + \hat \theta \left( -\sin \theta \frac{\partial \phi}{\partial x} + \cos \theta \frac{\partial \phi}{\partial y} \right)$$ $$= \hat r \left( \cos \theta \frac{\partial \phi}{\partial r} \frac{\partial r}{\partial x} + \sin \theta \frac{\partial \phi}{\partial r} \frac{\partial r}{\partial y} \right) + \hat \theta \left( -\sin \theta \frac{\partial \phi}{\partial \theta} \frac{\partial \theta}{\partial x} + \cos \theta \frac{\partial \phi}{\partial \theta}\frac{\partial \theta}{\partial y} \right)$$ $$= \hat r \left( \cos \theta \frac{\partial \phi}{\partial r} \frac{1}{\cos \theta} + \sin \theta \frac{\partial \phi}{\partial r} \frac{1}{\sin \theta} \right) + \hat \theta \left( -\sin \theta \frac{\partial \phi}{\partial \theta} \frac{1}{- r \sin \theta } + \cos \theta \frac{\partial \phi}{\partial \theta}\frac{1}{ r\cos \theta } \right)$$ $$ = 2 \left ( \frac{\partial \phi }{\partial r}\hat r + \frac{1}{r} \frac{\partial \phi}{\partial \theta } \hat \theta\right )$$ I don't know what went wrong. Please help. Thank you!!

  • 1
    $\begingroup$ You wrote: $$\frac{\partial \phi}{\partial x} = \frac{\partial \phi}{\partial r} \frac{\partial r}{\partial x}$$ instead of: $$\frac{\partial \phi}{\partial x} = \frac{\partial \phi}{\partial r} \frac{\partial r}{\partial x} + \frac{\partial \phi}{\partial \theta} \frac{\partial \theta}{\partial x}$$ $\endgroup$
    – qoqosz
    Jun 26, 2012 at 16:39
  • $\begingroup$ @qoqosz please if you can help me to improve my knowledge $\endgroup$
    – S L
    Jun 26, 2012 at 16:43

1 Answer 1


You have incorrect expressions for $\dfrac{\partial r}{\partial x}, \dfrac{\partial r}{\partial y}, \dfrac{\partial \theta}{\partial x}$ and $\dfrac{\partial r}{\partial y}$. \begin{align} \dfrac{\partial r}{\partial x} & = \cos(\theta)\\ \dfrac{\partial r}{\partial y} & = \sin(\theta)\\ \dfrac{\partial \theta}{\partial x} & = -\dfrac1r \sin(\theta)\\ \dfrac{\partial \theta}{\partial y} & = \dfrac1r \cos(\theta) \end{align}

It is incorrect to think that $$\dfrac{\partial r}{\partial x} = \dfrac1{\dfrac{\partial x}{\partial r}}$$ $$\dfrac{\partial r}{\partial y} = \dfrac1{\dfrac{\partial y}{\partial r}}$$ $$\dfrac{\partial \theta}{\partial x} = \dfrac1{\dfrac{\partial x}{\partial \theta}}$$ $$\dfrac{\partial \theta}{\partial y} = \dfrac1{\dfrac{\partial y}{\partial \theta}}$$ which is what you seem to have done.

When you take partial derivatives, what you are doing is to hold the other variable fixed. So for instance if $f$ is a function of $n$ variables, $f(x_1,x_2,\ldots,x_n)$, $\dfrac{\partial f}{\partial x_i}$ means you hold all the other $x_j$'s constant except $x_i$ and vary $x_i$ by $\delta x_i$ and find out what happens to $\delta f$.

We have

$$x= r \cos(\theta) , y= r \sin(\theta), r^2= x^2 + y^2 \text{ and }\tan(\theta) = \frac{y}{x}$$

We are transforming from the $(x,y)$ space to $(r,\theta)$ space.

In the $(x,y)$ space, $x$ and $y$ are independent variables and in the $(r,\theta)$ space, $r$ and $\theta$ are independent variables.

$\dfrac{\partial x}{\partial r}$ means you are fixing $\theta$ and finding out how changing $r$ affects $x$.

So $\dfrac{\partial x}{\partial r} = \cos(\theta)$ since $\theta$ is fixed.

$\dfrac{\partial r}{\partial x}$ means you are fixing $y$ and finding out how changing $x$ affects $r$.

So $\dfrac{\partial r}{\partial x} = \dfrac{x}{\sqrt{x^2+y^2}}$ since $y$ is fixed.

When you do $r = \dfrac{x}{\cos(\theta)}$ and argue that $\dfrac{\partial r}{\partial x} = \dfrac{1}{\cos (\theta)}$ you are not holding $y$ constant.

If you were to hold $y$ constant, then $\theta$ would change as well.

If you want to use $r = \dfrac{x}{\cos(\theta)}$ and would like to get the right answer, you need to do as follows:

$r = \dfrac{x}{\cos(\theta)}$, $\delta r = \dfrac{\delta x}{\cos(\theta)} + \dfrac{-x}{\cos^2(\theta)} (-\sin(\theta)) \delta \theta$.

$\tan(\theta) = \dfrac{y}{x} \Rightarrow x \tan(\theta) = y$

$\delta x \tan(\theta) + x \sec^2(\theta) \delta \theta = 0$ (Since $y$ is held constant)

$x \delta \theta = - \dfrac{\delta x \tan(\theta)}{\sec^2{\theta}} = - \sin(\theta) \cos(\theta) \delta x$.

Plugging the above in the previous expression, we get

$\delta r = \dfrac{\delta x}{\cos(\theta)} + \dfrac{\sin(\theta)}{\cos^2(\theta)} (-\sin(\theta) \cos(\theta) \delta x) = \dfrac{1-\sin^2(\theta)}{\cos(\theta)} \delta x = \cos(\theta) \delta x$ and hence we get

$\dfrac{\partial r}{\partial x} = \cos(\theta) = \dfrac{x}{\sqrt{x^2+y^2}}$

  • $\begingroup$ how?? isn't $x = r \cos \theta$, $ \frac{\partial r}{\partial x} = \frac{1}{\frac{\partial x}{\partial r}} = \frac{1}{\cos \theta} $ ?? $\endgroup$
    – S L
    Jun 26, 2012 at 16:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .