Finding a general equation for a particle's motion along a curve in 2D space under the force of gravity I was trying to find a general equation for a particle's motion along a curve in 2D space. But I'm not satisfied with the final conclusion I get through the derivation below which I believe doesn't seem to agree with any results.
Given a 2D space, I start with three dependent variables $x(t)$, $y(t)$ and $\theta(t)$ defined by t.
The particle moves from point A to point B with the force of gravity. Assuming there is no uphill along the curve and point A is higher than point B, I came up with the following equations.
A picture that might help you give an idea
Using simple physics, we know that the normal force N = $gcos(\theta(t))$, where $\theta(t)$ is the clockwise angle of the tangent line from x axis at any given instant t. Solving N for x, y components, we get,
$N_{y}=gcos(\theta(t))cos(\theta(t))$
$N_{x}=gcos(\theta(t))sin(\theta(t))$
Hence,
$F_{y}=mgcos^{2}(\theta(t))-mg$
$F_{y}=-mgsin^{2}(\theta(t))$
$F_{x}=\frac{mg}{2}sin(2\theta(t))$
Assuming that there is no force of friction, we arrive at two equations for acceleration.
$y''(t)=-gsin^{2}(\theta(t))$
$x''(t)=\frac{g}{2}sin(2\theta(t))$
But we also know that $y = f(x)$ and therefore we can write that $\frac{\text{d}y}{\text{d}x}=tan(\pi-\theta(t))$ which just simplifies to:
$\frac{\text{d}y}{\text{d}x}= - tan(\theta(t))$
We can apply the chain rule, $\frac{\text{d}y}{\text{d}x}=\frac{y'(t)}{x'(t)}$ and rewrite it in differential equation form,
$y'(t)=-x'(t)tan(\theta(t))$
Now we take the derivative of the differential equation above with respect to t by using the product rule which gives us,
$y''(t)=-x''(t)tan(\theta)-x'(t)\theta'(t)sec^{2}(\theta(t))$
Plugging in the values for $y''(t)$ and $x''(t)$, we reach,
$-gsin^{2}(\theta(t))=-\frac{g}{2}sin(2\theta(t))tan(\theta)-x'(t)\theta'(t)sec^{2}(\theta(t))$
Simplifying using some trigonometric identities gives us,
$-gsin^{2}(\theta(t))=-gsin^{2}(\theta(t))-x'(t)\theta'(t)sec^{2}(\theta(t))$
This result gives us the conclusion that $x'(t)\theta'(t) = 0$ which doesn't make much sense to me. I am skeptical about my method above and I believe that I am doing a math error in my calculation.
I am quite unsure whether I can take a second derivative with respect to t like that. Hope some mathematicians here can figure out the problem with this derivation.
Thanks.
 A: I will present a clean formulation using the Lagrange multipliers technique with this holonomous system.
Calling
$$
\cases{
p = (x, y)\\
\vec v = (\dot x, \dot y)
}
$$
we have
$$
\cases{
T = \frac m2 \vec v\cdot \vec v\\
V = m g p\cdot (0,1)\\
x^2+y^2-r^2=0
}
$$
so the lagrangian reads
$$
L = T - V +\lambda(x^2+y^2-r^2)
$$
and the Euler-Lagrange movement equations are
$$
\cases{
2 \lambda  x-m \ddot x = 0\\
-g m+2 \lambda  y-m \ddot y=0\\
x^2+y^2-r^2=0
}
$$
deriving the restriction which is smooth twice regarding $t$ we have
$$
\cases{
2 \lambda  x-m \ddot x = 0\\
-g m+2 \lambda  y-m \ddot y=0\\
x \ddot x+\dot x^2+y \ddot y+\dot y^2=0
}
$$
now solving for $\ddot x, \ddot y,\lambda$ we have
$$
\left\{
\begin{array}{rcl}
 \ddot x & = & -\frac{x \dot x^2+x \dot y^2-g x y}{x^2+y^2} \\
 \ddot y & = & -\frac{g x^2+y \dot x^2+y \dot y^2}{x^2+y^2} \\
 \lambda & = & -\frac{m \left(\dot x^2+\dot y^2-g y\right)}{2 \left(x^2+y^2\right)} \\
\end{array}
\right.
$$
NOTE
Here $\lambda$ represents the normal reaction during the movement. The movement is done along a centered circle with radius $r$ so the initial conditions should be geometrically compatible.  Considering $r = 1, x_0 = -\frac{\sqrt{2}}{2}. y_0 = \frac{\sqrt{2}}{2}, \dot x_0 = \dot y_0 = 0, m=1, g = 10$ we have the plots showing the coordinates $x$ in blue and $y$ in red and then the reaction $\lambda$ in black.


