We know that by $F=-dU/dx$ formula that when force is attractive in nature potential energy increases and when force is repulsive, potential energy decreases. But I don't exactly understand this concept. Whenever i think of repulsive force i feel that the potential energy between two bodies would increase but it's the other way around. Where am i wrong? Is there any example that would help me understand this better? Like what is an attractive and repulsive force anyway!
2 Answers
Imagine two objects with the same electric charge. In a physics classroom you might use a pair of metal spheres on insulating stands. Since they have the same charge, e.g. both negative, There will be a repulsive force between them. If they start a certain distance apart and you want to move them closer together then you will have to do work against this repulsive force. In the process of doing this work you lose energy and the system gains electric potential energy. In theory you could use that stored energy to do some useful work at a later time by say, putting one of the stands on a cart which would get pushed away and pull a string or something.
In this example the two like charges act a bit like a compression spring. Reducing the distance between them stores energy akin to compressing the spring.
If, on the other hand, you have a positively charged sphere and a negatively charged sphere then there will be a force of attraction between them. In this case moving them close together doesn't require you to do any work (if we can ignore friction) rather as the charges move closer together they could do some work for you - the system is losing potential energy.
The gradient/derivative of the potential energy gives you the in which the force is acting. So, in a one dimensional system, negative potential energy gradient, i.e. $-\frac{dU}{dx} > 0$ gradient means that it's acting towards the positive $x$ direction and vice versa. In other words, the force pulls you towards the direction along which potential energy is decreasing.
So, in your context, attractive and repulsive seem to be relative to the direction in which you, the observer are facing (sort of, observer in Physics is a whole different can of worms).
And you're right in thinking about potential energies in the context of two-body (or many-body) problems, but any one body can be thought of as existing in a potential energy background. So, the source of the potential energy need not be specified, but only the potential as a scalar field.
E.g. the potential energy between Earth and Moon is some $\frac{Gm_1m_2}{|\vec r_1-\vec r_2|^2}$, where $r_1$ and $r_2$ are coordinates of the Earth and its moon with respect to some origin. An equivalent one-body description would be something like $U(\vec r) = \frac{Gm_1m_2}{|\vec r|^2}$ for the Moon, where $\vec r = \vec r_2 - \vec r_1$ and you can calculate the force acting on the Moon by calculating the gradient of $U(\vec r)$. Hope this helps.