# The Potential Energy of Spring

Let's consider having 2-D Cartesian coordinate $$xy$$-plane, a block connected to a spring (placed horizontally on negative part of $$x$$-axis and having natural length L) sitting at the origin point with the spring at natural length.It is allowed to oscillate back and forth about the origin. From the equation that relates the work done by conservative force and the potential energy, $$U(x_a)-U(x_b)= -\int^{x_a}_{x_b} F_x \text{d}x$$. If we define the zero point at $$x=0$$, we can express its potential energy for $$0\lt x \lt L$$, with $$U(x)-U(x=0)= -\int^x_0-kx \text{d}x \Rightarrow U(x)=\frac{1}{2}kx^2$$ while for $$-L\lt x\lt 0$$, we have (the restoring force switch sign as it now points to the positive x- direction): $$U(x)-U(x=0)= -\int^x_0kx \text{d}x \Rightarrow U(x)=-\frac{1}{2}kx^2$$

My question: Is my idea and this approach for the energy of the system correct? Because I saw from some reference books, they simply say that it is just $$\frac{1}{2}kx^2$$ for both of the conditions.

• There is no need to place an extra negative sign because $x$ itself can already be negative and that will automatically account for the direction. It is generally not advisable to indicate direction using negative signs without explicitly specifying the range $x$ can take. Aug 26, 2021 at 12:34
• For example, in a one-dimensional collision between two point masses $m_1,m_2$ with initial velocities $u_1,u_2$ and final velocities $v_1,v_2$, the conservation of momentum equation is always $m_1u_1+m_2u_2=m_1v_1+m_2v_2$. There is no need to add signs to $u$ and $v$ manually as the directions are already accounted for by the values of $u$ and $v$ themselves. Aug 26, 2021 at 12:39
• For first case if I don’t add negative sign I will be substituting a positive x for displacement in positive x axis. In this case my force turned out to be pointing away from origin which is not true. Aug 26, 2021 at 12:53
• Your first case is correct. It's your second case that it wrong; the sign should not be switched. As it stands now, for $x \lt 0$, the force of $kx$ would point in the negative direction, which is incorrect. It should still be $-kx$. Aug 26, 2021 at 12:55

For $$-L, a spring force of $$+kx$$ would point in the negative direction (since $$k > 0$$ and $$x < 0$$.) This would not be a restoring force, as it would point away from the origin.

On the other hand, a force of $$F = -kx$$ for all $$x$$ points in the negative direction for positive $$x$$ ($$F < 0$$ and $$x>0$$), but points in the positive direction for negative $$x$$ ($$F > 0$$ and $$x < 0$$). This is the correct function to model the force, and leads to a potential energy of $$\frac12 k x^2$$ for all $$x$$.

• Why x greater than zero for negative direction? I thought x have to take values accordingly from the displacement? Aug 26, 2021 at 12:50
• @EugeneNg: I didn't say that $x$ was greater than zero for the negative direction. I said that if $F = -kx$, then $F$ is positive when $x$ is negative and vice versa, which is the correct behavior for a restoring force. Edited to make this more explicit. Aug 26, 2021 at 12:54