I'm self-studying an introductory book on mathematical methods and models and came across the following problem: 1. A bead of mass m is threaded onto a frictionless horizontal wire. The bead is attached to a model spring of stiffness k and natural length l0, whose other end is fixed to a point A at a vertical distance h from the wire (where h > l0). The position x of the bead is measured from the point on the wire closest to A. Find the potential energy function U(x). 2. Relevant equations I'm rather puzzled by the solution given in the book, which claims that since the length of the spring is (h2+x2)1/2 and its extension is (h2+x2)1/2 - l0, then U(x) = (1/2)k((h2+x2)1/2 - l0)2. 3. The attempt at a solution I think that's incorrect because only the x-component of the force exerted by the spring on the bead is relevant to the calculation of U(x). The x-component is -k(l-l0)cos[itex]\theta[/itex], where l = (h2+x2)1/2 and cos[itex]\theta[/itex] = x/(h2+x2)1/2. Hence, U(x) is -[itex]\int[/itex](-kx + kl0x/(h2+x2)1/2)dx. Is this correct?