Question 1003379
Let's take the First Shelf as Y
Let's take the second Shelf as X

   From the question, Originally; Y = 5X

However, upon removing 20 from Y and adding it to X we now have a new Shelf arrangement and we shall call it Z.

   Z can be expressed as;
    Z = X + 20

From the latter part of the question we can clearly write a new equation after the subtraction/addition from/to Y and X respectively. Whereas Y is thrice the new Shelf arrangment(Z).

   Y-20 = 3Z (Where Z is X+20)
Y-20 = 3(X+20)
Y-20=3X + 60

  Remember that, Y = 5X, Therefore we substitute Y for X in the above equation.

5X - 20 = 3X + 60.  
   Solving the above linear equation gives X as.
X= 40.

If X is 40 therefore Y = 5*40

Y= 200.

  The first shelf originally had 200 Books while the second originally had 40 Books.