Kate bought 3 CDs and 1 DVD at a store. Her friend Joel bought 2 CDs and 2 DVDs. If Kate spent $20 and Joel spent $22, determine the cost of a CD and DVD.

~Please provide an explanation as well.
Please and thanks!

3C + D = 20

D = 20-3C

2C + 2D = 22

Substitute 20-3C for D in second equation and solve for C. Insert that value into the first equation and solve for D. Check by inserting both values into the second equation.