Let the numbers of bags of apples be r for red and g for green.
Then r + g = 6, or g = 6 - r.
Numbers of apples: 9r + 4g = 49 total apples
Subbing (6 - r) for g, we get 9r + 4(6-r)= 49. Thus,
9r + 24 - 4r = 49.
5r = 25, so r = 5.
This guy bought 5 bags of red apples and 1 bag of green apples.
5 bags of red apples is 5(9) and 1 bag of green apples is 1(4). This must total 49. Does it? Does 45+4 = 49? YES
This guy bought 5 bags of red apples and 1 bag of green apples (answer)