I am currently working through some past exercises in polar coordinates $(r, \theta)$ and want to take the derivative of $r$ with respect to $x$, but I have hit a bit of a brick wall:
a) $x = r\cos(\theta)$
and
b) $r = \sqrt{x^2 +y^2}$,
right? How come then if I solve a) for $r$ and take $d/dx$ I get $\sec(\theta)$ but if I take b) $d/dx$ I get $\cos(\theta)$ ??? Can anybody help me out here, I have probably made some glaringly silly mistake that I am a bit too frustrated to see right now.
Sorry for not formatting the equations, I'm rather new to this forum and maths in general, so I would also really appreciate an answer that doesn't presume much more experience than Calc 1 or 2. Thanks in advance! :)
The issue here, as I understand your question, is that you are forgetting that $\theta$ also depends on $x$ via $\theta = \arctan(y/x)$ for $x > 0$ (a similar argument will work for other cases). Here, then, we have $$\frac{d\theta}{dx} = \frac{1}{1+\left(\frac{y}{x}\right)^2}\cdot \frac{-y}{x^2} = -\frac{y}{x^2 + y^2} = -\frac{r\sin(\theta)}{r^2} = -\frac{\sin(\theta)}{r}.$$ So, differentiating $r = \frac{x}{\cos(\theta)}$ gives us \begin{align*}\frac{dr}{dx} &= \frac{\cos(\theta) + x\sin(\theta)\frac{d\theta}{dx}}{\cos^{2}(x)}\\ &= \frac{\cos(\theta) - x\sin(\theta)\frac{\sin(\theta)}{r}}{\cos^{2}(x)}\\ &= \frac{\cos(\theta) - x\sin(\theta)\frac{\sin(\theta)}{r}}{\cos^{2}(x)}\\ &= \frac{\cos(\theta) - r\cos(\theta)\sin(\theta)\frac{\sin(\theta)}{r}}{\cos^{2}(x)}\\ &=\frac{\cos(\theta)(1 - \sin^{2}(\theta))}{\cos^{2}(\theta)}\\ &=\frac{\cos(\theta)\cos^{2}(\theta)}{\cos^{2}(\theta)}\\ &=\cos(\theta). \end{align*} That matches with what you got in the second approach.