P + N = 178, which is the total number of items sold.
.25P + .5N = 58.75 - the price per pencil times the number of pencils sold, plus the price per notebook times the number of notebooks sold, equals the total sales amount.
P + N = 178 so P = 178-N. Substitute that into the second equation.
.25(178-N) +.5N = 58.75
44.50 - .25N + .5N = 58.75
.25N = 14.25
N = 14.25/.25 = 57
P = 178 - 57 = 121
Check: .25*121 + .50*57 = 30.25+28.50 = 58.75