2(X-38)= 173-X can be obtained from the meaning of the question.
2X-76= 173-X
2X+X= 173+76
3X=249
The solution is X=83.
So the library has 83 books on the first floor and 90 books on the second floor.
I wish you progress in your study ~