We wish to extremize $$S = \int \mathcal{L}(\mathbf{y}, \mathbf{y}', t) dt $$ subject to the constraint $$g(\mathbf{y}, t) = 0 \;.$$ We move away from the solution by $$y_i(t) = y_{i,0}(t) + \alpha n_i(t) $$ $$\frac{\partial S}{\partial \alpha}= \int \sum_i \left(\frac{\partial\mathcal{L} }{\partial y_i} - \frac{d}{dt} \frac{\partial \mathcal{L}}{\partial y_i'} \right)n_i(t) dt $$ If the $n_i(x)$ are independent, then we obtain the $E-L$ equations immediately from this. For our constrained problem we wish to eventually obtain
$$\frac{\partial\mathcal{L} }{\partial y_i} - \frac{d}{dt} \frac{\partial \mathcal{L}}{\partial y_i'} + \lambda(x)\frac{\partial g}{\partial y_i } = 0 $$
However I am unsure of how to show this except in the two dimensional case, $i = 1,2$. I am faimiliar with the method of Lagrange multipliers for finite dimensional vector spaces and crudely applying this I might expect $$\frac{\partial S}{\partial \alpha} = -\lambda \frac{\partial g}{\partial \alpha}$$ However this seems wrong since this $\lambda$ is not a function of x and the resulting equation didn't get me where I wanted to go. I tried looking around for a little while and nothing I've seen gives sufficient explanation for this for the N-dimensional case. The two dimensional example related the $n_1$ to $n_2$ in a way that was not straightforward to generalize.