Are the generalized coordinates in Lagrangian mechanics really independent? In Goldstein's Classical Mechanics, Chapter 2.3: Derivation of Lagrange's Equations From Hamilton's Principle part of the derivation involves each of the generalized coordinates being independent.
$$
\begin{equation*}
\delta J = \int_{1}^{2} \sum_i \bigg(\frac{\partial f}{\partial y_i} - \frac{d}{dx} \frac{\partial f}{\partial \dot{y}_i}\bigg)\ \delta y_i\ dx, \tag{2.17}
\end{equation*}
$$
"Because the y variables are independent, the variations $\delta y_i$ are independent. Hence, by an obvious extension of the fundamental lemma, the condition that $\delta J$ is zero requires that the coefficients of the $\delta y_i$ separately vanish: "
$$
\newcommand{\vect}[1]{\boldsymbol{#1}}
\begin{equation}
\frac{\partial f}{\partial y_i} - \frac{d}{dx} \frac{\partial f}{\partial \dot{y}_i} = 0,\ \ \ \ \ \ \ \ \ i = 1, 2, . . ., n. \tag{2.18}
\end{equation}
$$
My questions:  


*

*How exactly do the independence of $\delta y_i$ imply that the coefficients vanish?

*Given relations $y_i=y_i(x)$ for $i = 1, 2, ..., n$ can't we always find a relation $y_i = y_i(y_1, y_2, ..., y_{j \neq i}, ..., y_n)$? For example, if we have functions $y_1 = x^2$ and $y_2 = x^4$ we can find a relation $y_2 = y_1^2$, which shows that these functions are dependent. Is this handled in the derivation of Lagrange's equations? (Keep in mind that $x$ means $t$, I'm just using $x$ because that's what Goldstein uses).

*In Goldstein Chapter 1.3 we are introduced to the constraint equations: $f(\vect{r_1}, \vect{r_2}, \vect{r_3}, ..., t) = 0$. Is there any reason why derivatives of $\vect{r_i}$ aren't included? (Will this have any effect on reducing the degrees of freedom?)

*Are there any formal (mathematical) reasons for why the constraint equations reduces the number of coordinates (and degrees of freedom)?
I only know multivariable and vector calculus, so it would help if you stuck with terms from those two topics.
Also: I'm NOT asking about the independence of the generalized positions and velocities (there are already enough questions about that).
 A: Answering your questions in order:


*

*The equation (2.17) tells us that the integration of some quantity is equal to deltaJ which ultimately we set to zero. Now this integration is zero irrespective of what limits of x we put. So, clearly the reason must be that the integrand itself is zero. Now, the integrand here is the sum of co-efficients of deltaY. If deltaY are not independent then it ay happen that some clever combination of them cancels the others and makes the whole thing zero. But since they are independent(under our assumption of generalised co-ordinate) the only way their sum can be zero is if they are zero individually, which leads to the Lagrange Equation.

*What Does the independence of co-ordinates mean? It does not mean that once you have solved the dynamics i.e. you have found y(x) for all x there will not be any relation between them. Of course there will exist some relation(however complicated it may be). But what it means is that given any n-1 co-ordinate if I ask you to find "n"th y co-ordinate you cannot. Simply because then the "n"th y can have any possible value. Why is so? Because remember we didn't have "n" co-ordinates when we started we had much more. We used up all their internal relations to decrease the no of variables. Now whatever we have is purely independent i.e. they can take any value even when we've specify all the other co-ordinates.

*Constraint relations in general can have higher derivatives of r, which Goldstein explained in detail. Even some constraints can take the form of inequality. For the first case we use modified form of Lagrange Equation.

*The 4th question is apparent. Actually this is the type  of reasoning you used in 2nd question if you take x to be another variable co-ordinate. In that case your generalised co-ordinate was x(say) and your 3 co-ordinate system y1, y2, x had 2 constraint relation y1 = y1(x) and y2 = y2(x). This two reduced the no of euations to one. Namely you now need to solve for x variable only. The other two will be automatically defined.
A: 
How exactly do the independence of $δy_i$ imply that the coefficients vanish?

let $S= \sum_i \bigg(\frac{\partial f}{\partial y_i} - \frac{d}{dx} \frac{\partial f}{\partial \dot{y}_i}\bigg)\ \delta y_i = 0$ (Since the integral of $S$ is zero$^{[1]}$)
dot product of $S$ with $\delta y_m$
$$S \cdot \delta y_m=\sum_i \bigg(\frac{\partial f}{\partial y_i} - \frac{d}{dx} \frac{\partial f}{\partial \dot{y}_i}\bigg)\ \delta y_i \cdot  \delta y_m = \bigg(\frac{\partial f}{\partial y_i} - \frac{d}{dx} \frac{\partial f}{\partial \dot{y}_i}\bigg) \tag{1}=0$$
since Independent variables implies that they are orthogonal,
The RHS is non zero only for $i=m$, (other terms vanish since they are orthogonal)

Given relations $y_i=y_i(x)$ for $i=1,2,...,n$ can't we always find a relation y_i = $y_i(y_1, y_2, ..., y_{j \neq i}, ..., y_n)?$ For example, if we have functions $y1=x2 $and $y2=x4$ we can find a relation $y_2=y_{21}$, which shows that these functions are dependent. Is this handled in the derivation of Lagrange's equations? (Keep in mind that x means t, I'm just using x because that's what Goldstein uses).

remember these are virtual variations and not actual, here you are fixing one of the variables and are trying to vary the other, since you are fixing one of them, you are free to vary the other as you want (again, in harmony with the constraints)

In Goldstein Chapter 1.3 we are introduced to the constraint equations: f(r1,r2,r3,...,t)=0. Is there any reason why derivatives of ri aren't included? (Will this have any effect on reducing the degrees of freedom?)

if the contraint equation were of the form 
$f(q_1, q_2, q_3, \cdots, \dot q_1, \dot q_2,\dot q_3 ..., t) = 0$
The variation $\delta f$ will simply be
$$\delta f=\sum_i^N \frac{\partial f}{\partial q_i} \delta q_i + \frac{\partial f}{\partial \dot q_i} \delta \dot q_i +\frac{\partial f}{\partial t} $$
And the variation of action gives
$\delta L + \lambda \delta f=0 $
All constraints reduce the degrees of freedom 

Are there any formal (mathematical) reasons for why the constraint equations reduces the number of coordinates (and degrees of freedom)?

Suppose 
$$r_i=r_i(q_1,q_2,\cdots, q_n)$$
$i=1,2, \cdots 3N$
since a system of $N$ free particles can have $3N$ degrees of freedom
And suppose there are $m$ constraints 
$$f_j=f_j(q_1,q_2,\cdots, q_n)$$
$j=1,2, \cdots m $
Now not all $n$ variables are Independent due to the constraints and the number of independent equations is therefore reduced to $3N-m$ 
