You are trying to find the ratio of "x" gold books to 24 red books.
First, divide 24 with 3:
24/3 = 8
The questioner multiply 8 to the ratio's denominator. To solve completely, what you do to the denominator of the fraction, you must do to the numerator. Multiply:
5 x 8 = 40
40 gold notebooks is your answer, making the ratio 40 gold : 24 red.