If we define p as the number of psychology textbooks sold and h as the number of history textbooks sold, we can produce the following system of equations.
p+h=382
h=p-62
To solve this system, you can use substitution and plug the second equation into the first:
p+h=382
p+(p-62)=382
2p-62=382
2p=444
p=222
Now that you've solved for p, you can go back into either of the original equations and solve for h.
h=p-62
h=222-62
h=160
Therefore, your final answer is the textbook store sold 222 psychology textbooks and 160 history textbooks.