The book I'm referring to for studying beams, said that its quite cumbersome to construct shear force and bending moment diagrams, by writing the SF and BM equations for each segment of the beam and then plotting the equations. To solve this problem we can form relationships between shear force, Bending moment and loads and then use them to construct SFD and BMD.
So, the book starts off by developing a relationship between shear force and load. In doing so, it says that consider a beam with some arbitrary distributed load. At any distance x, we take an element between two sections. The distributed load on this element can be assumed uniform with intensity say, $q$.
Then it says that shear force and bending moments will be developed at each section of this element, and in general they can vary along the length. The book then assumes the direction of shear force and BM to be what it considers "positive".
The author has taken shear force as positive if it tries to rotate the element clockwise, and BM positive when it tries to compress the upper part of the element.
applying the equilibrium condition to the element yields,
$$V_1 - V_2-qdx=0$$ $$V_2-V_1=-qdx$$ $$\frac{V_2-V_1}{dx}=-q$$
Thus $V_2-V_1$ will be differential
$$\frac{dV}{dx}=-q$$
The book came at this result by taking the SF and BM as positive (as is shown in the figure).
If I take the direction of SF and BM opposite to what the books takes (i.e. shear force tends to produce an antickw rotation of the element) I get
$$\frac{dV}{dx}=q$$
The relations are different depending on what sign of SF and BM I take. However I have seen the book using the first relation (with a -ve q) even in places where the element is acted upon by -ve shear force (i.e. when the shear force tends to rotate the element antickw)
Why the equation $$\frac{dV}{dx}=-q$$ applies even when the shear force tends to produce an antickw rotation, even though it was derived for clockwise rotation shear force.