How to find $\frac{\mathrm{d} r}{\mathrm{d}x}$? There are $2$ formulas, $x=r \cos \theta$ and $r=(x^2+y^2)^{1 \over 2}$ and I need to find $\frac{\mathrm{d}r}{\mathrm{d}x}$, the solution is $\frac{\mathrm{d}r}{\mathrm{d}x}=\cos \theta$.
This answer told me that it considers $y$ as a constant so that the answer is $\cos \theta$.
If I use $x=r \cos\theta$ to find $\frac{\mathrm{d}r}{\mathrm{d}x}$, the solution will be $\frac{1}{\cos \theta}$. 
So why can't I consider $\theta$ as a constant?
 A: $r$ is a function of independent variables $x$ and $y$; to find the partial derivative of $r$ w.r.t. $x$ you can treat $y$ as a constant: $\frac {\partial r} {\partial x}=(0.5)(x^{2}+y^{2})^{-0.5} (2x)$. Now you can use the fact that $x^{2}+y^{2}=r^{2}$ and $x =r\cos \theta$ to see that $\frac {\partial r} {\partial x} =\cos \theta$. There is no justification for treating $\theta $ as a constant. ($r$ and $\theta$ are independent variables. If you are differentiating a function of $r$ and $\theta$ w.r.t. $r$ you can treat $\theta$ as a constant). 
A: By the chain rule, $$dr=\left(\frac{\partial r}{\partial x}\right)_ydx+\left(\frac{\partial r}{\partial y}\right)_xdy=\frac{1}{2r}\left[\left(\frac{\partial r^2}{\partial x}\right)_ydx+\left(\frac{\partial r^2}{\partial y}\right)_xdy\right]=\frac{xdx+ydy}{r},$$where the subscripted variables on partial derivatives are held fixed. Hence $$\frac{dr}{dx}=\frac{x+y\frac{dy}{dx}}{r},$$where $\frac{dy}{dx}$ depends on the path along which we move in defining $\frac{dr}{dx}$. By contrast, the partial derivatives$$\left(\frac{\partial r}{\partial x}\right)_y=\frac{1}{2r}\left(\frac{\partial r^2}{\partial x}\right)_y=\frac{x}{r}=\sec\theta,\,\left(\frac{\partial r}{\partial x}\right)_\theta=\cos\theta$$have path-independent definitions.
A: With $r= (x^2+y^2)^{1/2}$ the partial derivative $$\frac {\partial r}{\partial x} =(1/2)(x^2+y^2)^{-1/2}(2x)=\frac {x}{r}=\cos \theta$$ 
If you make the extra assumption that $\theta$ is constant then you get $\frac {dr}{dx}=\frac {1}{\cos \theta}$ but this is changing the question. 
These are two different problems with two different results. 
A: First, a simple way to get the right answer: Take the partial derivative of both sides of $$r^2=x^2+y^2,$$and you get $$2r\frac{\partial r}{\partial x}=2x.$$
Second, what's wrong with your argument "If I use $x=r \cosθ$ to find $\frac{\mathrm d r}{\mathrm dx}$, the solution will be $\frac{1}{\cos \theta}$": That would be right if $\theta$ were a constant. But of course $\theta$ depends on $x$; what you actually get is $$1=\frac{\partial r}{\partial x}\cos(\theta)-r\frac{\partial\theta}{\partial x}\sin(\theta).$$
$\newcommand\pd[2]{\frac{\partial #1}{\partial #2}}$
It turns out the OP is confused about why we can treat $y$ as a constant but not $\theta$. The answer to that has to do with what
$\pd rx$ means (and what's implicit in the notation):
Partial Derivatives
If $f$ is a function of several variables an informal  definition of $\pd fx$ is "the derivative with respect to $x$, holding the other variables constant".
What that means depends on what the "other variables" are. In the informal sort of context we use in  calculus, maybe it would be better if the notation made explicit what variables  were the "other variables".
In any case, here we're given $r=r(x,y)$, so the "other variable" implicit in the notation $\pd rx$ is $y$; otoh $\theta$ simply is not one of the "other variables".
One could concoct a function $f$ so that $r=f(x,\theta)$. If $r$ had been defined that way then we would hold $\theta$ constant in calculating $\pd rx$. But that's different; here from the context it's clear we want $\pd rx$ assuming $r=r(x,y)$, not $r(x,\theta)$.
A: Note that:
$$\begin{cases}x=r\cos t\\ y=r\sin t\end{cases} \iff r=(x^2+y^2)^{1/2} \quad (1)$$
If $x=r\cos t$ is the objective function, then $\frac{\partial r}{\partial x}=\frac1{\cos t}$ (that is, $t$ is held constant).
If $x=r\cos t$ is associated with $y=r\sin t$ (apparently it is, because $r=(x^2+y^2)^{1/2}$ connects them), then the objective function is $(1)$. You can not ignore $y=r\sin t$, because as Kavi commented above:
$$\frac{y}{x}=\frac{\sin t}{\cos t} \Rightarrow \tan t=\frac yx \Rightarrow t=\arctan \left(\frac yx\right)$$
that is, $t$ is a function of $x$. 
So, when you take partial derivative from $r=\frac{x}{\cos t}$, you must use the chain rule (or division rule):
$$\frac{\partial r}{\partial x}=\left(x\cdot \frac1{\cos t}\right)'_x=\frac{1}{\cos t}+x\cdot \frac{-1}{\cos^2t}\cdot (-\sin t)\cdot \frac{\partial t}{\partial x}=\\
\frac1{\cos t}+\frac{x\sin t}{\cos^2 t}\cdot \frac{1}{1+\left(\frac yx\right)^2}\cdot \left(-\frac{y}{x^2}\right)=\\
\frac1{\cos t}-\frac{x}{\cos t}\cdot \frac{y\sin t}{\underbrace{x^2+y^2}_{r^2}}\cdot \frac1{\cos t}=\\
\frac{1}{\cos t}-\frac{y\sin t}{r\cos t}=\frac1{\cos t}-\frac{\sin^2 t}{\cos t}=\cos t,$$ 
as expected.
