The variables are:
x: cost of each bag of soil
y: cost of each bag of fertilizer
He bought 15 bags of soil and 3 bags of fertilizer for $282.72, that is,
15x + 3y = 282.72 (eq. 1)
He bought another 5 bags of soil and 2 bags of fertilizer for $107.23, that is,
5x + 2y = 107.23 (eq. 2)
Multiplying equation 2 by 3, we get:
3(5x + 2y) = 3(107.23)
3(5x) + 3(2y) = 3(107.23)
15x + 6y = 321.69 (eq. 3)
Subtracting equation 3 to equation 1, we get:
15x + 3y = 282.72
-
15x + 6y = 321.69
-------------------------------
-3y = -38.97
y = -38.97/-3
y = 12.99
Replacing this result into the first equation,
15x + 3(12.99) = 282.72
15x + 38.97 = 282.72
15x = 282.72 - 38.97
15x = 243.75
x = 243.75/15
x = 16.25
D. Each bag of fertilizer was $12.99, and each bag of soil was $16.25.