She purchased 5 paperbacks at $4 and 3 hardbacks at $8 for a total of $44.
h = number of hardback books
p = number of paperback books
h + p = 8
so
h = 8-p
.
4*p = price of paperbacks
8*h = price of hardbacks
4*p + 8*h = 44
.
substitute h = 8-p
.
4p + 8(8-p) = 44
4p +64 -8p = 44
-4p = -20
p = 5
h = 8-p
h = 3
.
check to be sure the values are right
4*5 = 20
3*8 = 24
20 +24 = 44