He made a total profit of $125 and made $40 from the whole hats and made $5 per t-shirt.
We're asked to use x to represent the units of t-shirts sold.
Thus, if we're to represent this mathematically, we have
$(5x + 40) = $125 where
$125 = total profit made
$40 = Profit on hat
$5x = Profit on x t-shirt when a profit on one t-shirt is $5
Therefore, Profit equation is 5x + 40 = 125
To then solve for x, we subtract 40 from both sides of the profit equation.
5x = 125 - 40
5x = 85
to get x, we divide both sides by 5
Therefore, x = 17 t-shirts