# Work by gravity for a generic movement

When my book explains the work by gravity it doesn't explain why it passes from the shift (edit: the blue line in the picture) to the ray in this integral

Of course, I understand that the work depends just from the height but why the integral from A to B of ds is not the length of the shift itself?

I also add the example picture:

I apologize in advance if the question is too stupid but I just don't figure it out.

• Because the integral on the left is more general: it would be true, for instance, if $\vec{F}$ was not constant, or did not even represent a conservative field. – tfb Nov 25 '17 at 10:51
• I think a key point is that, if you can take the force out of the integral, then it must be constant, and that means the field must be conservative and the work can't be path-dependant. But of course there are conservative fields (such as Newtonian gravity, and in fact almost anything) where the force is not constant: for those you have to work a bit harder. So I think what they're probably trying to do is to help develop intuition about this stuff. – tfb Nov 25 '17 at 11:47

The workdone in this problem by gravity should be $mg (z_A - z_B)$. This is assuming that the gravity force is constant throughout and pointing towards $-z$ direction.
• NO. It's not wrong. They treat g as a vector and they take it's dot product with $r_{AB}$. That gives you the zA-zB part. – Ari Nov 25 '17 at 10:41