Infinitesimal approximations in triangle yielding differing results I am trying to prove the equations of motion of a pendulum from its energy equation, and I am obtaining different results depending on which infinitesimal approximation I choose.
The idea here is to first obtain the expression for the total energy of the pendulum, then calculate its temporal derivative and with it the equation of motion.

Defining the energy through the angle $\theta$ makes it simple to obtain the correct results, but when I use the horizontal distance $x$ instead, I get different equations of motion depending on how I define the height $h$.
1) $h = l \times (1 - cos(\frac{x}{l}))$. Using the series expansion of the cosine, this expression yields $h = \frac{x^2}{2 l}$
2) $h = x \times tan(\frac{x}{l})$. This expression is obtained since $sin(\theta) = \frac{x}{l}$, which, for small $x$, implies $\theta \approx \frac{x}{l}$. Using the series expansion of the tangent, this yields $h = \frac{x^2}{l}$
As you can see, they differ by a factor of 2, and when I calculate their derivatives, the value will also differ by that factor.
What is going on here?
 A: Letting $H$ be the height of the medium-sized right triangle, then on the one hand, we have $$\cos\theta=\frac{H}{l},$$ so that $$H=l\cos\theta.$$ On the other hand, $$\cos\theta=\frac{l}{H+h}=\frac{l}{l\cos\theta+h},$$ so $$h\cos\theta+l\cos^2\theta=l,$$ so $$h\cos\theta=l(1-\cos^2\theta),$$ which is not the same as $$h=l(1-\cos\theta).$$ Instead, we can see that $$h\cos\theta=l\sin^2\theta,$$ so that $$h=l\tan\theta\sin\theta.$$
Since $x=l\sin\theta,$ then this is exactly equivalent to $h=x\tan\theta.$

Added: As you pointed out (and as I should have noticed right away, given that we're dealing with a pendulum), the marked angle in the smallest triangle cannot be $\theta,$ and so my work above (which assumed that your drawing was correct) isn't accurate. The kicker is that the large triangle should not be thought of as a right triangle, at all, but an isosceles triangle. Thus, the two base angles (in radians) are $$\frac{\pi-\theta}2,$$ and so the marked angle is $$\frac{\pi-\theta}2-\left(\frac\pi2-\theta\right)=\frac{\pi-\theta}2+\frac{2\theta-\pi}2=\frac\theta2.$$
Now that that's established, it is also clear that my $H$ above should simply be $l-h,$ and so you're quite correct that $$h=l(1-\cos\theta).$$ On the other hand, since $$h=x\tan\frac\theta2,$$ then your second approximation should be that $$h\approx x\tan\frac{x}{2l},$$ which gets you the same result as the first version.
