the total length of te string ist taken to be constant as the string is light and in extensible the height of the pullys are taken from the same potential level and divided as the total lenght of the string and differentiated
FOR BETTER UNDERSTANDING CONSULT ENGINEERING DYNAMICS BY MARRIAM AND KRAIGE
FROM THERE LEARN FIRST AND SECOND DEGREE OF FREEDOM
YOUR CONCEPT WILL DEFINITELY BE CLEARED TRUST ME