In order to solve this one you want to start by setting up a system of equations using the information … so if you use p to represent the number of pencils and n to represent the number of pens, that would be
p + n = 16
0.5p + 1.5n = 12
to solve then you want to plug in p = 16 – n into the second expression
0.5(16 – n) + 1.5n = 12
8 – 0.5n + 1.5n = 12
n = 4
then go back to the first equation to solve for the value of p
p + 4 = 16
p = 12
meaning that the scenario works if you bought 12 pencils and 4 pens