A ratio of 5:7 means out of 12 books, 5 are in one category and 7 are in another. (The “category” isn’t specified in this problem.)
So here we’re STARTING with 36 books; we want to find a ratio that is equal to 5:7 and adds up to 36. Well 36 = 3(12), and so if we multiply each number in the ratio by 3 as well, we might get what we want. Doing that gives us 15:21, which adds up to 36 and is equal to 5:7. Boom, that’s the answer.
P.S. Here’s a question you can think about: why do ratios stay the same when you multiply each number by the same amount? (For example, why is 3:1 the same as 6:2?)