# Work done when ball is thrown upwards [duplicate]

When a ball is thrown upwards, we initially apply a force $F=ma$ vertically upwards and it raises to a height $h$. A force $F=mg$ acts vertically downward (i. e $F=-mg$) due to gravity and it causes it to stop moving higher once. If at that point, we consider the energy stored in ball, then it is $mgh$. As energy = work, and work=force*displacement, then why is work not equal to $mah$, or $-mgh$ as force $mg$ is never applied at any time. Maybe I am misunderstanding concept of work, and I too read that work and force should not be confused, but what's the logic here?

Treating the ball as the system the ball has some initial kinetic energy $E_{\rm initial}$ and aa external force on it $mg$ acting downwards.

If the ball rises to a height $h$ and stops then the change in kinetic energy is $0-E_{\rm initial}= -E_{\rm initial}$.

The work done on the ball by the external force is $-mgh$ with the negative sign there because the direction of the external force (downward) is in the opposite direction to its displacement (upward).

So $-E_{\rm initial}=-mgh \Rightarrow E_{\rm initial}=mgh$.

During this time the acceleration of the ball $a=g$ is downwards.

When a ball is thrown upwards, we initially apply a force F=ma vertically upwards

Note that the analysis above has no mention of how the ball got its initial kinetic energy.
Say the some force $X$ exerted on the ball by your hand increased the kinetic energy of the ball then that force $X$ must have been greater than $mg$ otherwise the ball would not have increased its upward speed and gained kinetic energy.
If the ball had started from rest then the work done by your hand would have been $mgh$ and if the force $X$ was constant $X=ma$ and $Xd=mgh$ where $d$ is the upward displacement of force $X$ and $a$ is it’s acceleration whilst its kinetic energy is increasing before leaving your hand.
The upward acceleration of the ball $a$ whilst the ball is in contact with your hand does not necessarily have the same magnitude of the downward acceleration of the ball $g$ when it has left your hand.

Gravitational force is conservative and so the work done on a particle moving between two points does not depend on the path taken by the particle. Using the Gradient theorem, we can calculate the work done by the gravitational force evaluating the potential function at the start point and at the end point.

$$W=\int_{C}F\cdot dx=\int_{x(t_{1})}^{x(t_{2})}F\cdot dx=-\left[U(x(t_{2}))-U(x(t_{1}))\right]$$

$$W=-mg\left(h_{2}-h_{1}\right)$$