# How to differentiate $f(r\cos\theta) = r$ with respect to $r\cos\theta$?

Let $$r,\theta \in \mathbb{R}$$. As stated in the title, how do I differentiate $$f(r\cos\theta) = r$$ with respect to $$r\cos\theta$$? I have never encountered a question or concept like this, and am not sure where to start.

My first thought is to start from the fundamentals: perhaps I should try differentiating $$x$$ with respect to $$2x$$. Perhaps I can use change of variables with $$u$$ = $$2x$$. Then the problem would be equivalent to differentiating $$\frac{x}{2}$$ with respect to $$x$$, which is easy. However, evaluating either $$\frac{d}{d(2x)} x$$ or $$\frac{d}{d(r\cos\theta)} r$$ in various software produces error messages, so I'm not sure that the change of variables idea is even valid.

How should I proceed? Any advice is deeply appreciated.

• I am guessing but what about replacing $u\rightarrow r\cos\theta$? Jul 2, 2020 at 19:35
• Note that the typographical difference between $r cos \theta$ and $r\cos\theta$ is not only that in the latter $\cos$ is not italicized but also in the spacing, and the difference is in just one keystroke in the code, as in my edits to this question. Jul 2, 2020 at 19:37
• I think some context is missing. My guess is that you have a function of $r$ and $\theta$ and you want to write the derivative with respect to $x$ (polar to Cartesian transform) Jul 2, 2020 at 19:38
• @SamuelA.Morales That was what I was thinking, but I wasn't sure if change of variables is a valid approach. For example, in my "differentiate $x$ with respect to $2x$" toy example, do you think my change of variable strategy is valid? Jul 2, 2020 at 19:39
• I looks similar to this question math.stackexchange.com/q/3581852/399263
– zwim
Jul 2, 2020 at 19:41

This depends on the dependence between $$r$$ and $$\theta$$. We can see that the differential

$$d(r\cos\theta)=\cos\theta dr-r\sin\theta d\theta$$

and so $$f'(r\cos\theta)=\frac{1}{\cos\theta-r\sin\theta\frac{d\theta}{dr}}.$$ Outside of this fact, the context is extremely important. Are you trying to solve for $$f$$? If so, there are many solutions. With a bit of practice, one can master turning functional equations into relatively monstrous differential equations (which is a general enough and delicate enough process that I leave it to you), and from there you can proceed to find solutions to the function.

If you suppose $$u=r\cos\theta$$, you'll end up in the same situation roughly. You could also assume a parametric surface, for example $$S^1$$. The context and intent here are pretty important.

In $$f(r\cos\theta)=r$$, you can write $$u=r\cos\theta$$. Then $$r=\frac u{\cos\theta}$$. Finally $$\frac{df(r\cos\theta)}{d(r\cos\theta)}=\frac{df(u)}{du}=\frac 1{\cos\theta}$$

• @zwim Not clear from the question. What if $\theta$ is just a parameter and $f(x)=\frac{x}{\cos\theta}$ ? Jul 2, 2020 at 19:52
• I think, you should explicitly state that in case $r$ is not dependant of $\theta$ we have this formula, else it would be misleading for people thinking "polar coordinates". This is the reason I deleted my previous comment and formulated better.
– zwim
Jul 2, 2020 at 19:52