How to systematically find generalized coordinates in Lagrangian mechanics? In Lagrangian Mechanics, we usually use generalized coordinates $q_i$ instead of the usual Cartesian coordinates $x_i$. Is there a systematic way to identify what the generalized coordinates are when given a problem with Cartesian coordinates and  holonomic constraints?
For example, for a 2D particle moving on the perimeter of a circle with radius $r$ centered on the origin, we usually identify the polar angle $\theta$ as the generalized coordinate.
While in terms of Cartesian coordinates, we have the coordinates $x$ and $y$ and the holonomic constraint $x^2+y^2=r^2$ to describe the motion of the particle. How can we start from the Cartesian coordinates $x$, $y$ and the constraint $x^2+y^2=r^2$ to derive that the correct generalized coordinate to use is  the polar angle $\theta$?
 A: There is a systematic way of obtaining a set of generalized coordinates which is however not very useful in general. Namely, given a set of constraints one can use the implicit function theorem to separate some of the original Cartesian coordinates as the generalized coordinates. It is important to note here that, much like all sets of generalized coordinates, the coordinates will only make sense locally.  Instead of explaining this in general let me show an example. In the constraint that you gave $x^2+y^2=r^2$, near the point $(x,y)=(0,r)$ we can use as generalized coordinate simply the coordinate $x$. Indeed, $y$ is determined by $y=\sqrt{r^2-x^2}$. This choice of generalized coordinates however only works for the upper circumference of the circle. For the lower circumference we can choose $x$ still as generalized coordinate and then $y=-\sqrt{r^2-x^2}$. Even with these, for technical reasons (charts are defined on open sets) we haven't yet covered the points $(x,y)=(r,0)$ and $(x,y)=(-r,0)$. To cover these points we need to now choose as generalized coordinate $y$ and set $x=\sqrt{r^2-y^2}$ or $x=-\sqrt{r^2-y^2}$.
The caveats of these prescription are the following:

*

*In general one cannot find a closed form for the function $y(x)$. One however knows that it locally exists and is implicitly defined by the constraint.

*The coordinates obtained in this way will not in general be very useful. For example, $\theta$ is a much better coordinate to deal with problems on the circle in general.

Finally, let me remark that $\theta$ is not the correct generalized coordinate. There are an infinite number of possible coordinates. What makes a set of coordinates valid is that it comes with a prescription for one to describe an open subset of the configuration space in terms of it. In the first example we gave one of those prescriptions was $x=x$ and $y=\sqrt{1-x^2}$. In the example of $\theta$ the prescription is $x=\cos\theta$ and $y=\sin\theta$.
A: How to choose the generalized  coordinates
there is not unique solution,  but for sure every choice must fulfill the constraint equations and cover your simulation domain.
If you have to solve problem with friction I will choose the line element $s$ ,because  the velocity is $\dot{s}$ and the magnitude of tangent vector  is  one $\parallel{\vec{t}}\parallel=1$.
Example   circular path
with s the generalized coordinate
the EOM is very simple and without singularity :
$$\ddot{s}=\frac{1}{m}\,(F+F_\mu)$$
where F is the applied force and $F_\mu~$the friction force
$$F_\mu=-\text{signum}(\dot{s})\,m\,\dot{s}^2\,r $$
with x the generalized coordinate $\Rightarrow~y=\sqrt{r^2-x^2}$  the EOM is:
$$\ddot{x}=  \begin {array}{c} -{\frac {F\sqrt {{r}^{2}-{x}^{2}}}{rm}}-{
\frac {F_{{\mu}}\sqrt {{r}^{2}-{x}^{2}}}{rm}}+{\frac {x{{\dot x}}^{2}}
{{r}^{2}-{x}^{2}}}\end {array}  
$$
with the   singularity  at  $x=r$
