Answer: 144 t-shirts and 48 hats.
Explanation:
Let's define:
T = number of t-shirts sold.
H = number of hats sold.
We know that:
"The number of t-shirts sold was 3 times the number of hats"
Then:
T = 3*H
We also know that the profit was $5 for each t-shirt and $2.50 for each hat, then the total profit is written as:
T*$5 + H*$2.50
And we know that the total profit is $840, then we have the equation:
T*$5 + H*$2.50 = $840
Then we have the system of equations:
T = 3*H
T*$5 + H*$2.50 = $840
To solve this, we already have a variable isolated in one of the equations (T), then we can just replace it in the other equation:
(3*H)*$5 + H*$2.50 = $840
Now we can solve this for H.
H*$15 + H*$2.50 = $840
H*$17.50 = $840
H = $840/$17.50 = 48
This means that there were sold 48 hats.
Now if we use the equation T = 3*H we can find the number of t-shirts sold
T = 3*48 = 144
There where 144 t-shirts sold.