Let's say that the cost of pens = x
and the cost of pencils = y
Then we can set up a system of linear equations
2y + 3x = 78
3y + 2x = 72
Now, let's multiply the top equation by 3 and the bottom equation by 2. After that, we will subtract the two
6y + 9x= 234
6y + 4x = 144
Subtracting gives us
5x = 90
x = 18
Now plug x = 18 into either of the two above equations. Let's choose the first equation
2y + 3x = 78
2y + 3(18) = 78
2y + 54 = 78
2y = 78 - 54
2y = 24
y = 12
Pens are $18 each and pencils are $12 each (are you sure that it isn't cents rather than dollars?)